SlideShare a Scribd company logo
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 Diagrams
sadique_ghitm
 
ER MODEL
ER MODELER MODEL
ER MODEL
Rupali Rana
 
EER Model
EER ModelEER Model
EER Model
Rahul Mukherjee
 
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 ppt
Pihu 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) Modeling
sontumax
 
Entity Relationship Diagram
Entity Relationship DiagramEntity Relationship Diagram
Entity Relationship Diagram
Shakila Mahjabin
 
Object Oriented Relationships
Object Oriented RelationshipsObject Oriented Relationships
Object Oriented Relationships
Taher Barodawala
 
Entity Relationship Diagram2
Entity Relationship Diagram2Entity Relationship Diagram2
Entity Relationship Diagram2
sadeenedian08
 
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 Model
Mary Brinda
 
Enhanced entity relationship model
Enhanced entity relationship modelEnhanced entity relationship model
Enhanced entity relationship model
Esmatullah 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 Program
Michael Heron
 
8815346
88153468815346
8815346
Van Chau
 
OOM Unit I - III.pdf
OOM Unit I - III.pdfOOM Unit I - III.pdf
OOM Unit I - III.pdf
ShaikRafikhan1
 
PATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design PatternsPATTERNS01 - An Introduction to Design Patterns
PATTERNS01 - An Introduction to Design Patterns
Michael Heron
 
SAD02 - Object Orientation
SAD02 - Object OrientationSAD02 - Object Orientation
SAD02 - Object Orientation
Michael Heron
 
2 class use case
2 class use case2 class use case
2 class use case
Minal Maniar
 
Concepts of oops
Concepts of oopsConcepts of oops
Concepts of oops
Sourabrata Mukherjee
 
Unit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptxUnit No 6 Design Patterns.pptx
Unit No 6 Design Patterns.pptx
DrYogeshDeshmukh1
 
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
Saurabh Moody
 
2CPP09 - Encapsulation
2CPP09 - Encapsulation2CPP09 - Encapsulation
2CPP09 - Encapsulation
Michael 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 worshop
Mohammad Shawahneh
 
Uml Diagrams for Web Developers
Uml Diagrams for Web DevelopersUml Diagrams for Web Developers
Uml Diagrams for Web Developers
Dave Kelleher
 
CPP14 - Encapsulation
CPP14 - EncapsulationCPP14 - Encapsulation
CPP14 - Encapsulation
Michael 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 Analysts
SwatiS-BA
 
Introduction to UML
Introduction to UMLIntroduction to UML
Introduction to UML
SwatiS-BA
 
GDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptxGDSC - SOLID Principles session.pptx
GDSC - SOLID Principles session.pptx
AaliyanShaikh
 

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

Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
amberjdewit93
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
taiba qazi
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
ArianaBusciglio
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Ashish Kohli
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Excellence Foundation for South Sudan
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
tarandeep35
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
IreneSebastianRueco1
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
christianmathematics
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
TechSoup
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
NelTorrente
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
National Information Standards Organization (NISO)
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
Celine George
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
heathfieldcps1
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
Academy of Science of South Africa
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
SriSurya50
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
chanes7
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
SACHIN R KONDAGURI
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
amberjdewit93
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
Scholarhat
 

Recently uploaded (20)

Reflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdfReflective and Evaluative Practice...pdf
Reflective and Evaluative Practice...pdf
 
DRUGS AND ITS classification slide share
DRUGS AND ITS classification slide shareDRUGS AND ITS classification slide share
DRUGS AND ITS classification slide share
 
Assignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docxAssignment_4_ArianaBusciglio Marvel(1).docx
Assignment_4_ArianaBusciglio Marvel(1).docx
 
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
Aficamten in HCM (SEQUOIA HCM TRIAL 2024)
 
Your Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective UpskillingYour Skill Boost Masterclass: Strategies for Effective Upskilling
Your Skill Boost Masterclass: Strategies for Effective Upskilling
 
S1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptxS1-Introduction-Biopesticides in ICM.pptx
S1-Introduction-Biopesticides in ICM.pptx
 
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
RPMS TEMPLATE FOR SCHOOL YEAR 2023-2024 FOR TEACHER 1 TO TEACHER 3
 
What is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptxWhat is the purpose of studying mathematics.pptx
What is the purpose of studying mathematics.pptx
 
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat  Leveraging AI for Diversity, Equity, and InclusionExecutive Directors Chat  Leveraging AI for Diversity, Equity, and Inclusion
Executive Directors Chat Leveraging AI for Diversity, Equity, and Inclusion
 
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
MATATAG CURRICULUM: ASSESSING THE READINESS OF ELEM. PUBLIC SCHOOL TEACHERS I...
 
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
Pollock and Snow "DEIA in the Scholarly Landscape, Session One: Setting Expec...
 
How to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold MethodHow to Build a Module in Odoo 17 Using the Scaffold Method
How to Build a Module in Odoo 17 Using the Scaffold Method
 
The basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptxThe basics of sentences session 5pptx.pptx
The basics of sentences session 5pptx.pptx
 
South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)South African Journal of Science: Writing with integrity workshop (2024)
South African Journal of Science: Writing with integrity workshop (2024)
 
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptxFresher’s Quiz 2023 at GMC Nizamabad.pptx
Fresher’s Quiz 2023 at GMC Nizamabad.pptx
 
Digital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments UnitDigital Artifact 1 - 10VCD Environments Unit
Digital Artifact 1 - 10VCD Environments Unit
 
"Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe..."Protectable subject matters, Protection in biotechnology, Protection of othe...
"Protectable subject matters, Protection in biotechnology, Protection of othe...
 
Digital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental DesignDigital Artefact 1 - Tiny Home Environmental Design
Digital Artefact 1 - Tiny Home Environmental Design
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Azure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHatAzure Interview Questions and Answers PDF By ScholarHat
Azure Interview Questions and Answers PDF By ScholarHat
 

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.