From Monolith To Microservices.
In a world of development, we were once building large monolithic applications, capable of performing all the tasks required to do the intended job.
15. Limit Accessibility To Classes And Members
Generally, any class or member of a class should have the lowest possible access level, which still allows for its functionality to work.
Take the case of an externally exposed API, where the interface represents all public accessible methods. Any implementation of this interface should only have public access level on the implemented methods.
The additional members of the implementing class should never be made public. Ideally private or package-private if required for unit testing.
In the case of the exposed API, any publicly available member of the implementation will have to be supported forever, if they have once been published. If members are degraded to a lower access level, it will ruin the API’s backwards compatibility.
As arguably the most popular creational design pattern, the factory pattern provides guidelines for how to flexibly and conveniently create different objects with the same method, by only changing the method’s argument. Utilizing the factory pattern in the creation of objects allows all complexities of the creation to be hidden away. Simultaneously the factory can be designed to create any variation of an object, as long as all objects extend from the same super-class.