Design Patterns by Tutorial Flashcards
What is a design pattern?
Reusable, template solutions to common development problems
What are the 3 main types of design patterns?
- Structural
- Behavioral
- Creational
What are structural design patterns?
Describes how objects are composed and combined to form larger structures.
What are some examples of structural design patterns?
MVC, MVVM, Facade
What are behavioral design patterns?
Describes how objects communicate with each other.
What are some examples of behavioral design patterns?
Delegation, Strategy, Observer
What are creational design patterns?
Describes how to create or instantiate objects
What are some examples of creational patterns?
Builder, Singleton, Prototype
What are some benefits of using design patterns?
- Create a common language
- Fast-track developer onboarding
- Allow to spot similarities between code
MVC: What are Models?
hold application data. Usually structs or simple classes.
MVC: What are Views?
display visual elements and controls on screen. Usually subclasses of UIView
MVC: What are Controllers?
coordinate between models and views. They are usually subclasses of UIViewController.
How does ownership and data flow through MVC?
The ViewController owns both the Model and View. Views pass information back through actions. Model through property observers.
When should you use MVC?
Use MVC pattern as a starting point for creating iOS apps.
What are some limitations to MVC?
Not every object will fit neatly into a category of M, V, or C. “Massive View Controller”