Upgrade to PRO for Only $50/Year—Limited-Time Offer! 🔥

Functional programming - part 2

Yejun Su
January 03, 2023

Functional programming - part 2

Applying the skill "Distinguish Actions, Calculations and Data".
See part 1 for some background knowledge.

Yejun Su

January 03, 2023
Tweet

More Decks by Yejun Su

Other Decks in Programming

Transcript

  1. Glossary • Actions - Functions with side e ff ects

    • A ff ected by when and how many times they are called. • Calculations - functions without any side e ff ects • Given the same input, returns the same output. • Data - facts about events • Immutable in functional programming languages • Can be immutable in object-oriented programming languages
  2. Usage • Thinking a problem before coding • Coding a

    solution • Reading existing code
  3. Reading code • Look for Actions because they need the

    most attention. • Find code smell without running code.
  4. Thinking a problem before coding • What data we will

    need to capture (Data) • What decisions we will need to make (Calculations) • Clarifying problems needs attention (Actions)
  5. Coding a solution • Changeability: Actions > Calculations > Data.

    • Few Actions, more Calculations and Data.
  6. What is software design? "using one’s aesthetic sense to guide

    programming choices to improve the ease of coding, testing, and maintaining software"
  7. How strati f ied design help us to develop aesthetic

    senses • Straightforward implementation • Abstraction barrier • Minimal interface • Comfortable layers
  8. Call graph • Arrows represent function calls • Functions are

    in di ff erent layers Visualizing our function calls
  9. Problems may exist in three levels • Interaction between layers

    • Implementation of one layer • Implementation of one function
  10. Use call graph • Global zoom level • Layer zoom

    level • Function zoom level to f ind problems in di ff erent levels