#Issue 18 - Simplifying Integration with Adapter Pattern
Adapter Pattern is a structural design pattern that allows incompatible interfaces to work together.
Suppose you have a laptop that only has a USB-C port and you have an older printer that uses a USB-A cable. Now, rather than getting a new laptop or a new printer what you would usually do is get a converter. You can use a USB-C to USB-A adapter. This adapter allows you to connect your USB-A printer to the USB-C port on your laptop, making them compatible even though they originally had different connectors.
In programming, Adapter Pattern is a structural design pattern that allows incompatible interfaces to work together.
Imagine you have a system that collects information from various sources through APIs. The current data format looks like this:
{
"id": 123,
"name": "Potato",
"price": 49.99
}
Now, a new third-party API comes along, but the data they provide is in a different format:
{
"productID": "ABC456",
"productName": "Broccoli",
"cost": 29.95
}
Instead of changing your existing system's format, you decide to create a function that acts as a translator, converting the new data format into the format your system understands.
Now, your system can seamlessly integrate data from the new third-party API without changing its internal structure. The adaptNewDataFormat
function acts as an adapter, ensuring that the new data fits into the expected format of your system.
Links Around The Web
Delightful micro-interaction with CSS
Last week I wrote an interactive tutorial about creating an animated checkbox using properties of SVG and CSS. I had fun writing it as well, included quite a few interactive element for showcasing how stroke animation and transition-delay works. The write-up itself kind of became a side-project! Give it a read if you are interested in frontend stuff.
Extensive course that teaches you basic of GCP, Docker, databases and building a complete data pipeline. It includes videos, slides and exercises.
Guide to onboarding in a new job
Changing a job and settling down into it takes time and is not easy. Alex wrote some tips on navigating your first few days in a new job.
That’s it folks. Thanks for reading!
Loved it!