APIs vs Microservices

If you work in the world of software, chances are you’ve most likely heard about microservices and the buzz around them. They have become incredibly popular in today’s tech industry, but there tends to be some confusion between them and another buzz word – APIs. So what’s the difference and what’s all the fuss about?

What’s a microservice?

 “Microservices architecture is an approach in which a single application is composed of many loosely coupled and independently deployable smaller services.” – IBM

Okay, so what does this really mean? In the world of programming, the traditional software architecture of yesteryear has been the monolithic architecture, where the entire application is one centralized code base that is structured with the 3 common layers – UI, business logic, and data access. Microservices, on the other hand, is a departure from this traditional approach, where instead of one centralized code base that contains absolutely everything, it is broken down into smaller, independent and loosely coupled pieces of software (or services), hence the name.

What’s an API?

“API is the acronym for Application Programming Interface, which is a software intermediary that allows two applications to talk to each other. Each time you use an app like Facebook, send an instant message, or check the weather on your phone, you’re using an API.” – Mulesoft

An API is a set of endpoints that provides functionality to the caller (you as the user or your own software) without having to know how that functionality is implemented. Most modern APIs are RESTful, and there are plenty of public APIs out there that we can integrate with our own software, such as Google Drive, Twitter and Amazon S3.

API and microservice fusion

Hopefully now these terms are more distinguishable – essentially, you have an architecture pattern (microservices) and an interface to allow communication between components (API).

The way that these two work together, is that APIs will more than likely form part of a microservice architecture, where each microservice will have its own API, allowing communication between a client and the service and also between the services where necessary.

So what’s all the fuss about microservices?

Microservices have become increasingly popular, but why is that the case? To understand its rise in popularity, we need to understand some of its key aspects and the advantages that they bring:

1.   Single responsibility – each microservice is responsible for one thing and one thing only. This will aid in reducing complexity, as it will be a smaller piece of software that will be more maintainable.

2.   Loose coupling – this means that each microservice is independent of all the others and any changes in one microservice should not affect any of the other microservices.

3.   Fault isolation – with each microservice being an isolated and independent piece of the application puzzle, if something goes wrong, it will remain isolated to that microservice and will not bring the entire application down.

4.   Tech flexibility – since each microservice is its own independent piece of software, you have the freedom to use any technology stack that you and your team deem appropriate.

5.   Faster deployment – each microservice can be independently managed and deployed when required without having to wait for the entire application to

Continue reading

This post was originally published on this site