SlideShare a Scribd company logo
1 of 18
How to design an
application correctly?
Touch Surgery Lunch Presentation 03/02/2014
What is a design
pattern?
Definition : Represent the best practices used by
experienced OO software developers.
Solutions to general problems that software developers
faced during software development.
2 main usages :
• Common platform for developers : provide a standard terminology and
are specific to particular scenario
• Best Practices : best solutions to certain problems faced during software
development
=> 23 different design patterns
• Creational Patterns
• Structural Patterns
• Behavioral Patterns
Type of design patterns
Creational Patterns
Creation object
flexibility
Builder & Factory pattern
Prototype pattern
• Specifying the kind of objects to create using a prototypical instance
• Creating new objects by copying this prototype
It is more convenient to copy an existing instance than to create a
new one.
• Avoid using “new” operator.
Ex : copy set of data from the DB or copy container of objects
Prototype pattern
public interface Prototype {
public abstract Object clone ( );
}
public class ConcretePrototype implements Prototype {
// Data set
public Object clone() {
return super.clone();
}
}
public class Client {
public static void main( String arg[] )
{
ConcretePrototype obj1= new ConcretePrototype ();
// fill obj1 with large amount of data / object or heavy tasks
ConcretePrototype obj2 = ConcretePrototype)obj1.clone();
}
}
Structural Patterns
Concept of inheritance
Compose objects to obtain
new functionalities.
Bridge Patterns
The implementation of an abstraction can be
configured and even switched at run-time.
Abstraction and Implementor hierarchies can be
extended independently
meworks use the bridge pattern to separate abstractions from platform specific implementation (for example on
Decouple abstraction from implementation so
that the two can vary independently.
Bridge Patterns
Decorator Patterns
Add/remove additional responsibilities
dynamically to an object
Example : Extending capabilities of a
Graphical Window at runtime
Flyweight Patterns
Minimise memory use by sharing as much
data as possible with similar objects.
Exemple : ressources (in video games)
saves memory, depends on the number of flyweight categories saved
public class ShapeFactory {
private static final HashMap<String, Shape> circleMap = new HashMap();
public static Shape getCircle(String color) {
Circle circle = (Circle)circleMap.get(color);
if(circle == null) {
circle = new Circle(color);
circleMap.put(color, circle);
System.out.println("Creating circle of color : " + color);
}
return circle;
}
}
Behavioral Patterns
Communication between
objects
Command Patterns Encapsulate a request as an object, in a
queue. Can be parameterise
- Another objects can manipulate the request even
without knowing any information about it.
- The command is just a link between the receiver and
the actions that carry out the request.
- The command implements everything itself, without
sending anything to the receiver.
Mediator Patterns
Intermediary / play the role of a controller between objects
Design reusable components
Loose coupling between objects
Observer Patterns
The "View" part of Model-View-Controller.
Defines a one-to-many relationship : one object
changes state, the others are notified and updated
automatically.
Example : subscription NL, auction
How to design an application correctly ?

More Related Content

Similar to How to design an application correctly ?

P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
Gaurav Tyagi
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
danhaley45372
 
Software engineering: design for reuse
Software engineering: design for reuseSoftware engineering: design for reuse
Software engineering: design for reuse
Marco Brambilla
 

Similar to How to design an application correctly ? (20)

P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Design patters java_meetup_slideshare [compatibility mode]
Design patters java_meetup_slideshare [compatibility mode]Design patters java_meetup_slideshare [compatibility mode]
Design patters java_meetup_slideshare [compatibility mode]
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
chapter 5 Objectdesign.ppt
chapter 5 Objectdesign.pptchapter 5 Objectdesign.ppt
chapter 5 Objectdesign.ppt
 
Creational Design Patterns.pptx
Creational Design Patterns.pptxCreational Design Patterns.pptx
Creational Design Patterns.pptx
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
Design Pattern lecture 2
Design Pattern lecture 2Design Pattern lecture 2
Design Pattern lecture 2
 
Design pattern
Design patternDesign pattern
Design pattern
 
Style & Design Principles 02 - Design Patterns
Style & Design Principles 02 - Design PatternsStyle & Design Principles 02 - Design Patterns
Style & Design Principles 02 - Design Patterns
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patterns
 
Patterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docxPatterns (contd)Software Development ProcessDesign patte.docx
Patterns (contd)Software Development ProcessDesign patte.docx
 
5 Design Patterns Explained
5 Design Patterns Explained5 Design Patterns Explained
5 Design Patterns Explained
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
Software design and Architecture.pptx
Software design and Architecture.pptxSoftware design and Architecture.pptx
Software design and Architecture.pptx
 
Software engineering: design for reuse
Software engineering: design for reuseSoftware engineering: design for reuse
Software engineering: design for reuse
 
Design patterns
Design patternsDesign patterns
Design patterns
 

Recently uploaded

%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
masabamasaba
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
VictoriaMetrics
 

Recently uploaded (20)

AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
What Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the SituationWhat Goes Wrong with Language Definitions and How to Improve the Situation
What Goes Wrong with Language Definitions and How to Improve the Situation
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
VTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learnVTU technical seminar 8Th Sem on Scikit-learn
VTU technical seminar 8Th Sem on Scikit-learn
 
%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare%in Harare+277-882-255-28 abortion pills for sale in Harare
%in Harare+277-882-255-28 abortion pills for sale in Harare
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Toronto Psychic Readings, Attraction spells,Brin...
 
Announcing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK SoftwareAnnouncing Codolex 2.0 from GDK Software
Announcing Codolex 2.0 from GDK Software
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
Large-scale Logging Made Easy: Meetup at Deutsche Bank 2024
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 

How to design an application correctly ?

  • 1. How to design an application correctly? Touch Surgery Lunch Presentation 03/02/2014
  • 2. What is a design pattern?
  • 3. Definition : Represent the best practices used by experienced OO software developers. Solutions to general problems that software developers faced during software development. 2 main usages : • Common platform for developers : provide a standard terminology and are specific to particular scenario • Best Practices : best solutions to certain problems faced during software development => 23 different design patterns
  • 4. • Creational Patterns • Structural Patterns • Behavioral Patterns Type of design patterns
  • 7. Prototype pattern • Specifying the kind of objects to create using a prototypical instance • Creating new objects by copying this prototype It is more convenient to copy an existing instance than to create a new one. • Avoid using “new” operator. Ex : copy set of data from the DB or copy container of objects
  • 8. Prototype pattern public interface Prototype { public abstract Object clone ( ); } public class ConcretePrototype implements Prototype { // Data set public Object clone() { return super.clone(); } } public class Client { public static void main( String arg[] ) { ConcretePrototype obj1= new ConcretePrototype (); // fill obj1 with large amount of data / object or heavy tasks ConcretePrototype obj2 = ConcretePrototype)obj1.clone(); } }
  • 9. Structural Patterns Concept of inheritance Compose objects to obtain new functionalities.
  • 10. Bridge Patterns The implementation of an abstraction can be configured and even switched at run-time. Abstraction and Implementor hierarchies can be extended independently meworks use the bridge pattern to separate abstractions from platform specific implementation (for example on Decouple abstraction from implementation so that the two can vary independently.
  • 12. Decorator Patterns Add/remove additional responsibilities dynamically to an object Example : Extending capabilities of a Graphical Window at runtime
  • 13. Flyweight Patterns Minimise memory use by sharing as much data as possible with similar objects. Exemple : ressources (in video games) saves memory, depends on the number of flyweight categories saved public class ShapeFactory { private static final HashMap<String, Shape> circleMap = new HashMap(); public static Shape getCircle(String color) { Circle circle = (Circle)circleMap.get(color); if(circle == null) { circle = new Circle(color); circleMap.put(color, circle); System.out.println("Creating circle of color : " + color); } return circle; } }
  • 15. Command Patterns Encapsulate a request as an object, in a queue. Can be parameterise - Another objects can manipulate the request even without knowing any information about it. - The command is just a link between the receiver and the actions that carry out the request. - The command implements everything itself, without sending anything to the receiver.
  • 16. Mediator Patterns Intermediary / play the role of a controller between objects Design reusable components Loose coupling between objects
  • 17. Observer Patterns The "View" part of Model-View-Controller. Defines a one-to-many relationship : one object changes state, the others are notified and updated automatically. Example : subscription NL, auction