2. Outline
• What is Design Pattern?
– Singleton pattern
– Strategy pattern
– Observer pattern
• What is MVC?
– C# example
– Ruby on Rails
• Conclusion
3. What is Design Pattern?
• Patterns are formalized best practices that the
programmer can use to solve common problems when
designing an application or system
4. The History of Design Pattern
• Christopher Alexander (1977)
• Kent Beck and Ward Cunningham (1987)
• Gamma, Erich; Richard Helm, Ralph Johnson,
and John Vlissides
– Design Patterns: Elements of Reusable Object-
Oriented Software (1995)
6. Gang of Four (GoF) Patterns
• Creational Patterns
(abstracting the object-instantiation process)
– Factory Method Abstract Factory
– Singleton Builder
– Prototype
• Structural Patterns
(how objects/classes can be combined to form larger structures)
– Adapter Bridge
– Composite Decorator
– Facade Flyweight
– Proxy
7. Gang of Four (GoF) patterns
• Behavioral Patterns
(communication between objects)
– Command Interpreter Iterator
– Mediator Observer State
– Strategy Chain of Responsibility Visitor
– Template Method
10. Is Your Singleton Broken?
• The singleton pattern must be carefully
constructed in multi-threaded applications
• [OSDC 2014] fr3@K - Is Your Singleton
Broken? - YouTube
11. Is Your Singleton Broken?
• The singleton pattern must be carefully
constructed in multi-threaded applications
• [OSDC 2014] fr3@K - Is Your Singleton
Broken? – YouTube
• Global variable issue
35. The History of MVC
• MVC is really old and was first described in
1979 by Trygve Reenskaug
• Smalltalk at Xerox PARC.
• Today MVC is used in most modern web and
GUI frameworks
36. The History of MVC
• Ruby On Rails: A popular Ruby web-
framework
• Apple Cocoa: Apple's framework for
developing Mac OS and iOS applications
• ASP.Net Framework: Microsoft's web-
framework for implementing web applications
• ... And many many more languages and
frameworks