SlideShare una empresa de Scribd logo
1 de 38
Design Patterns Introduction to  Design Patterns Rafael Coutinho  -  [email_address]
Agenda ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Motivation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Motivation ,[object Object]
Motivation ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Brief history ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Definition ,[object Object],[object Object]
Definition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Definition ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Sample ,[object Object],Pattern name and Classification ,[object Object],Intention
Singleton ,[object Object],[object Object],Structure and Participants
Singleton ,[object Object],[object Object],[object Object],Consequences
Singleton Implementation and Code public class Singleton { private  static Singleton instance; private  Singleton(){ } public static synchronized  Singleton getInstance() { if (instance ==  null ) { instance =  new  Singleton(); } return  instance; } }
Singleton Motivation Printers Files Applicability ,[object Object],[object Object]
Singleton ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Categories ,[object Object],[object Object],[object Object],[object Object]
Fundamental Patterns ,[object Object],[object Object],[object Object],[object Object]
Structural Patterns ,[object Object],[object Object],[object Object],Proxy Facade Composite Decorator Adapter
Behavioral Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Creational Patterns ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Some More Patterns Samples ,[object Object],[object Object],[object Object],[object Object]
Decorator ,[object Object],Intention Motivation
Decorator ,[object Object],[object Object],[object Object],Applicability
Decorator Structure and Participants
Decorator ,[object Object],[object Object],[object Object],[object Object],[object Object],Consequences
Decorator Implementation and Code public   class  LowerCaseInputStream  extends   FilterInputStream  {   public  LowerCaseInputStream( InputStream  in) {   super ( in );   }   public   int  read()  throws   IOException  {   int  c =  super .read();   return  ( c == -1 ? c :  Character .toLowerCase( ( char )c ) );   }   public  int read( byte [] b,  int  offset,  int  len)  throws   IOException  {   int  result = super.read(b, offset, len);   for  ( int  i = offset; i < offset+result; i++)  {   b[i] = ( byte ) Character .toLowerCase( ( char )b[i] );   }   return  result;   } }   public   class  InputTest {   public   static   void  main( String [] args) {   int  c;   try  {   InputStream  in =  new  LowerCaseInputStream(  new   BufferedInputStream (  new   FileInputStream ( “test.txt” ) ) );   while ( (c = in.read())  >=  0 ) {   System . out . print ( ( char )c );   }   in.close();   }  catch  ( IOException  e) {   e.printStackTrace();   }   } }
Decorator ,[object Object],[object Object],[object Object],[object Object],[object Object]
Abstract Factory   ,[object Object],Intention Motivation GUI
Abstract Factory ,[object Object],[object Object],[object Object],[object Object],Applicability
Abstract Factory Structure and Participants
Abstract Factory ,[object Object],[object Object],[object Object],[object Object],Consequences
Abstract Factory ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],public class  Client { public static void  main(String[] args){ DAOFactory factory =  new  MySQLDAOFactory(); User userDao = factory.getUser(); } } public class  Db2DAOFactory  implements   DAOFactory { public  User getUser() { Db2Connection conn = new  Db2Connection();   User u = new Db2User();   …   u.setName(rs.getString(“NAME”)); return   u ; } }
Abstract Factory Structure and Participants
Abstract Factory ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Rational Software Architect
Conclusion ,[object Object],[object Object],[object Object],[object Object],[object Object],[object Object]
Resources ,[object Object],[object Object],[object Object],[object Object]
Questions

Más contenido relacionado

La actualidad más candente

Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern11prasoon
 
Structural pattern 3
Structural pattern 3Structural pattern 3
Structural pattern 3Naga Muruga
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsMichael Heron
 
Design patterns illustrated-2015-03
Design patterns illustrated-2015-03Design patterns illustrated-2015-03
Design patterns illustrated-2015-03Herman Peeren
 
P Training Presentation
P Training PresentationP Training Presentation
P Training PresentationGaurav Tyagi
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patternsMalik Sajid
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design PatternJaswant Singh
 
Design Patterns
Design PatternsDesign Patterns
Design Patternsadil raja
 
Introduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonIntroduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonJonathan Simon
 
Software Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSoftware Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSergey Aganezov
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns IllustratedHerman Peeren
 
Junit, mockito, etc
Junit, mockito, etcJunit, mockito, etc
Junit, mockito, etcYaron Karni
 
