1/37
Looks like no tags are added yet.
Name | Mastery | Learn | Test | Matching | Spaced | Call with Kai |
|---|
No analytics yet
Send a link to your students to track their progress
Design Pattern Definition
A proven advice for solving a recurring class of problems by providing a template-like solution rather than a finished design.
Benefits of Design Patterns
Increase reusability, maintainability, clarity, and communication among developers.
Are design patterns language independent? Are they finished code?
They are language-independent and serve as conceptual templates, not finished code.
Architectural Design Pattern
A high-level solution that defines the structure of a system, dividing it into components/layers and specifying their communication rules.
Scope of Architectural Patterns
Consider the whole application, providing the first level of abstraction.
Common Architectural Patterns
Multi-Layer, MVC
Multi-Layer Pattern Definition
Divides an application into independent layers that provide services to their neighboring layers.
3-Layer (Multi layer) Architecture
Presentation layer, Business Rules layer, Data Management layer.
Presentation Layer Responsibilities
Handles UI/UX and interacts with the user.
Business Rules Processing Layer Responsibilities
Handles computations, logic, and application flow in Multilayer Architectural Design Pattern
Data Management Layer Responsibilities
Handles storage, retrieval, and database/file operations.
Do the layers all know each other?
Each layer knows only its neighbors, reducing tight coupling.
Benefits of Multi-Layer Pattern
Separation of concerns, fewer dependencies, readability, reusability, testability, maintainability.
What are the names of the MVC Pattern layers?
Divides an application into Model, View, and Controller to separate logic from UI.
Model (MVC) Responsibilities
Manages data, business rules, and state changes
View (MVC) Responsibilities
Displays information to the user and receives no direct data-manipulation ability.
Controller (MVC) Responsibilities
Handles user input, interprets View events, updates the Model.
MVC Interaction Flow
User → View → Controller → Model → View updates.
Benefits of MVC
Structural clarity, maintainability, reusable UI components, prevents direct user manipulation of data.
Can there be multiple Views in MVC with one model?
One model can update many views simultaneously.
Class Design Pattern
Lower-level design solutions that focus on interactions among a few classes.
What are the Three Types of Class Design Patterns?
Creational, Structural, Behavioral.
Singleton Pattern Definition
Ensures exactly one instance of a class exists at runtime and provides global access to it.
How Singleton Works
Private constructor, static instance variable, and a public static getter method.
Why Constructor Is Private in Singleton
Prevents creation of multiple instances.
Singleton Instance Lifetime
Instantiated once, usually when the class loads.
Composite Pattern
Treats individual objects and composite groups uniformly by having both implement the same interface/abstraction.
Why Composite Helps
Simplifies code, supports extension, and unifies behavior of single items and groups.
Composite Structure
Component interface + leaf classes + composite classes containing children.
Façade Pattern
Provides a simplified interface to a complex subsystem, exposing only necessary operations.
Problem Scenario that Façade solves
A client depends on many classes and sees methods it shouldn’t or doesn’t need.
Façade Solution
A wrapper class delegates tasks to subsystem classes but exposes a clean interface.
Façade Benefit
Reduces coupling, hides complexity, and improves client-side code clarity.
Strategy Pattern
Allows selecting an algorithm’s behavior at runtime by encapsulating each variant in its own class.
What is a Context Class in (Strategy)
Uses a Strategy interface reference and executes whichever strategy is assigned.
Template Method Pattern Definition
Defines the skeleton of an algorithm in a superclass method, leaving certain steps abstract for subclasses to implement.
What does the concrete method do in Template Method?
A concrete method calls one or more abstract methods and provide their own implementations to complete its algorithm.
Benefits of Template Method
Allows algorithm structure to remain fixed while subclasses customize steps.