Session 10 of Software Lessons, “Object-Oriented Programming (OOP) Part 2: Calculator Class Example and Design Patterns,” runs about 27 minutes.
What this session covers
- Basics
- Class syntax
- Inheritance
- Types
- The classic Animal Kingdom example
- A calculator class example
- Three types of design patterns
- Creational (build something)
- Behavioral (do something)
- Structural (structure something)
Key ideas
- A design pattern is a named, reusable solution to a problem that comes up often in software design.
- Creational patterns deal with how objects are created, which keeps code from depending on the details of construction.
- Behavioral patterns describe how objects interact and divide responsibility.
- Structural patterns describe how classes and objects are composed into larger structures.
- A small class such as a calculator shows how methods and state fit together before patterns are layered on top.