Java EE 8 Design Patterns and Best Practices
上QQ阅读APP看书,第一时间看更新

Understanding the advantages of design patterns

Creating an object-oriented design is a tough task. This is because we have several important elements to think about with regard to the scenario that we'll work in and the problem we'll solve. This includes defining the appropriate objects that we need to create in order to reach the solution; defining the granularity of objects and looking at what interfaces we need to create. These tasks need to be addressed during the creation process in design. Objects can be created to represent a real-world object or to represent a process with its algorithms and responsibilities. Furthermore, we even need to consider the number of objects, their size, and the interface we need to access. 

Design patterns are great tools for helping us to identify classes and objects that don't represent real-world objects and objects that are less-obvious abstractions. Moreover, design patterns help us to apply the finest granularity to objects and they also allow us to analyze a problem and solution as a model. Design patterns make the design flexible, providing a decoupling between classes and objects. They also provide the ability to organize solutions, allowing delegate responsibilities to classes with the best way.

Building software is an expensive process for companies because it requires capable professionals and infrastructure to build and maintain the software. Design patterns, with their flexibility and decoupled design, make maintenance easy and therefore decrease its cost.