Design Pattern
Milad Abolhassani
tuxgeek.ir milad@tuxgeek.ir
Slides:
http://slideshare.com/miladas http://miladas.github.io/slides
Milad Abolhassani tuxgeek.ir milad@tuxgeek.ir Slides: - - PowerPoint PPT Presentation
Design Pattern Milad Abolhassani tuxgeek.ir milad@tuxgeek.ir Slides: http://slideshare.com/miladas http://miladas.github.io/slides Attention 2 OOP 3 Class Interface Property Abstract class Method Encapsulation
Design Pattern
Milad Abolhassani
tuxgeek.ir milad@tuxgeek.ir
Slides:
http://slideshare.com/miladas http://miladas.github.io/slides
Attention
2
OOP
3
Where did all of these come from?
4
SOLID
5
SOLID
6
Single Responsibility
7
Open/Closed
–
Once class completed, never should modified
–
Interface (public methods)
–
The interface is open for extension but close for modification 8
Liskov substitution
9
Interface Segregation
10
Dependency injection
11
What is design pattern?
solution to a commonly occurring problem.
12
History
Alexander (1977/79).
Design Patterns: Elements of Reusable Object-Oriented Software was published in 1994.
– Gang of Four – Gamma, Erich; Helm, Richard; Johnson, Ralph; Vlissides, John 13
Gang of four
14
Why design pattern?
– Avoid miss communications
– by providing tested, proven development paradigms
15
Category
16
Creational design patterns
creation logic.
17
Creational design patterns
18
Factory Method
19
subclasses.
Singleton
20
Prototype
create new objects by copying this prototype.
21
Builder
so that the same construction process can create difgerent representations.
22
Programmer
23
Structural design patterns
Concept of inheritance is used to compose interfaces and defjne ways to compose objects to obtain new functionalities.
24
Structural design patterns
25
Adapter
Adapter lets classes work together that couldn't otherwise because of incompatible interfaces.
26
Decorator
27
Decorator
28
Facade
29
Flyweight
effjciently.
30
Proxy
intelligent access.
31
Behavioral design patterns
Behavioral patterns are those patterns that are most specifjcally concerned with communication between objects.
32
Behavioral design patterns
33
Chain of responsibility
request to the receiver by giving more than one object a chance to handle the request.
34
having colleagues communicate with the Mediator, rather than with each other.
Mediator
35
Observer
between objects such as if one object is modifjed, its depenedent
36
State
internal state changes.
37
Strategy
run time.
38
Template method
39
Thank you
References
– JavaWorld – SourceMaking – TutorialsPoint – Informit – geekswitblogs – Wikipedia [1] [2]