SlideShare a Scribd company logo
1 of 26
Download to read offline
Design Pattern
Software Architecture
Pattern :
A common solution and the best practice to solve a reoccurring problem
Software developers
encountered many recurring
problems during software
development, after enhanced
and developed those
solutions, they documented
the steps and sequence to
solve those problems in
future, this solution called
software design pattern.
Design pattern is a how we can design relation
among classes and objects to solve a general and
repeatable problem in specific context ..
Design pattern :skip the complex hard work and jump
into straight design and plan your work to improve the
quality of the software and reduce development time and
cost .
Before start your design pattern you have to know that
OOP Basics :
Inheritance
Polymorphism
Encapsulation
Abstraction
OOP Principles :
Favor composition better than inheritance
Code in interface not an implementation
We can classify Design patterns into
Structural (the composition of classes or objects):
– Adapter, Bridge, Composite, Decorator, Façade, Proxy
Behavioral (object interactions):
– Interpreter, Iterator, Mediator,
Creational (object creation):
– Abstract Factory, Builder, Factory Method, Prototype, Singleton
UNIFIED MODELING LANGUAGE
(UML)
• Is an application modeling specification
• Is a language for specifying , Virtualizing and documenting the artifacts of
system.
• The primary objective of UML is to simplify the complex software
engineering process
• UML visualize and create artifacts of systems
• Its common language and standard tool to illustrate the design patterns
UML and Design pattern
Mark Visibility type
+ Public
# Protected
- Private
~ Package
Access Modifiers - Visibility
CLASS DIAGRAMS
UML Conventions
Inner Class
UML Conventions
Use Italic text for the
Abstract class and
methods
Inheritance
Generalization
UML Conventions
Interfaces
Realization
dotted Arrow
UML Conventions
Methods Throwing Exceptions
UML Conventions
Important definitions
•Subclass /child class / derived class:
•Super class/ parent class / Base class:
Relationships between Classes
- Inheritance (Generalization) IS A
- Association Has A
- Aggregation – sharing
- Composition – Non sharing
• Is-A relationship
• In Is-A relationship one class is obtaining the features of another class by
using inheritance concept with extends keywords.
• Man IS A Human (Man is extends for Human)
All public and protected Methods and attributes in Human will be in Man
• If you change method in Human will effect directly in Man
Relationships between Classes
• Has-A relationship
• In Has-A relationship an object of one class is created as data member in another
class the relationship between these two classes is Has-A.
• Man HAS A Relationships with others.
• There is an associations between the Man and the the other could be strong or
weak relationship .Maybe peer to peer relationship or Ownership relationship .
Relationships between Classes
Relationships
between
Classes
Car
Passenger Driver
EngineGas Station
Vehicle
Dependency
Is a relation between two classes, where one class depends on another class
So any change in classes may affect the functionality of the other dependent class.
For example Car and Gas Station, we have Car need to fill oil to start Engine , in this case, Car class is
dependent on the GasStation class. In the future, if any change are made to the GasStation class, it may
result in changes to the Car class.
Relationships between Classes
Association
• Association is a structural relationship between two classes where all objects have
their own lifecycle and there is no ownership.
• Let’s take an example of Car and Passenger relationship
Multiple Passengers can associate with a single Car and a single Passenger can
associate with multiple Cars , but there is no ownership between the objects and
both have their own lifecycle. Both can create and delete independently.
• Each Class contains reference to another Class , maybe one-to-one relationship or
one-to-many, many to many ..
Relationships between Classes
Aggregation
• Aggregation is a specialized form of Association where all objects have their own lifecycle,
but there is ownership and a child object cannot belong to another parent object.
• Let’s take an example of a Car and Driver Relationship . A single Car cannot belong to
multiple Drivers , but if Driver die , Car will not die , object will not be destroyed.
• We can sell car to another Driver to use it
• We can think of it as a “has-a” relationship or "whole/part" relationship.
• Driver can own many cars (Collection of cars).
Relationships between Classes
Composition
• Composition is a specialized form of Aggregation
• we can call this as a “death” relationship. It is a strong type of Aggregation. Child object
does not have their own lifecycle and if parent object deletes all child object will also be
deleted.
• Let’s take again an example of relationship between Car and Engine. Car HAS A Engine
but there is no independent life of a Engine and any Engine cannot belong to two different
Cars. If we delete the Car , the Engine will automatically be deleted
Relationships between Classes
Relationships between Classes

More Related Content

What's hot

Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagramssadique_ghitm
 
OO relationships between classes
OO relationships between classesOO relationships between classes
OO relationships between classesSujit Kumar
 
Er model ppt
Er model pptEr model ppt
Er model pptPihu Goel
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship ModelSlideshare
 
Ch 4 E E R Biz Rules
Ch 4  E E R  Biz RulesCh 4  E E R  Biz Rules
Ch 4 E E R Biz Rulesguest8fdbdd
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modelingsontumax
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship DiagramShakila Mahjabin
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented RelationshipsTaher Barodawala
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2sadeenedian08
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Mudasir Qazi
 