Introduction to design_patterns
Introduction to design_patternsIntroduction to design_patterns
Introduction to design_patternsamitarcade
 
All about unit testing using (power) mock
All about unit testing using (power) mockAll about unit testing using (power) mock
All about unit testing using (power) mockPranalee Rokde
 

La actualidad más candente (20)

C# Constructors
C# ConstructorsC# Constructors
C# Constructors
 
Constructor
ConstructorConstructor
Constructor
 
Singleton design pattern
Singleton design patternSingleton design pattern
Singleton design pattern
 
Structural pattern 3
Structural pattern 3Structural pattern 3
Structural pattern 3
 
PATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design PatternsPATTERNS03 - Behavioural Design Patterns
PATTERNS03 - Behavioural Design Patterns
 
Design patterns illustrated-2015-03
Design patterns illustrated-2015-03Design patterns illustrated-2015-03
Design patterns illustrated-2015-03
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
P Training Presentation
P Training PresentationP Training Presentation
P Training Presentation
 
Design patterns creational patterns
Design patterns creational patternsDesign patterns creational patterns
Design patterns creational patterns
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Introduction to Design Patterns and Singleton
Introduction to Design Patterns and SingletonIntroduction to Design Patterns and Singleton
Introduction to Design Patterns and Singleton
 
Singleton Pattern
Singleton PatternSingleton Pattern
Singleton Pattern
 
Software Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural PatternsSoftware Design Patterns. Part I :: Structural Patterns
Software Design Patterns. Part I :: Structural Patterns
 
Design Patterns Illustrated
Design Patterns IllustratedDesign Patterns Illustrated
Design Patterns Illustrated
 
Power mock
Power mockPower mock
Power mock
 
Junit, mockito, etc
Junit, mockito, etcJunit, mockito, etc
Junit, mockito, etc
 
Introduction to design_patterns
Introduction to design_patternsIntroduction to design_patterns
Introduction to design_patterns
 
Mockito
MockitoMockito
Mockito
 
All about unit testing using (power) mock
All about unit testing using (power) mockAll about unit testing using (power) mock
All about unit testing using (power) mock
 

Destacado

Design Pattern - Factory Method Pattern
Design Pattern - Factory Method PatternDesign Pattern - Factory Method Pattern
Design Pattern - Factory Method PatternMudasir Qazi
 
Design Patterns - The Ultimate Blueprint for Software
Design Patterns - The Ultimate Blueprint for SoftwareDesign Patterns - The Ultimate Blueprint for Software
Design Patterns - The Ultimate Blueprint for SoftwareEdureka!
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1Jieyi Wu
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Patterneprafulla
 
Design Patterns
Design PatternsDesign Patterns
Design Patternssoms_1
 

Destacado (6)

Design Pattern - Factory Method Pattern
Design Pattern - Factory Method PatternDesign Pattern - Factory Method Pattern
Design Pattern - Factory Method Pattern
 
Design Patterns - The Ultimate Blueprint for Software
Design Patterns - The Ultimate Blueprint for SoftwareDesign Patterns - The Ultimate Blueprint for Software
Design Patterns - The Ultimate Blueprint for Software
 
Factory Method Pattern
Factory Method PatternFactory Method Pattern
Factory Method Pattern
 
Design pattern - part 1
Design pattern - part 1Design pattern - part 1
Design pattern - part 1
 
Design Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator PatternDesign Patterns - 01 Introduction and Decorator Pattern
Design Patterns - 01 Introduction and Decorator Pattern
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 

Similar a Design Patterns

Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patternssukumarraju6
 
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.docxdanhaley45372
 
1. Mini seminar intro
1. Mini seminar intro1. Mini seminar intro
1. Mini seminar introLeonid Maslov
 
chapter 5 Objectdesign.ppt
chapter 5 Objectdesign.pptchapter 5 Objectdesign.ppt
chapter 5 Objectdesign.pptTemesgenAzezew
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Luis Valencia
 
27418524 design-patterns-dot-net-with-examples
27418524 design-patterns-dot-net-with-examples27418524 design-patterns-dot-net-with-examples
27418524 design-patterns-dot-net-with-examplesQuang Suma
 
M04 Design Patterns
M04 Design PatternsM04 Design Patterns
M04 Design PatternsDang Tuan
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1Shahzad
 
