Repository for assignments, examples, and project for the CS 542 Design Patterns class from CSUSM
Design Patterns are descriptions of communicating objects and classes that are customized to solve a general design problem in a particular context.
Design Pattern is a general repeatable solution to a commonly occurring problem in software design, a description for how to solve a problem that can be customizable.
-
Favor composition over inheritance to promote encapsulation - instead of creating child classes
-
Use interface classes for providing a common interface. Program through interface, not in the concrete level. Refer through the interface, not directly.
-
Creational Patterns: for object creation
-
Structural Patterns: for compositions of classes and objects
-
Behavioral Patterns: for interactions of classes and objects
- name
- problem (application scope, what type of problem it addresses),
- solution (how this DP works),
- consequences (costs, limitations, and benefits)
All information is based on my class notes and slides. I copied it here for my future reference. For more reliable sources, please check the book cited on reference.
E. Gamma, R. Helm, Ralph E. Johnson, J. Vlissides. Design patterns: elements of reusable object-oriented software. Addison-Wesley Professional, 1995.