2a: How to Design Data - LOS and COND exp. Flashcards
Why is it important to be data aware?
While systems tend to have more function designs than data designs, the DESIGN OF DATA turns out to DRIVE the design of the FUNCTIONS. So data design is a critical part of program design.
What are the learning goals of this module?
(1) Be able to use the How to Design Data DEFINITIONS (HtDD) recipe to design data definitions for atomic data.
(2) Be able to identify problem domain information that should be represented as simple atomic data, intervals, enumerations, itemizations and mixed data itemizations.
(3) Be able to use the Data Driven Templates recipe to generate templates for functions operating on atomic data.
(4) Be able to use the How to Design Functions (HtDF) recipe to design functions operating on atomic data.
Where is the design of data, a point of leverage?
The design of data turns out to be a point of leverage in designing programs. This is because when we design data we make decisions about all the functions that LATER operate on that data.
What are Cond expressions?
These cond expressions lets us program conditional behavior where there’s more than just two cases.
What’s another word for the mechanism called cond?
It’s a multi-armed conditional.
How can you comment out an entire function?
; Use a sharp sign followed by a semicolon.
Are ( ) and [ ] equivalent when using Dr. Racket?
Yes, they are, and with conditional expressions, it makes it easier to read.
What’s nice about using cond expressions over if?
All of the questions can be seen clearly with answers at the same level of nesting/importance.
(cond [Q A]
[Q A]
[else A] )
What are the rules for forming a cond expression?
(cond [expression question expression Answer] … one or more question/answer pairs).
Each question must EVALUATE to A BOOLEAN and the last question can be an ELSE.
Put the evaluation rules (copy+paste) while you program.
What is the “big picture” ideas behind how these evaluation rules work? Why does going through it step by step help?
The idea is to TAKE CARE of the MORE SOPHISTICATED construct and then get it out of the program.
Going through the evaluation rules step by step really HELP people in terms of MASTERING HOW language works.