August 2018
Intermediate to advanced
314 pages
8h 9m
English
A microservice should always have a small set of responsibilities. This definition is based on a principle called the single responsibility principle, which states that a class must have only one reason to change. In other words, a class with more than one motive to change would have more responsibilities, and would not be cohesive. This would create problems, such as high coupling between the responsibilities of a class, difficulty in reusing code, and difficult maintenance.
A class that had methods that are responsible for calculation, as well as methods for formatting the result, would be an example of a class with little cohesion. Let's look at the following example:
class Insurance { public double calculateCotation ...Read now
Unlock full access