Skip to content

The Adapter design pattern allows incompatible interfaces to work together seamlessly. It acts as a bridge between two incompatible interfaces by converting the interface of one class into another interface that a client expects.

Notifications You must be signed in to change notification settings

samyam81/Adapter_Design2.0

Repository files navigation

Adapter Design 2.0

This repository contains implementations of the Adapter Design Pattern in various programming languages. The Adapter Design Pattern allows objects with incompatible interfaces to collaborate. It acts as a bridge between two incompatible interfaces.

Contents

  1. Introduction
  2. Files
  3. Usage
  4. Contributing

Introduction

The Adapter Design Pattern is a structural pattern used to allow two incompatible interfaces to work together. It is particularly useful when integrating new features into existing systems or when reusing code with incompatible interfaces. This pattern involves a single class called the adapter that connects functionalities of independent or incompatible interfaces.

Files

This repository contains implementations of the Adapter Design Pattern in the following languages:

  • C#

    • ChargerAdapter.cs: Contains the C# implementation of the adapter class and related interfaces.
    • Charging.cs: Implements the charging functionality using the adapter.
    • Program.cs: Main entry point to demonstrate the usage of the adapter.
  • Java

    • ChargerAdapter.java: Java implementation of the adapter class and related interfaces.
    • Charging.java: Implements the charging functionality using the adapter.
    • iPhone.java: Represents an iPhone class for demonstration purposes.
    • Phone.java: Main entry point to demonstrate the usage of the adapter in Java.
  • Kotlin

    • ChargerAdapter.kt: Kotlin implementation of the adapter class and related interfaces.
    • Charging.kt: Implements the charging functionality using the adapter.
    • IPhone.kt: Represents an iPhone class for demonstration purposes.
    • Main.kt: Main entry point to demonstrate the usage of the adapter in Kotlin.

Usage

To use the Adapter Design Pattern in your project:

  1. Choose the appropriate implementation for your programming language from the files provided.
  2. Integrate the adapter class (ChargerAdapter or equivalent) into your project.
  3. Utilize the adapter to connect and enable communication between incompatible interfaces.

Refer to the specific language implementation files for detailed usage instructions.

Contributing

Contributions to improve existing implementations or add new implementations in different languages are welcome! Please fork this repository, make your changes, and submit a pull request.

Contributor: @samyam.81

About

The Adapter design pattern allows incompatible interfaces to work together seamlessly. It acts as a bridge between two incompatible interfaces by converting the interface of one class into another interface that a client expects.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published