SlideShare a Scribd company logo
1 of 14
Presentation on
Adapter Design Pattern
Presented by
Md. Zabirul Islam (1507110)
Tanim Ahmed (1507113)
Md. Motaleb Hossen Manik (1507114)
1
DoYou KnowWhat It Is Adapter?
▪ The adapter pattern convert the interface of a class into another interface that
clients expect. Adapter lets classes work together that couldn’t otherwise because
of incompatible interfaces.
▪ Wikipedia says…
▪ In software engineering, the adapter pattern is a software design pattern that
allows the interface of an existing class to be used as another interface. It is often
used to make existing classes work with others without modifying their source
code.
2
Real world example
Consider that you have some pictures in your memory card and you need to transfer them to your
computer.
In order to transfer them you need some kind of adapter that is compatible with your computer ports
so that you can attach memory card to your computer.
In this case card reader is an adapter. Another example would be the famous power adapter;
a three legged plug can't be connected to a two pronged outlet,
it needs to use a power adapter that makes it compatible with the two pronged outlet.
Yet another example would be a translator translating words spoken by one person to another
3
Adapter…
4
Another Example

suppose I am a ProgrammingTeacher, and I have two types of
students in my class, the American students and the Bangladeshi
students, since my American students don’t understand Bangla, I
have to have a translator that will translate my lectures to my
American students.
In this example, a Student class will be theTarget, the translator will
be the Adapter, and the American students will be the Adaptee, like
the class diagram below:
5
Class Diagram Of Adapter Pattern
6
student
translator American student
Context
▪ You are building an inheritance hierarchy and want to
incorporate into it an existing class.
▪ The reused class is also often already part of its own
inheritance hierarchy.
7
Problem
▪ Some problems are faced during designing Adapter design pattern
▪ When there is polymorphism
▪ There may have function with same name but with different
signature
▪ User may have written a separate class for a specific task. But as the
user should go through Polymorphism, this separate class is unused.
8
Adapter Pattern
Problem Continued…
9
Here is already written class called xyzcircle that deals with
circles already. But we can’t use directly because we want to
preserve polymorphic behavior with Shape
Adapter Pattern
Forces
▪ Some languages may not support multiple inheritances (e.g. Java)
▪ More forwarding requests
▪ Increase in the overhead
▪ Adapter chaining in created to reach to specific type
▪ Complex adaptation
10
11
Adapter Pattern Design example
Conclusion
▪ In Adapter Design Pattern…..
▪ Provide the adapter between two different classes or
interfaces
▪ Useful pattern which promotes reuse of software
components.
12
References
▪ 1. https://www.slideshare.net/adeelr456/adapter-design-pattern-
45257387
▪ 2.https://www.slideshare.net/adeelr/qid=4ce8b50c-e14a-4cbb-8b62-
82ba26259f22&v=&b=&from_search=2
13
ThankYou
14

More Related Content

What's hot

Bc0051 – system software
Bc0051 – system softwareBc0051 – system software
Bc0051 – system software
smumbahelp
 

What's hot (19)

Coding conventions
Coding conventionsCoding conventions
Coding conventions
 
Mi0041 java and web design
Mi0041  java and web designMi0041  java and web design
Mi0041 java and web design
 
Constants and Variables
Constants and VariablesConstants and Variables
Constants and Variables
 
Frequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answersFrequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answers
 
Frequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answersFrequently asked tcs technical interview questions and answers
Frequently asked tcs technical interview questions and answers
 
Multilingual Term Extraction as a Service from Acrolinx, CHAT2013
Multilingual Term Extraction as a Service from Acrolinx, CHAT2013Multilingual Term Extraction as a Service from Acrolinx, CHAT2013
Multilingual Term Extraction as a Service from Acrolinx, CHAT2013
 
Introduction to Programming
Introduction to ProgrammingIntroduction to Programming
Introduction to Programming
 
Building your first webpage
Building your first webpageBuilding your first webpage
Building your first webpage
 
Design concerns for concrete syntax
Design concerns for concrete syntaxDesign concerns for concrete syntax
Design concerns for concrete syntax
 
Bc0051 – system software
Bc0051 – system softwareBc0051 – system software
Bc0051 – system software
 
Computer fundamentals
Computer fundamentalsComputer fundamentals
Computer fundamentals
 
From Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developerFrom Good to SOLID: How to become a better PHP developer
From Good to SOLID: How to become a better PHP developer
 
Programming paradigm and web programming
Programming paradigm and web programmingProgramming paradigm and web programming
Programming paradigm and web programming
 
Implementing DSLs in practice
Implementing DSLs in practiceImplementing DSLs in practice
Implementing DSLs in practice
 
WordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standardsWordCamp Pune 2017- WordPress Coding standards
WordCamp Pune 2017- WordPress Coding standards
 
java training in chennai
java training in chennaijava training in chennai
java training in chennai
 
N5 Code Efficiency
N5 Code EfficiencyN5 Code Efficiency
N5 Code Efficiency
 
Programming terms & concepts - Using Java
Programming terms & concepts - Using JavaProgramming terms & concepts - Using Java
Programming terms & concepts - Using Java
 
Ppl home assignment_unit5
Ppl home assignment_unit5Ppl home assignment_unit5
Ppl home assignment_unit5
 

Similar to Adapter design pattern

Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
stanbridge
 
Adapter Pattern Abhijit Hiremagalur 200603
Adapter Pattern Abhijit Hiremagalur 200603Adapter Pattern Abhijit Hiremagalur 200603
Adapter Pattern Abhijit Hiremagalur 200603
melbournepatterns
 
Adapter Pattern
Adapter PatternAdapter Pattern
Adapter Pattern
Monjurul Habib
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
Joe Jacob
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
Christian Heilmann
 

Similar to Adapter design pattern (20)

Mca 4030 programming in java
Mca 4030   programming in javaMca 4030   programming in java
Mca 4030 programming in java
 
Top interview questions in c
Top interview questions in cTop interview questions in c
Top interview questions in c
 
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)
 
GoF Design patterns I: Introduction + Structural Patterns
GoF Design patterns I:   Introduction + Structural PatternsGoF Design patterns I:   Introduction + Structural Patterns
GoF Design patterns I: Introduction + Structural Patterns
 
Metamorphic Domain-Specific Languages
Metamorphic Domain-Specific LanguagesMetamorphic Domain-Specific Languages
Metamorphic Domain-Specific Languages
 
Java
JavaJava
Java
 
Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)Cs 1023 lec 8 design pattern (week 2)
Cs 1023 lec 8 design pattern (week 2)
 
Adapter Pattern Abhijit Hiremagalur 200603
Adapter Pattern Abhijit Hiremagalur 200603Adapter Pattern Abhijit Hiremagalur 200603
Adapter Pattern Abhijit Hiremagalur 200603
 
Single Responsibility Principle
Single Responsibility PrincipleSingle Responsibility Principle
Single Responsibility Principle
 
C# and java comparing programming languages
C# and java  comparing programming languagesC# and java  comparing programming languages
C# and java comparing programming languages
 
Dtacs
DtacsDtacs
Dtacs
 
05 Lecture - PARALLEL Programming in C ++.pdf
05 Lecture - PARALLEL Programming in C ++.pdf05 Lecture - PARALLEL Programming in C ++.pdf
05 Lecture - PARALLEL Programming in C ++.pdf
 
Adapter Pattern
Adapter PatternAdapter Pattern
Adapter Pattern
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Object relationship mapping and hibernate
Object relationship mapping and hibernateObject relationship mapping and hibernate
Object relationship mapping and hibernate
 
OOP Java
OOP JavaOOP Java
OOP Java
 
Maintainable Javascript carsonified
Maintainable Javascript carsonifiedMaintainable Javascript carsonified
Maintainable Javascript carsonified
 
Learn java theory presentation
Learn java theory presentationLearn java theory presentation
Learn java theory presentation
 
C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.C++ Restrictions for Game Programming.
C++ Restrictions for Game Programming.
 
Parallelism, the Cloud, and the Tools of the Future for the next generation o...
Parallelism, the Cloud, and the Tools of the Future for the next generation o...Parallelism, the Cloud, and the Tools of the Future for the next generation o...
Parallelism, the Cloud, and the Tools of the Future for the next generation o...
 

Recently uploaded

Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Christo Ananth
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
ankushspencer015
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Christo Ananth
 

