This is only the case study and for your further experience and knowledge. Abstract Factory has the factory object producing objects of several classes. Define a factory interface that consists of a factory method per product.
Isolation of concrete classes: The Abstract Factory pattern helps you control the classes of objects that an application creates. The new operator considered harmful. The application can wholesale replace the entire family of products simply by instantiating a different concrete instance of the abstract factory.
The factory method is just a method, it can be overridden in a subclass, whereas the abstract factory is an object that has multiple factory methods on it. And most likely this class, will be having more than one purpose, can be called low-cohesion. The pattern hides the implementation of the product definitions and their class names and the only way the client can create a product is through the factory. The application can wholesale replace the entire family of products simply by instantiating a different concrete instance of the abstract factory. Example The purpose of the Abstract Factory is to provide an interface for creating families of related objects, without specifying concrete classes. Please write comments if you find anything incorrect, or you want to share more information about the topic discussed above.
Product class names are isolated in the implementation of the concrete factory; they do not appear in client code. The same machinery is used to stamp right hand doors, left hand doors, right front fenders, left front fenders, hoods, etc.
And most likely this class, will be having more than one purpose, can be called low-cohesion. Think about the inheritence which is overused in OOP, it introduces a very high coupling. Join For Free I had a job to check our project code quality. Regardless of the method chose, we can learn by heart the patterns and spent hours to memorize their UML diagrams, but sometimes when we need to use them in a real project, it becomes more problematic.
Builder has the factory object building a complex product incrementally using a correspondingly complex protocol. But it improves the cohesion and the coupling of your classes.
We just need create a new Class that extends or implements the InfoReader class and then we can override our own readInfo function.