Posts For Tag: Design Patterns
Does Static Factory Violate Open/Closed Principle?
25 Jan 2018
Consider an application that provides some statistics reports. Reports are present in different formats: JSON for API, HTML for viewing in a browser and pdf for printing on the paper. It has StatisticsController that receives a required format from the...
READ MOREWhen to use Factory instead of direct object construction
22 May 2017
Factory is an object responsible for creating other objects. It is often considered a good practice to move the process of object creation from the consumer’s code into the factory. Even more, some people say that you should avoid the...
READ MORESymfony Event Dispatcher
15 Apr 2016
The idea of event dispatcher is to allow communication between different parts of the application without coupling them. In this way, an application can be easily maintained and extended, and it does not have to know about the classes that...
READ MORE