Ch 5 O O Data Modeling Class
Ch 5  O O  Data Modeling ClassCh 5  O O  Data Modeling Class
Ch 5 O O Data Modeling Classguest8fdbdd
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER ModelMary Brinda
 
Enhanced entity relationship model
Enhanced entity relationship modelEnhanced entity relationship model
Enhanced entity relationship modelEsmatullah Adel
 

What's hot (20)

Entity Relationship Diagrams
Entity Relationship DiagramsEntity Relationship Diagrams
Entity Relationship Diagrams
 
Eer case study
Eer case studyEer case study
Eer case study
 
ER MODEL
ER MODELER MODEL
ER MODEL
 
EER Model
EER ModelEER Model
EER Model
 
OO relationships between classes
OO relationships between classesOO relationships between classes
OO relationships between classes
 
Er model ppt
Er model pptEr model ppt
Er model ppt
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
 
Ch 3 E R Model
Ch 3  E R  ModelCh 3  E R  Model
Ch 3 E R Model
 
Ch 4 E E R Biz Rules
Ch 4  E E R  Biz RulesCh 4  E E R  Biz Rules
Ch 4 E E R Biz Rules
 
123
123123
123
 
Enhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) ModelingEnhanced Entity-Relationship (EER) Modeling
Enhanced Entity-Relationship (EER) Modeling
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
 
enhanced er diagram
enhanced er diagramenhanced er diagram
enhanced er diagram
 
Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)Database - Entity Relationship Diagram (ERD)
Database - Entity Relationship Diagram (ERD)
 
Ch 5 O O Data Modeling Class
Ch 5  O O  Data Modeling ClassCh 5  O O  Data Modeling Class
Ch 5 O O Data Modeling Class
 
Mapping ER and EER Model
Mapping ER and EER ModelMapping ER and EER Model
Mapping ER and EER Model
 
Erd chapter 3
Erd chapter 3Erd chapter 3
Erd chapter 3
 
Enhanced entity relationship model
Enhanced entity relationship modelEnhanced entity relationship model
Enhanced entity relationship model
 

Similar to Design pattern - part 1

2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented ProgramMichael Heron
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsMichael Heron
 
SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object OrientationMichael Heron
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxDrYogeshDeshmukh1
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldSaurabh Moody
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - EncapsulationMichael Heron
 
Object Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopObject Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopMohammad Shawahneh
 
Uml Diagrams for Web Developers
Uml Diagrams for Web DevelopersUml Diagrams for Web Developers
Uml Diagrams for Web DevelopersDave Kelleher
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - EncapsulationMichael Heron
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Professor Lili Saghafi
 
UML Training for Business Analysts
UML Training for Business AnalystsUML Training for Business Analysts
UML Training for Business AnalystsSwatiS-BA
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UMLSwatiS-BA
 
GDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptxGDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptxAaliyanShaikh
 

Similar to Design pattern - part 1 (20)

2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program2CPP05 - Modelling an Object Oriented Program
2CPP05 - Modelling an Object Oriented Program
 
8815346
88153468815346
8815346
 
OOM Unit I - III.pdf
OOM Unit I - III.pdfOOM Unit I - III.pdf
OOM Unit I - III.pdf
 
Mca 504 dotnet_unit4
Mca 504 dotnet_unit4Mca 504 dotnet_unit4
Mca 504 dotnet_unit4
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
 
SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object Orientation
 
2 class use case
2 class use case2 class use case
2 class use case
 
Concepts of oops
Concepts of oopsConcepts of oops
Concepts of oops
 
General oops concepts
General oops conceptsGeneral oops concepts
General oops concepts
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptx
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
Ooad ch 4
Ooad ch 4Ooad ch 4
Ooad ch 4
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
 
Object Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshopObject Oriented, Design patterns and data modelling worshop
Object Oriented, Design patterns and data modelling worshop
 
Uml Diagrams for Web Developers
Uml Diagrams for Web DevelopersUml Diagrams for Web Developers
Uml Diagrams for Web Developers
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
 
Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)Advanced Programming _Abstract Classes vs Interfaces (Java)
Advanced Programming _Abstract Classes vs Interfaces (Java)
 
UML Training for Business Analysts
UML Training for Business AnalystsUML Training for Business Analysts
UML Training for Business Analysts
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
 
GDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptxGDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptx
 

Recently uploaded

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)eniolaolutunde
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxsocialsciencegdgrohi
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Celine George
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxOH TEIK BIN
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerunnathinaik
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfSumit Tiwari
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxRaymartEstabillo3
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonJericReyAuditor
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxSayali Powar
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application ) Sakshi Ghasle
 

Recently uploaded (20)

Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)Software Engineering Methodologies (overview)
Software Engineering Methodologies (overview)
 
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptxHistory Class XII Ch. 3 Kinship, Caste and Class (1).pptx
History Class XII Ch. 3 Kinship, Caste and Class (1).pptx
 
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
Incoming and Outgoing Shipments in 1 STEP Using Odoo 17
 
