DESIGN PATTERNS : Adapter Pattern

Slides:



Advertisements
Similar presentations
PATTERNS -STRUCTURAL PATTERNS WATTANAPON G SUTTAPAK Software Engineering, School of Information Communication Technology, University of PHAYAO 1.
Advertisements

1 Feel free to contact us at
242/102/49 0/51/59 181/172/166 Primary colors 248/152/29 PMS 172 PMS 137 PMS 546 PMS /206/ /227/ /129/123 Secondary colors 114/181/204.
LAS To WITSML Conversion Utility Presented at POSC Regional SIG meeting Stavanger, June 2006 by POSC & Satyam Computer Services Ltd.
HOME AUTOMATION: WEB BASED CONTROL Anthony Campbell Eric Poynter EKU, Dept. of Technology Computer Electronic Networking.
BMTS 242: Computer and Systems Lecture 4: Computer Hardware and Ports Yousef Alharbi Website
1 Circuitscape Capstone Presentation Team Circuitscape Katie Rankin Mike Schulte Carl Reniker Sean Collins.
“The road to corporate success is not to be trodden alone, for corporate success is the result of cohesive team effort towards delivering the best against.
Web Hosting Simplified!. 01 Everyone who owns a domain has most definitely hosted their domain on the internet. But there are some people (not everyone.
COMPUTER SCIENCE AND THE FOUNDATION OF KNOWLEDGE NURSING INFORMATICS CHAPTER 5 1.
Import Live Mail Contacts to Outlook Get Live Mail Contacts converter solution to recover live.
Flowcharting Workshop
How to Get Back Deleted Files from SD Card?
Design Patterns Lecture part 2.
On the road: Test automation in practice for a BMW map update service
Adapter Design Pattern
Add library banner image here
Dot Net Training in Hyderabad. About Us Best Dot Net Training in Hyderabad. KMRsoft offers Dot Net classroom, online, corporate trainings with 100% live.
SAS training centers in Hyderabad SAS training centers in Hyderabad.
3171T Tips to pass your Avaya APDS 3171T exam Pass your 3171T exam successfully
Ebooks and audio books At the public library.
Adapter Pattern 1.
HOME AUTOMATION: WEB BASED CONTROL
Certification Phase: PLANNING
MWS9943.
DESIGN PATTERNS : Strategy Pattern
COMPUTER NETWORK TECHNOLOGY
DESIGN PATTERNS : State Pattern
DESIGN PATTERNS : Introduction
Red Black Tree Prof. Keshav Tambre Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information Technology,
Corporate / Business Etiquette Prepared by Vaidehi Banerjee Department of Applied Sciences & Engineering Good manners and etiquette will open doors that.
Physics of Nanoparticles
Composition & Resolution of Forces
Adapter Design Pattern
Usability Heuristics Prof
EQUIVALENCE CALCULATIONS UNDER INFLATION
NP-COMPLETE Prof. Manjusha Amritkar Assistant Professor Department of Information Technology Hope Foundation’s International Institute of Information.
International Institute of Information Technology, (I²IT).
Engineering Mathematics-I Eigenvalues and Eigenvectors
Software Design Methodologies and Testing
Pass Structure of Assembler
INTERNATIONAL INSTITUTE OF IFORMATION TECHNOLOGY, (I²IT)
INTERNATIONAL INSTITUTE OF IFORMATION TECHNOLOGY, (I²IT)
ADDITION OF TWO POLYNOMIALS
Cloud Computing Prof. Sachindra Chavan Assistant Professor
Newton’s Laws of Motion
By Sandeep Patil, Department of Computer Engineering, I²IT
Differential Equation
BINARY HEAP Prof ajitkumar shitole Assistant Professor Department of computer engineering Hope Foundation’s International Institute of Information.
Pass Structure of Assembler
Types of Corrosion Dr. Swati Kolet Assistant Professor
gyroscope Prof Varsha Degaonkar Assistant Professor
Introduction to TCP/IP protocol Suite
Hope Foundation’s International Institute of Information.
Essay Writing Writing is an art Prepared by Vaidehi Banerjee
Introduction to Human Computer Interaction
Design procedure for an Integrator
Artificial Intelligence
Basic Electrical Engg. UNIT:-IV AC Fundamental
Prof. Deptii Chaudhari.
Tel Hope Foundation’s International Institute of Information Technology, (I²IT). Tel
PIC Microcontroller ADC interfacing Prof. Ashvini Kulkarni
INTERNATIONAL INSTITUTE OF IFORMATION TECHNOLOGY, (I²IT)
DAA - Introduction Dr. Sashikala Mishra Associate Professor Department of Computer Engineering Hope Foundation’s INTERNATIONAL INSTITUTE OF INFORMATION.
Tel Hope Foundation’s International Institute of Information Technology, (I²IT). Tel
Introduction to Microwave
Transaction Serializability
CASCADING STYLE SHEET WEB TECHNOLOGY
CSCI 360 Final Review Dr. X.
Presentation transcript:

DESIGN PATTERNS : Adapter Pattern By RAVI P. PATKI (Associate Professor (IT) Hope Foundation’s International Institute of Information Technology

Agenda Introduction Problem in Software Design /code Definition of Adapter Pattern Solution to Problem in terms of Adapter Pattern Implementation of adapter Pattern Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Introduction This pattern is easy to understand as the real world is full of adapters.   For example consider a USB to Ethernet adapter. We need this when we have an Ethernet interface on one end and USB on the other. Since they are incompatible with each other. we use an adapter that converts one to other. This example is pretty analogous to Object Oriented Adapters. In design, adapters are used when we have a class (Client) expecting some type of object and we have an object (Adaptee) offering the same features but exposing a different interface. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Introduction Example Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Introduction Adapter pattern works as a bridge between two incompatible interfaces. This type of design pattern comes under structural pattern as this pattern combines the capability of two independent interfaces. This pattern involves a single class which is responsible to join functionalities of independent or incompatible interfaces. A real life example could be a case of card reader which acts as an adapter between memory card and a laptop. You plug-in the memory card into card reader and card reader into the laptop so that memory card can be read via laptop. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation We are demonstrating use of Adapter pattern via following example in which an audio player device can play mp3 files only and wants to use an advanced audio player capable of playing vlc and mp4 files. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation we have a MediaPlayer interface and a concrete class AudioPlayer implementing the MediaPlayer interface. AudioPlayer can play mp3 format audio files by default. We are having another interface AdvancedMediaPlayer and concrete classes implementing the AdvancedMediaPlayer interface. These classes can play vlc and mp4 format files. We want to make AudioPlayer to play other formats as well. To attain this, we have created an adapter class MediaAdapter which implements the MediaPlayer interface and uses AdvancedMediaPlayer objects to play the required format. AudioPlayer uses the adapter class MediaAdapter passing it the desired audio type without knowing the actual class which can play the desired format. AdapterPatternDemo, our demo class will use AudioPlayer class to play various formats. Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

Implementation Hope Foundation’s International Institute of Information Technology, I²IT, P-14 Rajiv Gandhi Infotech Park, Hinjawadi, Pune - 411 057 Tel - +91 20 22933441 / 2 / 3 | Website - www.isquareit.edu.in ; Email - info@isquareit.edu.in

THANK YOU For further information please feel free to contact Dr THANK YOU For further information please feel free to contact Dr. Ravi Patki ravip@isquareit.edu.in Department of Information Technology, Hope Foundation’s International Institute of Information Technology, I²IT P-14, Rajiv Gandhi Infotech Park, Hinjawadi, MIDC Phase I Pune – 411057 Tel +91 20 22933441 www.isquareit.edu.in; info@isquareit.edu.in