Presentation is loading. Please wait.

Presentation is loading. Please wait.

The Anatomy of a Computer Program Unit 3. Programs are Directions  A computer carries out the instructions in a program, line by line, exactly as they.

Similar presentations


Presentation on theme: "The Anatomy of a Computer Program Unit 3. Programs are Directions  A computer carries out the instructions in a program, line by line, exactly as they."— Presentation transcript:

1 The Anatomy of a Computer Program Unit 3

2 Programs are Directions  A computer carries out the instructions in a program, line by line, exactly as they are given.  The word detailed is crucial to making the computer follow the program directions.  The details of the program’s instructions are the key to programming.  Caveman/VCR analogy Pretend a caveman is transported by a time machine to your doorstep. The caveman is anxious to try all the new things he sees. He buys a new BlueRay player so he can watch his first video. Write step by step instructions for the caveman.

3 Instructions These are better instructions but they still lack most of the required details and assume a lot of prior knowledge: The VCR is in the box that came with these instructions. You will use this VCR to watch the movie. Remove the VCR from the box. Place the VCR on a table close to the television. Connect the VCR cable to the connection on the back of the television. Plug the VCR in to a power supply on the wall. Press the Power button on the TV remote control. Press the Power button on the front of the VCR. Insert the tape into the opening on the front of the VCR. Press the Play button on the VCR.

4 The Program Development Cycle  Proper design is absolutely critical to a successful program.  The term systems analysis and design is the name given to the practice of analyzing a problem and then designing a program from that analysis.

5 Steps in the Program Development Cycle 1.Analyze = Define the problem. 1.Have a clear idea of what the input will be and what the desired output should look like. 2.Design - Plan the solution to the problem. 1.Develop the algorithm and test the algorithm 3.Choose the language or interface 1.What language is used and how output will be displayed. 4.Write the code 5.Test and debug 1.test for logic and syntax errors 6.Document 1.Write comments within the code to clarify the purpose of various sections of the code. 2.Provide external documentation for the program that could include instruction manuals, help files, etc

6 Testing a program Desk testing – Checking the program using as many different scenarios to try to find errors in the code. Try to make it FAIL! Beta Testing - A group of users is set up to try the program. The more beta testers you find to test the program, the better the chance errors will be found. More software developers are inviting the public to help beta test products. Many beta versions are available for download. Parallel Testing - use the new program while at the same time continuing to use an old program.

7 Types of Errors Example – There are two errrors in this statement. Error #1 – errrors Error #2 – There aren’t actually 2 errors. There is only 1 1.Syntax Errors - Often misspelled programming language commands and grammatical problems with the programming language. 2.Logic Errors - the program is told to do something that is not really what should be done. 3.Runtime Errors - almost always caused by logic mistakes. programmer fails to predict a problem and fails to handle it when it occurs.

8 Top-down Design  Top-down design is the process of taking the overall problem and breaking it down into more and more precise details. 1.Determine the overall goal. 2.Break the overall goal into 2 or 3 parts. 3.Repeat step 2 for each part in #2 until you cannot break each of the parts down any further. This process is used to develop the program algorithm.

9 Top-down Design Overall goal brokendown intomore detail andmore asyoumovedownthroughthelevels

10 Examples of Top-down


Download ppt "The Anatomy of a Computer Program Unit 3. Programs are Directions  A computer carries out the instructions in a program, line by line, exactly as they."

Similar presentations


Ads by Google