Solving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptxSolving Puzzles Benefits Everyone (English).pptx
Solving Puzzles Benefits Everyone (English).pptx
 
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Tilak Nagar Delhi reach out to us at 🔝9953056974🔝
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
internship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developerinternship ppt on smartinternz platform as salesforce developer
internship ppt on smartinternz platform as salesforce developer
 
Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝Model Call Girl in Bikash Puri  Delhi reach out to us at 🔝9953056974🔝
Model Call Girl in Bikash Puri Delhi reach out to us at 🔝9953056974🔝
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdfEnzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
Enzyme, Pharmaceutical Aids, Miscellaneous Last Part of Chapter no 5th.pdf
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptxEPANDING THE CONTENT OF AN OUTLINE using notes.pptx
EPANDING THE CONTENT OF AN OUTLINE using notes.pptx
 
Science lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lessonScience lesson Moon for 4th quarter lesson
Science lesson Moon for 4th quarter lesson
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptxPOINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
POINT- BIOCHEMISTRY SEM 2 ENZYMES UNIT 5.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Hybridoma Technology ( Production , Purification , and Application )
Hybridoma Technology  ( Production , Purification , and Application  ) Hybridoma Technology  ( Production , Purification , and Application  )
Hybridoma Technology ( Production , Purification , and Application )
 

Design pattern - part 1

  • 2. Software Architecture Pattern : A common solution and the best practice to solve a reoccurring problem
  • 3. Software developers encountered many recurring problems during software development, after enhanced and developed those solutions, they documented the steps and sequence to solve those problems in future, this solution called software design pattern.
  • 4. Design pattern is a how we can design relation among classes and objects to solve a general and repeatable problem in specific context .. Design pattern :skip the complex hard work and jump into straight design and plan your work to improve the quality of the software and reduce development time and cost .
  • 5. Before start your design pattern you have to know that OOP Basics : Inheritance Polymorphism Encapsulation Abstraction OOP Principles : Favor composition better than inheritance Code in interface not an implementation
  • 6. We can classify Design patterns into Structural (the composition of classes or objects): – Adapter, Bridge, Composite, Decorator, Façade, Proxy Behavioral (object interactions): – Interpreter, Iterator, Mediator, Creational (object creation): – Abstract Factory, Builder, Factory Method, Prototype, Singleton
  • 7. UNIFIED MODELING LANGUAGE (UML) • Is an application modeling specification • Is a language for specifying , Virtualizing and documenting the artifacts of system. • The primary objective of UML is to simplify the complex software engineering process • UML visualize and create artifacts of systems • Its common language and standard tool to illustrate the design patterns
  • 8. UML and Design pattern
  • 9. Mark Visibility type + Public # Protected - Private ~ Package Access Modifiers - Visibility
  • 12. Use Italic text for the Abstract class and methods Inheritance Generalization UML Conventions
  • 15. Important definitions •Subclass /child class / derived class: •Super class/ parent class / Base class:
  • 16. Relationships between Classes - Inheritance (Generalization) IS A - Association Has A - Aggregation – sharing - Composition – Non sharing
  • 17. • Is-A relationship • In Is-A relationship one class is obtaining the features of another class by using inheritance concept with extends keywords. • Man IS A Human (Man is extends for Human) All public and protected Methods and attributes in Human will be in Man • If you change method in Human will effect directly in Man Relationships between Classes
  • 18. • Has-A relationship • In Has-A relationship an object of one class is created as data member in another class the relationship between these two classes is Has-A. • Man HAS A Relationships with others. • There is an associations between the Man and the the other could be strong or weak relationship .Maybe peer to peer relationship or Ownership relationship . Relationships between Classes
  • 21. Dependency Is a relation between two classes, where one class depends on another class So any change in classes may affect the functionality of the other dependent class. For example Car and Gas Station, we have Car need to fill oil to start Engine , in this case, Car class is dependent on the GasStation class. In the future, if any change are made to the GasStation class, it may result in changes to the Car class. Relationships between Classes
  • 22. Association • Association is a structural relationship between two classes where all objects have their own lifecycle and there is no ownership. • Let’s take an example of Car and Passenger relationship Multiple Passengers can associate with a single Car and a single Passenger can associate with multiple Cars , but there is no ownership between the objects and both have their own lifecycle. Both can create and delete independently. • Each Class contains reference to another Class , maybe one-to-one relationship or one-to-many, many to many .. Relationships between Classes
  • 23. Aggregation • Aggregation is a specialized form of Association where all objects have their own lifecycle, but there is ownership and a child object cannot belong to another parent object. • Let’s take an example of a Car and Driver Relationship . A single Car cannot belong to multiple Drivers , but if Driver die , Car will not die , object will not be destroyed. • We can sell car to another Driver to use it • We can think of it as a “has-a” relationship or "whole/part" relationship. • Driver can own many cars (Collection of cars). Relationships between Classes
  • 24. Composition • Composition is a specialized form of Aggregation • we can call this as a “death” relationship. It is a strong type of Aggregation. Child object does not have their own lifecycle and if parent object deletes all child object will also be deleted. • Let’s take again an example of relationship between Car and Engine. Car HAS A Engine but there is no independent life of a Engine and any Engine cannot belong to two different Cars. If we delete the Car , the Engine will automatically be deleted Relationships between Classes
  • 25.