Encapsulated Behaviors
Reading
-
Head First Design Patterns, Chapter 1 (excerpt)
Freeman, Eric, and Elisabeth Robson. Head First Design Patterns. 2nd ed., O’Reilly, 2020.
Important concepts
- interfaces and inheritance
- unintended consequences of code change
- encapsulating the parts that vary, separating them from the parts that don’t
- classes that represent behaviors instead of things
Things to consider (exercises for yourself, not to turn in)
- Which activities and assignments in this course exemplify the advice in this chapter?
- Why does the reading say not to create a “Duck” interface too?
- If a programming tool matters, it’s because it solves a problem. What problem do interfaces solve?
Your response
What was particularly interesting, confusing, or exciting to you in this reading? What question can you ask to expedite your learning?