Skip to content

Latest commit

 

History

History
20 lines (18 loc) · 1.57 KB

program-design.md

File metadata and controls

20 lines (18 loc) · 1.57 KB

Program Design

  • How to Design Programs, Second Edition 2023

    • The typical course on programming teaches a “tinker until it works” approach. When it works, students exclaim “It works!” and move on. Sadly, this phrase is also the shortest lie in computing, and it has cost many people many hours of their lives

    1. From Problem Analysis to Data Definitions
      • Identify the information that must be represented and how it is represented in the chosen programming language. Formulate data definitions and illustrate them with examples.
    2. Signature, Purpose Statement, Header
      • State what kind of data the desired function consumes and produces. Formulate a concise answer to the question what the function computes. Define a stub that lives up to the signature.
    3. Functional Examples
      • Work through examples that illustrate the function’s purpose.
    4. Function Template
      • Translate the data definitions into an outline of the function.
    5. Function Definition
      • Fill in the gaps in the function template. Exploit the purpose statement and the examples.
    6. Testing
      • Articulate the examples as tests and ensure that the function passes all. Doing so discovers mistakes. Tests also supplement examples in that they help others read and understand the definition when the need arises—and it will arise for any serious program.
  • Push Ifs Up And Fors Down

    • Examples using fibonachi