Software Patterns
Software PatternsSoftware Patterns
Software Patternsbonej010
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .NetGreg Sohl
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Steven Smith
 
Framework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users GroupFramework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users Groupbrada
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patternspradeepkothiyal
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Savio Sebastian
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Pythondn
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011YoungSu Son
 
How to design an application correctly ?
How to design an application correctly ?How to design an application correctly ?
How to design an application correctly ?Guillaume AGIS
 

Similar a Design Patterns (20)

Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To 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
 
Software Design Patterns
Software Design PatternsSoftware Design Patterns
Software Design Patterns
 
1. Mini seminar intro
1. Mini seminar intro1. Mini seminar intro
1. Mini seminar intro
 
chapter 5 Objectdesign.ppt
chapter 5 Objectdesign.pptchapter 5 Objectdesign.ppt
chapter 5 Objectdesign.ppt
 
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
Typescript design patterns applied to sharepoint framework - Sharepoint Satur...
 
27418524 design-patterns-dot-net-with-examples
27418524 design-patterns-dot-net-with-examples27418524 design-patterns-dot-net-with-examples
27418524 design-patterns-dot-net-with-examples
 
M04 Design Patterns
M04 Design PatternsM04 Design Patterns
M04 Design Patterns
 
Design Pattern For C# Part 1
Design Pattern For C# Part 1Design Pattern For C# Part 1
Design Pattern For C# Part 1
 
Software Patterns
Software PatternsSoftware Patterns
Software Patterns
 
Object Oriented Programming In .Net
Object Oriented Programming In .NetObject Oriented Programming In .Net
Object Oriented Programming In .Net
 
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
Design Pattern Mastery - Momentum Dev Con 19 Apr 2018
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Framework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users GroupFramework Design Guidelines For Brussels Users Group
Framework Design Guidelines For Brussels Users Group
 
Prophecy Of Design Patterns
Prophecy Of Design PatternsProphecy Of Design Patterns
Prophecy Of Design Patterns
 
Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2Design Patterns - Part 1 of 2
Design Patterns - Part 1 of 2
 
Patterns in Python
Patterns in PythonPatterns in Python
Patterns in Python
 
Framework engineering JCO 2011
Framework engineering JCO 2011Framework engineering JCO 2011
Framework engineering JCO 2011
 
How to design an application correctly ?
How to design an application correctly ?How to design an application correctly ?
How to design an application correctly ?
 
Design patterns
Design patternsDesign patterns
Design patterns
 

Design Patterns

  • 1. Design Patterns Introduction to Design Patterns Rafael Coutinho - [email_address]
  • 2.
  • 3.
  • 4.
  • 5.
  • 6.
  • 7.
  • 8.
  • 9.
  • 10.
  • 11.
  • 12.
  • 13. Singleton Implementation and Code public class Singleton { private static Singleton instance; private Singleton(){ } public static synchronized Singleton getInstance() { if (instance == null ) { instance = new Singleton(); } return instance; } }
  • 14.
  • 15.
  • 16.
  • 17.
  • 18.
  • 19.
  • 20.
  • 21.
  • 22.
  • 23.
  • 24. Decorator Structure and Participants
  • 25.
  • 26. Decorator Implementation and Code public class LowerCaseInputStream extends FilterInputStream { public LowerCaseInputStream( InputStream in) { super ( in ); } public int read() throws IOException { int c = super .read(); return ( c == -1 ? c : Character .toLowerCase( ( char )c ) ); } public int read( byte [] b, int offset, int len) throws IOException { int result = super.read(b, offset, len); for ( int i = offset; i < offset+result; i++) { b[i] = ( byte ) Character .toLowerCase( ( char )b[i] ); } return result; } } public class InputTest { public static void main( String [] args) { int c; try { InputStream in = new LowerCaseInputStream( new BufferedInputStream ( new FileInputStream ( “test.txt” ) ) ); while ( (c = in.read()) >= 0 ) { System . out . print ( ( char )c ); } in.close(); } catch ( IOException e) { e.printStackTrace(); } } }
  • 27.
  • 28.
  • 29.
  • 30. Abstract Factory Structure and Participants
  • 31.
  • 32.
  • 33. Abstract Factory Structure and Participants
  • 34.
  • 36.
  • 37.