View
217
Download
1
Embed Size (px)
Citation preview
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 2
Objectives
1. Understand how computer programming works within the systems development life cycle (SDLC).
2. Understand the basic coding techniques and control structures needed to write a software application.
3. Describe various programming logic, syntax, and run-time errors.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 3
Objectives
4. Understand how programmers implement and maintain software.
5. Identify the various programming language generations and characteristics.
6. Explore the newer Web programming languages and understand how they are used.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 4
A:// Programmer's View of Investigation, Analysis, and Design
• Systems Investigation– Lay the foundation for a new system– Define the problem/opportunity
• Systems Analysis– Focus on information and processing– Develop logical specifications
• Systems Design– Convert logical descriptions– Focus on physical characteristics
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 5
Systems Investigation
• What is client’s request?
• Questions to ask:
• Create problem/opportunity statements
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 6
Systems Analysis
1. What information will go into the software?
2. How will the software process information?
3. What information will the software generate?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 7
Programmer Modeling Techniques
• Pseudocode– Outline of necessary steps– Steps called algorithms
• Program Flowcharts– Plots software’s algorithms– Graphical depiction of detailed steps
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 8
Pseudocode
• Use simple English
• One command per line
• Boldface important words
• Start at top• Form modules
using spaces
McGraw-Hill/Irwin Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 9
Program Flowcharts
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 10
Systems Design
• Convert logical descriptions into software specifications
• Know basic software needs– Input– Processing– Output
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 11
Input-Process-Output Tables
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 12
Making the GradeSection A: //
1. ____________ uses English statements to create an outline of an algorithm.
2. An ____________ is a set of specific steps to solve a problem.
3. A _________ is a location in the system’s memory that holds different values in software.
4. Managing information according to software’s logic is _____.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 13
B:// Writing Computer Software
• Construction phase of SDLC• Coding
– Explain your algorithm in terms a computer can understand
– Write software using a programming language
• Programming language contain specific rules and words
• Expresses the logical steps of an algorithm
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 14
Software Written in Visual Basic (VB)
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 15
Control Structures
• Sequential execution – code is executed in order it appears
• Control structures – you specify order in which code is executed
1. Sequence control structures
2. Selection control structures
3. Repetition control structures
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 16
Sequence Control Structure
• Executes software from top to bottom, left to right
• Enforces sequential execution
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 17
Selection Control Structure
• Uses an existing condition to decide how a computer will execute software
• Makes a decision based on a condition
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 18
Selection Control Structures
If-Then-Else Control Structure Case Control Structure
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 19
Repetition Control Structure
• Repeats a series of steps
• Called iteration control or loop Do-while Do-until For-next
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 20
Repetition Control Structures
Do-while control – repeats a portion of code as long as a certain condition exists
Do-until control – repeats a portion of code as long as a certain condition doesn’t exists
For-next control – repeats a portion of code a precise number of times
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 21
I•Series InsightsEthics, Security & Privacy
Programming Backdoors
• Backdoor is an undocumented method to gain access to a program or computer
• Saves time when making fixes• Can cause problems
– Hackers– Viruses
Are backdoors beneficial or too risky?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 22
Making the GradeSection B: //
1. _________ is when you translate your algorithm into a programming language.
2. Programming languages have __________ words for certain purposes.
3. The ___________ structure tests a condition that can result in more than a true or false answer.
4. Repetition control structures are also called __________.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 23
C:// Testing, Implementing, and Maintaining Software
• Systems Development Life Cycle Phases Construction - phase #4 Implementation - phase #5 Support - phase #6
• Phases correspond to programming steps Testing Implementation Maintenance
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 24
Testing Software
• Debugging Process of finding errors Bugs – common name for software errors
• Types of errors Syntax errors Run-time errors Logic errors
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 25
Syntax Errors
• Mistakes in a software code’s grammar
• Misspelling a command word
• Forgetting to close a module
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 26
Run-Time Errors
• Mistakes that occur when you run code– Not displaying a window correctly– Not matching variables in a calculation– Adding a number and a letter is a good
example
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 27
Logic Errors
• Check first for errors when you design an algorithm
• Logic error is a mistake in the way algorithm solves a problem
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 28
User Testing
• Users must test software
• Acceptance testing - “sign off” that software works correctly
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 29
Software Development Environment
• An application that provides programming tools– Used to debug software– Manages software programs
• Powerful programming features• Rapid application development (RAD)
• Tool that is used instead of a simple text editor like Notepad
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 30
Microsoft VB Development Environment
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 31
Case Tools
• Computer aided software engineering
• Software applications
• Tools that help to…• Prepare reports• Draw program flowcharts• Generate software code for prototypes
What are prototypes?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 32
Microsoft Visio – CASE Tools
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 33
Implementing Software
• Comments
• Program manual
• User manual
Why is documentation important?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 34
Maintaining software
• Software Patches– Small fix to a program problem– Uses a piece of software code
• Software upgrades– Used when patches are no longer enough– Substantial revision of existing software– Example – MS Office XP is an upgrade to
MS Office 2000
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 35
Making the GradeSection C: //
1. _________ errors are mistakes in a software code’s grammar.
2. _________ testing involves testing each individual program.
3. A ____________ is a technical manual for programmers.
4. A _____________ is a small fix to a software problem.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 36
D:// Programming Language
• Machine language Machine-dependent & low level language Uses binary code
• Assembly language Machine-dependent & low level language Uses word abbreviations
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 37
Assembly Language Program
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 38
Programming Languages
• Third Generation Language Machine-independent & high-level language Uses human words and symbols Procedural language Examples
COBOL C++ Fortran Java
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 39
Programming Languages
• Fourth Generation Language Machine-independent High-level language Non-procedural Uses human words and symbols Example - SQL
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 40
Programming Language Characteristics
• Compiled– Compiler– Source code & object code
• Interpreted
• Scripted– Interpreted language that works with
another application– Visual Basic for Applications (VBA)
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 41
VBA in Microsoft Excel
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 42
Object-Oriented Programming
• Objects– Procedures– Object-oriented
programming (OOP)
• Object instance
• Event driven
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 43
Programming Languages
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 44
Making the GradeSection D: //
1. A _____________ language works only on a specific computer system.
2. A _______ is a utility program that converts assembly language into machine language.
3. A ___________ translates a high-level programming language into machine language.
4. A ________ is an item that contains information and procedures.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 45
E:// Web Programming
• Markup language• HTML – Hypertext Markup Language• XML – eXtensible Markup Language• XHTML – eXtensible HTML
• Syntax• A set of rules to follow • Used by markup languages to instruct Web
browsers
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 46
Practically SpeakingLanguage Translators
• Software that can translate Web pages, e-mail letters, reports, manuals, and books into another language
• Some Web sites will translate text for free
• Be wary – some phrases don't translate well
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 47
Client-Side Web Programming Languages
• Dynamic HTML (DHTML)– Combines CSS, JavaScript, specific tag
extensions, and other markup languages– Brings high interactivity to Web sites
• VBScript– Similar to JavaScript– Only Microsoft's Internet Explorer Web
browser can use it
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 48
Server-Side Web Programming Languages
• Need Web servers to run certain applications
• Uses Web server resources to…– Retrieve information– Process information– Output customized Web pages
• Used for advanced applications and tasks
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 49
Making the GradeSection E: //
1. ________ combines HTML with XML.
2. _________ Web programming languages use Web browser resources to add interactivity and new functions to Web pages.
3. ___________ is an interpreted scripting language based on Visual Basic.
4. _____________ programming user Web server resources.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 50
F:// “Key” Key Terms
• algorithm (p. 11.4)• backdoor (p. 11.12)• bug (p. 11.13)• CASE (p. 11.16)• debugging (p.11.13)• documentation
(p.11.16)
• object code (p. 11.21)
• program flowchart (p. 11.7)
• pseudocode (p. 11.4)
• source code (p. 11.21)
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 51
Frequently Asked Questions
• I know HTML. Can I be called a programmer?
• What steps should a programmer take to write software?
• What is pseudcode? How is it used?• What is an algorithm?• What software should a programmer use
to create an application?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 52
FAQs cont.
• Are repetition-control structures like program loops?
• What are CASE Tools?• What is the difference between a patch
and an upgrade?• Is Visual Basic 3GL or 4GL?• What's the difference between a Web
programmer and a Web developer?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 53
Hands On ProjectsE-Commerce
• Did you know that you can get your credit history online? Find five sites that let you order a copy of your credit history.– Is the service free or is there a charge?– How many months can you use the
service?– Can you get reports from more than one
credit agency?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 54
Hands On ProjectsOn the Web
• You don't have to be a programmer to enhance your web site and make it more attractive. Find sites that offer free code to add to your HTML code. What programs are available? How useful is this code? If you have already created a Web page, try inserting some of these programs to see how they work.
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 55
Hands On ProjectsEthics, Security, & Privacy
• There is a story of a programmer who created a payroll system to self-destruct if his name was not included among the weekly pay checks. If you were a manager, what would you do to make sure that you received good code, service, and support from the individuals creating software for your business?
McGraw-Hill/Irwin
Copyright 2002 by the McGraw-Hill Companies, Inc. All rights reserved.
11 - 56
Hands On ProjectsGroup Activities
• Not all school registration systems are perfect. What about yours? Could it use improvement? Work with your group to identify a problem or opportunity for class registration. Analyze the situation, create a problem/opportunity statement, and design the pseudocode and flowchart.