chapter 10 software programming -...
TRANSCRIPT
Chapter 10: Software Programming 2
Discussion Topics System development life cycle Life cycle of a program Problem statement Algorithms Moving from algorithm to code Moving from code to machine language Testing programs Completing a program Selecting the right programming language Most popular programming languages
Chapter 10: Software Programming 3
Information Systems System A collection of pieces working together to
achieve a common goal
An information system includes Data People Procedures Hardware/Software
System development life cycle (SDLC) An organized process (or set of steps) used to
develop systems in an orderly fashion
Chapter 10: Software Programming 4
System Development Life Cycle
Problem/ Opportunity Identification
Analysis
DesignDevelopment
& Documentation Testing
& Installation Maintenance
& Evaluation
One step is completed before proceeding to the next.
Chapter 10: Software Programming 5
SDLC Step #1:Problem/Opportunity Identification
The existing system is evaluated: Problems are defined
New proposals are reviewed
Decisions are made to proceed with the
projects
Document the process and relevant
problems/opportunities defined
Chapter 10: Software Programming 6
SDLC Step #2:Analysis
A program specification is developed
(goals and objectives of the project are clearly stated)
Feasibility assessment is performed (should the project move forward)
User requirements are defined
Analysts recommend a plan of action
The plan is documented
Chapter 10: Software Programming 7
SDLC Step #3:Design
A detailed plan for programmers is developed Flowcharts and data-flow diagrams are used for the
current and proposed system Document the design
Data-flow diagram
Flowchart
Chapter 10: Software Programming 8
SDLC Step #4:Development & Documentation
Actual programming takes place
First phase of the program development life cycle (PDLC)
Development is documented
User documentation is created
Chapter 10: Software Programming 9
SDLC Step #5:Testing & Installation
Testing the program for proper operation
Installation of the program for use
Document testing and results
Chapter 10: Software Programming 10
SDLC Step #6:Maintenance & Evaluation
Performance of the system is monitored
Corrections and modifications to the program are made (program bugs)
Document maintenance procedures and results
Chapter 10: Software Programming 11
The Life Cycle of a Program
Programming is the process of translating a task into a series of commands a computer will use to perform that task.
Programming involves: Identifying the parts of a task the computer can
perform. Describing tasks in a specific and complete
manner. Translating the tasks into a language that is
understood by the computer’s CPU.
Chapter 10: Software Programming 12
Program Development Life Cycle
Step 5Finishing the Project
Step 4Debugging
Step 3Coding
Step 2Making a Plan
Step 1Describing the Problem
Chapter 10: Software Programming 13
PDLC Step 1 : Describing the Problem
The problem statement is: The starting point of programming A description of tasks the program is to
accomplish How the program will execute the tasks Created through interaction between the
programmer and the user
The program statement includes error handling and a testing plan
Chapter 10: Software Programming 14
Parking Garage Example
Error message/ask user to reenter value
Handling error
8*7.32 + 4*11.73 Testing overtime input
3*7.32 Testing positive input
8*7.32 Testing positive input
OUTPUT NOTES
–6
12
3
8
INPUTTESTING PLAN:
The input Number of Hours Worked must be a positive real number. If it is a negative number or other nonacceptable character, the program will force the user to reenter the information.
ERROR HANDLING:
The Total Pay Earned is computed as $7.32 per hour for the firsteight hours worked each day. Any hours worked beyond the first eight are billed at $11.73 per hour.
PROCESS:
Total Pay Earned ................................... a positive numberOUTPUTS:
Number of Hours Worked........................ a positive numberINPUTS:
To compute the total pay for a fixed number of hours worked at a parking garage.
PROGRAM GOAL:
Chapter 10: Software Programming 15
PDLC Step #2: Making a Plan
Develop an algorithm: A set of specific, sequential steps that
describe what the computer program must do
Complex algorithms include decision points: Binary (yes/no) Loop (repeating actions)
Visual tools used to track algorithm and decision points include:
Chapter 10: Software Programming 16
Flowchart and Pseudocode
Flowchart
Underlined words are information items that appear repeatedly in the algorithm.
1. Ask the user how many hours they worked today
2. If the number of hours worked < = 8, compute total pay without overtime otherwise, computetotal pay with overtime pay
3. Print total pay
Bold terms show actions that are common in programming, such as reading data, making decisions, printing, and so on.
Pseudocode
Chapter 10: Software Programming 17
Top-Down Design
Problem is divided into a series of high-level tasks
Detailed subtasks are created
Subtasks are refined into an algorithm or instruction sequence
Chapter 10: Software Programming 19
Object-Oriented Analysis Classes are identified (categories of inputs;
nouns) Data (information; adjectives) Methods or behaviors (actions; verbs)
Objects are defined by their class, data, and behavior
Interaction between classes is determined Existing classes can be used for other
projects Leads to reusability
Chapter 10: Software Programming 21
PDLC Step #3: Coding
Coding is translating an algorithm into a programming language
Generations of programming languages
Chapter 10: Software Programming 22
Writing the Program
Variable declarations signal the operating system that storage is needed in RAM
Variables are created for all inputs and outputs Amount of running RAM needed Space is determined by the variable’s
data type
Chapter 10: Software Programming 23
Compiling the Program
Compilation is the process of converting code into machine language
A compiler reads the source code and translates it into machine language
After compilation, programmers have an executable program
Chapter 10: Software Programming 24
Interpreting the Program An interpreter translates source code into
a line by line intermediate form Each line is executed before the next line is
compiled Programmers do not have to wait for the
entire program to be recompiled each time they make a change
Programmers can immediately see the results of changes as they are making them in the code
Chapter 10: Software Programming 25
PDLC Step #4: Debugging
Running a program to find errors is known as debugging
Sample inputs are used to determine runtime (logic) errors
Debugger: Tool that helps programmers locate runtime errors
Chapter 10: Software Programming 26
PDLC Step #5: Finishing the Project
Users test the program (internal testing) Beta version released: Information collected about errors before final
revision
Software updates (service packs): Problems found after commercial release
Documentation created: User manuals User training
Chapter 10: Software Programming 27
Programming Languages
Selecting the right language: Space available Speed required Organizational resources available Type of target application
Visual Basic
C / C++ JavaHTML
JavaScriptVBScript
ASP / JSP
Flash / XML
Chapter 10: Software Programming 28
Visual Basic Used to build Windows applicationsObject-oriented languageVisual Basic 2005 is the current
version
Sample Visual Basic
Chapter 10: Software Programming 29
C and C++ C Developed for
system programmers
Combines high and low level programming features
Modern operating systems written in C
C++ Uses the same
features as C Includes object-
oriented design
Sample C
Sample C++
Chapter 10: Software Programming 30
Java
Object-oriented features
Large set of existing classes
Architecture neutral
Java applets: Small Java-based programs
Chapter 10: Software Programming 31
Web Applications
HTML/XHTML Hypertext Markup Language/Extensible
Hypertext Markup Language Not a true programming language Uses special symbols (tags) to control
how Web pages are viewed
Extensible Markup Language (XML) Enables computers to efficiently transfer
information between Web sites
Chapter 10: Software Programming 32
Web Applications JavaScript Used to make Web pages more visually appealing
and interactive
VBScript A subset of Visual Basic Used to add interactivity to Web pages
PHP Another scripting language gaining popularity
Dynamic Decision Making Web page has the ability to display content based
on user choices
Chapter 10: Software Programming 33
Web Applications
Active Server Pages (ASP) and Java Server
Pages (JSP)
Adds interactivity capabilities to Web pages
Translates user information into a request for more information from a company’s computer
Flash
Enables elaborate animations to be created for Web pages