Recently uploaded (20)

Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...Bhosari ( Call Girls ) Pune  6297143586  Hot Model With Sexy Bhabi Ready For ...
Bhosari ( Call Girls ) Pune 6297143586 Hot Model With Sexy Bhabi Ready For ...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
(INDIRA) Call Girl Bhosari Call Now 8617697112 Bhosari Escorts 24x7
 
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdfONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
ONLINE FOOD ORDER SYSTEM PROJECT REPORT.pdf
 
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar  ≼🔝 Delhi door step de...
Call Now ≽ 9953056974 ≼🔝 Call Girls In New Ashok Nagar ≼🔝 Delhi door step de...
 
chapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineeringchapter 5.pptx: drainage and irrigation engineering
chapter 5.pptx: drainage and irrigation engineering
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance BookingCall Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
Call Girls Wakad Call Me 7737669865 Budget Friendly No Advance Booking
 
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELLPVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
PVC VS. FIBERGLASS (FRP) GRAVITY SEWER - UNI BELL
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Unleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leapUnleashing the Power of the SORA AI lastest leap
Unleashing the Power of the SORA AI lastest leap
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
Call for Papers - Educational Administration: Theory and Practice, E-ISSN: 21...
 
Thermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - VThermal Engineering-R & A / C - unit - V
Thermal Engineering-R & A / C - unit - V
 
Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...Call for Papers - International Journal of Intelligent Systems and Applicatio...
Call for Papers - International Journal of Intelligent Systems and Applicatio...
 
Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...Booking open Available Pune Call Girls Pargaon  6297143586 Call Hot Indian Gi...
Booking open Available Pune Call Girls Pargaon 6297143586 Call Hot Indian Gi...
 
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
(INDIRA) Call Girl Meerut Call Now 8617697112 Meerut Escorts 24x7
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 

Adapter design pattern

  • 1. Presentation on Adapter Design Pattern Presented by Md. Zabirul Islam (1507110) Tanim Ahmed (1507113) Md. Motaleb Hossen Manik (1507114) 1
  • 2. DoYou KnowWhat It Is Adapter? ▪ The adapter pattern convert the interface of a class into another interface that clients expect. Adapter lets classes work together that couldn’t otherwise because of incompatible interfaces. ▪ Wikipedia says… ▪ In software engineering, the adapter pattern is a software design pattern that allows the interface of an existing class to be used as another interface. It is often used to make existing classes work with others without modifying their source code. 2
  • 3. Real world example Consider that you have some pictures in your memory card and you need to transfer them to your computer. In order to transfer them you need some kind of adapter that is compatible with your computer ports so that you can attach memory card to your computer. In this case card reader is an adapter. Another example would be the famous power adapter; a three legged plug can't be connected to a two pronged outlet, it needs to use a power adapter that makes it compatible with the two pronged outlet. Yet another example would be a translator translating words spoken by one person to another 3
  • 5. Another Example  suppose I am a ProgrammingTeacher, and I have two types of students in my class, the American students and the Bangladeshi students, since my American students don’t understand Bangla, I have to have a translator that will translate my lectures to my American students. In this example, a Student class will be theTarget, the translator will be the Adapter, and the American students will be the Adaptee, like the class diagram below: 5
  • 6. Class Diagram Of Adapter Pattern 6 student translator American student
  • 7. Context ▪ You are building an inheritance hierarchy and want to incorporate into it an existing class. ▪ The reused class is also often already part of its own inheritance hierarchy. 7
  • 8. Problem ▪ Some problems are faced during designing Adapter design pattern ▪ When there is polymorphism ▪ There may have function with same name but with different signature ▪ User may have written a separate class for a specific task. But as the user should go through Polymorphism, this separate class is unused. 8
  • 9. Adapter Pattern Problem Continued… 9 Here is already written class called xyzcircle that deals with circles already. But we can’t use directly because we want to preserve polymorphic behavior with Shape
  • 10. Adapter Pattern Forces ▪ Some languages may not support multiple inheritances (e.g. Java) ▪ More forwarding requests ▪ Increase in the overhead ▪ Adapter chaining in created to reach to specific type ▪ Complex adaptation 10
  • 12. Conclusion ▪ In Adapter Design Pattern….. ▪ Provide the adapter between two different classes or interfaces ▪ Useful pattern which promotes reuse of software components. 12
  • 13. References ▪ 1. https://www.slideshare.net/adeelr456/adapter-design-pattern- 45257387 ▪ 2.https://www.slideshare.net/adeelr/qid=4ce8b50c-e14a-4cbb-8b62- 82ba26259f22&v=&b=&from_search=2 13