Ch1 principles of software development


Published on

Published in: Design, Technology, Business
  • Be the first to comment

No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Ch1 principles of software development

  2. 2. Objectives <ul><li>In this chapter you will learn: </li></ul><ul><ul><ul><li>The computer programming language </li></ul></ul></ul><ul><ul><ul><li>To solve problem using problem-solving strategies and methods </li></ul></ul></ul><ul><ul><ul><li>The algorithm as a guidance in designing program </li></ul></ul></ul>
  3. 3. SOFTWARE DEVELOPMENT PRICIPLE <ul><li>Subtopics </li></ul><ul><ul><ul><li>Introduction to Programming </li></ul></ul></ul><ul><ul><ul><li>Problem Solving & Software Development Approach </li></ul></ul></ul><ul><ul><ul><li>Algorithm Representation </li></ul></ul></ul>
  4. 4. 1.1 Intro to Programming <ul><li>Programming is the core of everything to do with computers , computing, networked systems, management information systems, multimedia and so on (all computer-based things) </li></ul><ul><li>Everything that runs on a computer is a program and somebody (programmer) has to write it using specific programming language . To understand how computers can be used, how applications work, how systems are configured, it is necessary for you to understand what programs are and how they are constructed. </li></ul>
  5. 5. 1.2 Problem Statement & SDA <ul><li>Problem Solving </li></ul><ul><li>The process of transforming the description of a problem into the solution of that problem by using our knowledge of the problem domain and by relying on our ability to select and use appropriate problem-solving strategies, techniques , and tools . </li></ul>
  6. 6. Software Development Method <ul><ul><li>Requirements specification </li></ul></ul><ul><ul><li>Analysis </li></ul></ul><ul><ul><li>Design </li></ul></ul><ul><ul><li>Coding & Implementation </li></ul></ul><ul><ul><li>Testing & Verification </li></ul></ul><ul><ul><li>Documentation & Maintenance </li></ul></ul>
  7. 7. Software Development Method <ul><ul><li>Requirements specification provides us with a precise definition of the problem. </li></ul></ul><ul><ul><li>In the analysis phase , we identify problem inputs, outputs, special constraints, and formulas and equations to be used. </li></ul></ul><ul><ul><li>The design phase is concerned with developing an algorithm for the solution of the problem. </li></ul></ul>
  8. 8. Software Development Method <ul><ul><li>Coding & Implementation </li></ul></ul><ul><ul><ul><li>Code the finalized algorithm using a suitable programming language. </li></ul></ul></ul><ul><ul><ul><li>Go through the compiling & execution process. </li></ul></ul></ul><ul><ul><ul><li>Normally, you will face this three types of programming errors </li></ul></ul></ul><ul><ul><ul><ul><li>Logic/Design errors </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Syntax errors </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Runtime errors </li></ul></ul></ul></ul>
  9. 9. Logic/Design errors <ul><ul><li>Design errors occur during the analysis, design, and implementation phases. </li></ul></ul><ul><ul><li>We may choose an incorrect method of solution for the problem to be solved, we may make mistakes in translating an algorithm into a program, or we may design erroneous data for the program. </li></ul></ul><ul><ul><li>Design errors are usually difficult to detect. </li></ul></ul><ul><ul><li>Debugging them requires careful review of problem analysis, algorithm design, translation, and test data. </li></ul></ul>
  10. 10. Syntax Errors <ul><ul><li>Syntax errors are violations of syntax rules, which define how the elements of a programming language must be written. </li></ul></ul><ul><ul><li>They occur during the implementation phase and are detected by the compiler during the compilation process. In fact, another name for syntax errors is compilation errors. </li></ul></ul><ul><ul><li>If your program contains violations of syntax rules, the compiler issues diagnostic messages. </li></ul></ul><ul><ul><li>Depending on how serious the violation is, the diagnostic message may be a warning message or an error message. </li></ul></ul>
  11. 11. Runtime Errors <ul><ul><li>Run-time errors are detected by the computer while your program is being executed. </li></ul></ul><ul><ul><li>They are caused by program instructions that require the computer to do something illegal, such as attempting to store inappropriate data or divide a number by zero. </li></ul></ul><ul><ul><li>When a run-time error is encountered, the computer produces an error diagnostic message and terminates the program execution. </li></ul></ul><ul><ul><li>You can use diagnostic messages to debug run-time errors. </li></ul></ul>
  12. 12. Software Development Method <ul><ul><li>Documentation & Maintenance </li></ul></ul><ul><ul><ul><li>For every problem solving, there are 5 things to be </li></ul></ul></ul><ul><ul><ul><li>documented </li></ul></ul></ul><ul><ul><ul><ul><li>Program description </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Algorithm development and changes </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Well-commented program listing </li></ul></ul></ul></ul><ul><ul><ul><ul><li>Sample test run </li></ul></ul></ul></ul><ul><ul><ul><ul><li>User’s manual </li></ul></ul></ul></ul><ul><ul><li>Maintenance is concerned with ongoing correction of problems, revision to meet changing needs and addition of new features. The better the documentation is, the efficiently this phase can be performed. </li></ul></ul>
  13. 13. 1.3 Algorithm Representation <ul><li>An algorithm is a sequence of a finite </li></ul><ul><li>number of steps arranged in a specific </li></ul><ul><li>logical order that, when executed, </li></ul><ul><li>produces the solution for a problem. </li></ul><ul><li>An algorithm design should be put on </li></ul><ul><li>paper. For this purpose, and also to </li></ul><ul><li>facilitate its development, we resort to </li></ul><ul><li>pseudocoding and flowcharting </li></ul>
  14. 14. Analogy <ul><li>A) How to make a telephone call ? </li></ul><ul><li>i. ? </li></ul><ul><li>ii) ? </li></ul><ul><li>iii) ? </li></ul><ul><li>B) How to make a fried rice ? </li></ul><ul><li>C) How to buy a tin of pepsi-cola </li></ul><ul><li>from vending machine ? </li></ul>
  15. 15. Pseudocoding <ul><ul><li>Short English phrases with a limited vocabulary </li></ul></ul><ul><ul><li>are use to describe the algorithm (the </li></ul></ul><ul><ul><li>processing steps). A pseudocode must : </li></ul></ul><ul><ul><li>have a limited vocabulary </li></ul></ul><ul><ul><li>be easy to learn </li></ul></ul><ul><ul><li>produce simple, English-like narrative notation </li></ul></ul><ul><ul><li>be capable of describing all algorithms, regardless of their complexity </li></ul></ul>
  16. 16. Example of Pseudocode <ul><li>Problem 1 : (Sequence structure) </li></ul><ul><li>Compute total of resistor values. </li></ul><ul><ul><ul><li>Begin </li></ul></ul></ul><ul><ul><ul><li>read resistor1 </li></ul></ul></ul><ul><ul><ul><li>read resistor2 </li></ul></ul></ul><ul><ul><ul><li>total = resistor1 + resistor2 </li></ul></ul></ul><ul><ul><ul><li>print “ total “ </li></ul></ul></ul><ul><ul><ul><li>End </li></ul></ul></ul>
  17. 17. Flowcharting <ul><li>A graphical technique for algorithm design and representation, is equivalent to pseudocoding and can be used as an alternative to it. </li></ul>
  18. 18. Flowchart Symbols Indicates a decision point in the algorithm Decision Indicates computation or data manipulation Process Indicates an Input or Output operation Input/Output Indicates the beginning or end of an algorithm Terminal Description And Example Name Of Symbol Symbol
  19. 19. Flowchart Symbols Description And Example Name Of Symbol Symbol Provides continuation of a logical path on another page Off-Page Connector Provides continuation of a logical path on another point in the same page. On-Page Connector Used to connect the symbols and indicates the logic flow Flow Lines/ Arrow Specific for for statement Indicates the initial, final and increment values of a loop. Loop
  20. 20. Example of Flowchart Problem 1 : (Sequence statements) Compute total of resistor values.
  21. 21. Pseudocode & Flowchart Convention <ul><ul><li>Sequence Structure </li></ul></ul><ul><ul><ul><li>a series of steps or statements that are executed in order (ex : as shown in Problem 1) </li></ul></ul></ul><ul><ul><li>Selection Structure </li></ul></ul><ul><ul><ul><li>Define two courses of action depending on the outcome condition ( true or false) </li></ul></ul></ul><ul><ul><li>Repetition control structures </li></ul></ul><ul><ul><ul><li>Specifies a block of one or more statements that are repeatedly executed until a condition is satisfied. </li></ul></ul></ul>
  22. 22. Sequence Structure begin Statement_1 Statement_2 … Statement_n end
  23. 23. Selection Structure <ul><ul><li>Single Selection (if) </li></ul></ul>if condition statement if condition then_part else else_part end_if <ul><li>Double Selection (if-else) </li></ul>statement condition
  24. 24. Repetition Structure while condition loop-body end_while
  25. 25. Applying the SDM ( Phase 1 to 3) <ul><li>Problem : </li></ul><ul><li>The C programming test scores can be classified into two condition, PASS and FAIL . The student is require to input their marks in positive integer . If the score is greater than or equal 50 message Pass will appear, message Fail otherwise </li></ul>
  26. 26. Applying the SDM <ul><ul><li>Phase 1 : Requirement Specification </li></ul></ul><ul><ul><li>Selection Structure </li></ul></ul><ul><ul><li>test scores, message ‘PASS’, message ‘FAIL’, greater or equal to 50, less than 50 </li></ul></ul><ul><ul><li>Phase 2 : </li></ul></ul><ul><ul><li>Data requirements : </li></ul></ul><ul><ul><li>Input : test_score </li></ul></ul><ul><ul><li>Output : ‘PASS’ or ‘FAIL’ </li></ul></ul><ul><ul><li>Relevant formula : test_score >= 50 </li></ul></ul><ul><ul><li>test_score < 50 </li></ul></ul><ul><ul><li>Constrain : the test score must greater than 0 (zero) </li></ul></ul>
  27. 27. Applying the SDM <ul><ul><li>Phase 3 : Design ( Pseudocode/Flowchart) </li></ul></ul><ul><ul><li>Pseudocode </li></ul></ul>Begin Read the test scores Begin while while test_score < 0 Print ‘ Re-enter your score and must greater than 0’ Read the test_score End while if test_score >= 50 print ‘PASS’ else print ‘FAIL’ End
  28. 28. Applying the SDM <ul><ul><li>Flowchart </li></ul></ul>
  29. 29. Exercise <ul><li>Write an algorithm that calculates the areas of a football field. </li></ul><ul><li>Write an algorithm that finds the smallest element among a, b, and c. </li></ul>