Learn the adapter pattern.

You’re going to need an adapter.

As you use more abstract classes and interfaces, you should start to use the adapter pattern.

Then, when an API or interface needs to change, you only have to update the adapter.

Imagine you’re taking orders from various partners, each of which sends a message written in a proprietary format. If you have a standard object passing orders into your internal system, you can separate the conversion of each proprietary format into separate adapters.

Each adapter would have one job: convert the message from the foreign language into the internal format. Then, if there are any changes in your partner’s messaging protocols, a developer can make the changes in the adapter.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: