Presentation is loading. Please wait.

Presentation is loading. Please wait.

Software Design Patterns Anton Danshin Moscow Institute of Physics and Technology Dolgoprudny - 2012.

Similar presentations


Presentation on theme: "Software Design Patterns Anton Danshin Moscow Institute of Physics and Technology Dolgoprudny - 2012."— Presentation transcript:

1 Software Design Patterns Anton Danshin Moscow Institute of Physics and Technology Dolgoprudny - 2012

2 Contents What is it? Why do we use it? Classification Example Criticism Anti-patterns Conclusion 2

3 What is it? General repeatable solution to a commonly occurring problem in software design Description or template for how to solve a problem that can be used in many different situations 3

4 Why do we use it? Speed up development process Prevent future problems Ease comunication between developers Make your code better Simplicity is the soul of efficiency. -- Austin Freeman, "The Eye of Osiris" 4

5 Classification of design patterns Creational: Abstract factory, Builder, Factory method, Prototype, Singleton,... Structural: Adapter, Bridge, Composite, Decorator, Proxy,... Behavioral: Chain of responsibility, Command, Iterator, Mediator, Strategy,... Concurrent 5

6 Example 1: Singleton Intent: Create a single-instance class Provide a global point of access to it Encapsulate initialization Problems Application needs one, and only one, instance of an object. Lazy initialization and global access are necessary 6

7 Example 1: Singleton 7

8 Example 1: Singleton (Java) 8

9 Criticism Targets the wrong problem Lacks formal foundations Leads to inefficient solutions Do not overuse! 9

10 Copy and Paste Programming Spaghetti Code Golden Hammer Magic Numbers Hard Code Boat Anchor God Object Anti-Patterns Soft Code Reinventing the Wheel Reinventing the Square Wheel Blind Faith Brute Force Coding Unnecessary comments 10

11 Conclusion Design pattern is a general solution to a commonly occurring problem in software design Using design patterns makes your code better Design patterns are devided into: Creational Behavioral Structural Concurrent Do NOT OVERUSE design patterns 11

12 References 1.SourceMaking.com – Software Design Patterns http://sourcemaking.com/design_patterns 2.Wikipedia http://en.wikipedia.org/wiki/Software_design_pattern 3.HabraHabr.Ru http://habrahabr.ru/blogs/refactoring/59005/ 12

13 Thanks for your attention!


Download ppt "Software Design Patterns Anton Danshin Moscow Institute of Physics and Technology Dolgoprudny - 2012."

Similar presentations


Ads by Google