1 / 21

Program Design and Development

Program Design and Development. Steps In Program Development. Define the Problem Inputs, outputs, processes Outline the solution Major steps Major subtasks Major control structures (repetition loops) Major variables Mainline Logic. Steps in PD Continued. Develop Algorithm

hija
Download Presentation

Program Design and Development

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. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Program Design and Development

  2. Steps In Program Development • Define the Problem • Inputs, outputs, processes • Outline the solution • Major steps • Major subtasks • Major control structures (repetition loops) • Major variables • Mainline Logic

  3. Steps in PD Continued • Develop Algorithm • Using pseudocode and flowcharts • Test Algorithm • Code into programming language • Run complier • Document and maintain the program

  4. Types of Programming • Structured/Top Down Programming • Starting with solution and working into more complex details • Modular Design • Grouping tasks together by function • Structure Theorem • Elimination of GOTO, replacement with IF-THEN-ELSE

  5. Algorithm Definition • Lists the steps involved in accomplishing a task • Written in simple english and not a formal document • An algorithm must be • Lucid, precise, and unambiguous • Give the correct solution in all cases • Eventually end

  6. Pseudocode • Essentially it is structured english and formalized to look like high-level computer languages • Statements are written in simple english • Each instruction is written on a single line • Keywords and indentations are used to signify control structures • Each set of instructions is written from top to bottom with only one entry and one exit • Groups of statements may be formed into modules and that group given a name

  7. Program Data • Variables, constants, and literals • Integer - 16 • Byte length - 8 • Short integer - 32 • Long integer - 64 • Real • Float – single precision • Double – double precision • Character • Boolean

  8. Data Structures • Record • File • Array • String

  9. Basic Computer Operations • A computer can receive information • “READ” and “GET” • A computer can put out information • “PRINT”, “WRITE”, “PUT”, “OUTPUT”, and “DISPLAY” • A computer can perform arithmetic actions • + for ADD • - for SUBTRACT • * for MULTIPLY • / for DIVIDE • () for PARENTHESES

  10. Basic Computer Options Cont. • A computer can assign a value to a variable or memory • To give an initial value use “INITALISE” or “SET” • To assign a value use ‘=‘ • To keep a piece of information for later use ‘SAVE’ or ‘STORE’ • A computer can compare variables and select one of two alternative actions • Use of IT THEN and ELSE • Actually it can select multiple actions • A computer can repeat a group of actions • DOWHILE

  11. The Structure Theorem • Sequence • The straightforward listing of each step • Selection • The presentation of a condition and the choice between two actions • Repetition • The presentation of a set of instructions to be performed repeatedly as long as a condition is true

  12. Developing An Algorithm • Defining the Problem • Input • Output • Processing • Use Meaningful Name

  13. Designing an Algorithm • Begin with a rough sketch of steps required to solve the problem • Use these requirements and structure theorem to establish how the processing will take place • It is important to not start coding until the necessary steps of defining the problem and designing the solution algorithm have been solved.

  14. Checking an Algorithm • Choose simple input test case • Establish what the expected result should be • Make a table of relevant variable names • Walk through the test case • Continue the process until the algorithm is correct

  15. Selection Control Structures • Used to illustrate a choice between two or more actions • Simple IF statement • Simple selection with null false branch (null ELSE statement) • Combined selection (IF/AND) • Nested IF Statement • Linear nested IF statement

  16. The CASE Structure • Another way of expressing a linear nested IF statement • Can often appear cumbersome

  17. Repetition Control Structures • Developed because many programs require the same logic to be repeated for several sets of data. • Example • DOWHILE condition p is true • Statement block • ENDO

  18. DOWHILE Loop Processing • The logical condition p is tested • If condition p is found to be true, the statements listed in the statement block will be executed once. Control is returned to the retesting of condition p. • If condition p is found to be false, control passes to the next statement after ENDDO and no further processing takes place within the loop.

  19. Two important DOWHILE considerations • Testing of the condition is done at the beginning of the loop. • The only way to terminate the loop is to render the DOWHILE consideration false.

  20. REPEAT_UNTIL Structure • Is the exact opposite of the DOWHILE • Condition is checked at the end as opposed to the beginning • Counted repetition • Question—is any method better than another?

  21. Time for Practice

More Related