the program life cycle l.
Skip this Video
Download Presentation
The Program Life Cycle.

Loading in 2 Seconds...

play fullscreen
1 / 23

The Program Life Cycle. - PowerPoint PPT Presentation

  • Uploaded on

The Program Life Cycle. 1. Phases of the life cycle. 2. Example of the Design Phase. 3. Implementing the algorithm. Phases of the program life-cycle. A. The Design Phase. Creation of an algorithm . Analogy: drawing up a blueprint for a house. B. The Implementation Phase.

I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
Download Presentation

PowerPoint Slideshow about 'The Program Life Cycle.' - siegfried

Download Now An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.

- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript
the program life cycle

The Program Life Cycle.

1. Phases of the life cycle.

2. Example of the Design Phase.

3. Implementing the algorithm.

phases of the program life cycle
Phases of the program life-cycle.
  • A. The Design Phase.
    • Creation of an algorithm.
    • Analogy: drawing up a blueprint for a house.
  • B. The Implementation Phase.
    • Creation of a program.
    • Analogy: building a house.
  • C. The Maintenance Phase.
    • Use and modification of a program.
    • Analogy: adding an extension, repair of house.
the design phase
The Design Phase.
  • 1. Receive the problem specification.
  • 2. Understand / analyze the problem.
  • 3. Create an algorithm.
  • 4. Test and debug the algorithm


where may errors arise
Where may errors arise?
  • 1. Failure to understand the problem.
    • May solve a different problem instead!
  • 2. Incorrect algorithm.
    • Either the solution fails to be an algorithm (fails one or more of four criteria) or it fails to give the correct answer in all cases.
how to avoid errors in design
How to avoid errors in design.
  • We can reduce the number and severity of errors by:
  • 1. Taking time to fully understand the problem.
  • 2. Ensuring that we have a true algorithm and that it works for both “normal” and “unusual” data—meaning?
importance of design phase
Importance of Design Phase.
  • Studies show that time spent in the design phase is always a good investment.
  • Analogy:
  • which is most cost-effective and causes least problems ---
  • preventative care or treatment of illness?
the implementation phase
The Implementation Phase.
  • After the design phase:
  • 1. Code the program: translate the algorithm into a programming language.

A program = an algorithm coded in a programming language.

  • 2. Compile the program.
  • 3. Test and debug the program. Again?
where may errors arise8
Where may errors arise?
  • 1. Bad translation. The C# source code does not say the same thing as the algorithm. (Monty Python Danish-English phrase book: “Your hovercraft is full of eels”!)
  • 2. Syntax errors. The code has errors in grammar, spelling or punctuation.
how to avoid errors in implementation
How to avoid errors in implementation.
  • 1. Master the programming language.In this way, you will know what C# statement corresponds to a statement of English.
  • 2. Learn what the compiler’s syntax error messages mean.
  • This will enable you to edit the code until it is free of syntax errors.
the maintenance phase
The Maintenance Phase.
  • 1. Use the program.
  • 2. Discover and fix errors missed in testing.
  • Danger: fixing one problem may introduce others.
  • 3. Enhance the program by adding additional capabilities.
example of design phase
Example of Design Phase.
  • 1. Receive problem.
  • Determine the change due to a customer. Assume that the sales tax may vary.
  • 2. Understand the problem.
  • Analyze the problem into the 3 main activities of a program:
  • (1) INPUT (2) PROCESS (3) OUTPUT.
example of design phase cont
Example of Design Phase (cont.).
  • 3. Create algorithm.
  • Figure out the instructions required under the 3 headings. These can be written as pseudocode (English imperatives which look like a program) e.g.
  • Input Price,
  • Calculate Change,
  • Display Change.
example of design phase cont13
Example of Design Phase (cont.).
  • I. INPUT.
  • 1. Input Amount Tendered.
  • 2. Input Price.
  • 3. Input Sales Tax.
    • How is this ambiguous?
    • How can we make it unambiguous?
example of design phase cont14
Example of Design Phase (cont.).
  • 1. Calculate TaxAmount =
  • SalesTaxRate * Price.
  • 2. Calculate TotalPrice =
  • Price + TaxAmount.
  • 3. Calculate Change =
  • AmountTendered - TotalPrice
example of design phase cont15
Example of Design Phase (cont.).
  • 1. “Echo print” the user’s input.
  • 2. Display SalesTaxAmount
  • 3. Display TotalPrice.
  • 4. Display Change.
test and debug the algorithm
Test and debug the algorithm.
  • How?
  • “Play computer.” Try some data values. Calculate what the change should be, then follow the instructions of the algorithm exactly as a computer would (i.e. blindly), and see if you get the same result.
  • Also, consider usual and unusual data.
test and debug the algorithm cont
Test and debug the algorithm (cont).
  • You may think that our algorithm is obviously correct.
  • But, can it handle unusual data?
  • No, if the AmountTendered is less than the TotalPrice it will give negative change instead of recording an error!
  • A validation check and loop would be needed to fix this.
implementing an algorithm
Implementing an algorithm.
  • The algorithm is just an idea in our head / on paper. It has no power to make a computer do anything.
  • So: how can we make the computer execute the algorithm?
  • We must translate the algorithm into a programming language.
implementing an algorithm cont
Implementing an algorithm (cont.)
  • Why? Why is English unsuitable?
  • It is too vague. E.g “several,” “a few,” “many.”
  • It is ambiguous. E.g. “glasses,” “bat.”
  • It can express actions which a computer cannot perform e.g. “vote your conscience.”
implementing an algorithm cont20
Implementing an algorithm (cont.)
  • Thus we need a programming language.
  • Definition: A programming language is a formal (symbolic) language which is:
  • (1) precise;
  • (2) unambiguous;
  • (3) restricted to operations a CPU can perform.
implementing an algorithm cont21
Implementing an algorithm (cont.)
  • But even the programming language is not in the CPU’s native tongue.
  • The CPU only “understands” binary. It cannot directly obey C#.
  • Therefore, it can implement our program only if it is translated into binary form.
  • This is accomplished by the compiler.
implementing an algorithm cont22
Implementing an algorithm (cont.)
  • Thus programming requires 2 stages of translation:
  • (1) the programmer translates the algorithm into a programming language;
  • (2) the compiler translates the program (source code) into binary (object code).
implementing an algorithm cont23
Implementing an algorithm (cont.)
  • The compiler, like God’s law, is totally unforgiving. It will only produce object code if there are NO syntax errors. Since only the object code can be run, a program cannot run unless all syntax errors are removed.
  • Fortunately, the editor covers a multitude of sins!