What Are Microservices?
There is a lot of confusion around exactly what a microservice is. That everyone has a different opinion only adds to this confusion. I'll try to define it in a simple non-jargoned manner.
A microservice is a focused solution that can encapsulate and perform a specific task . This allows us to remove that task, that would otherwise be mashed together with others tasks in one giant complex solution, and create multiple small autonomous solutions .
Here a basic example.
Let's say you run an online shop selling hats. You have a great little program where discounts are offered in return for signing up as a "dedicated buyer". Now, to succeed in this brilliant endeavor, you need to accomplish a few basic tasks. Process the payments, authorize and substantiate "Dedicated buyer" users from fakers, and run a database to keep track of the hats. The monolithic approach is to write one large program that includes all the code and dependencies to preform those tasks, along with all the code for the User interface(the webpage) and pop them on one server. Where as, the Microservices approach would be to pull payment processing, authorization, and even data management off that server and farm those tasks out to three different servers that specialize in accomplishing each goal. Essentially, instead of one maid you now have three.
This allows our code to have clarity, separated dependencies, and super fast user experiences. There is an added benefit, especially for small businesses, the cost of development and maintenance is much lower.