Why are patterns required?

According to the authors, the three key advantages of pattern-oriented software development that stand out are as follows:

  • A language/platform-agnostic way to communicate about software artifacts
  • A tool for refactoring initiatives (targets for refactoring)
  • Better API design

With the advent of the pattern movement, the software development community got a canonical language to communicate about software design, architecture, and implementation. Software development is a craft that has got trade-offs attached to each strategy, and there are multiple ways to develop software. The various pattern catalogs brought some conceptual unification for this cacophony in software development.

Most developers around the world today who are worth their salt can understand and speak this language. We believe you will be able to do the same by the end of the chapter. Imagine yourself stating the following about your recent implementation:

Tip

For our tax computation example, we have used the command pattern to handle the computation logic. The commands (handlers) are configured using an XML file, and a factory method takes care of the instantiation of classes on the fly using Lazy loading. We cache the commands, and avoid instantiation of more objects by imposing singleton constraints on the invocation. We support the prototype pattern where command objects can be cloned. The command objects have a base implementation, where concrete command objects use the template method pattern to override methods that are necessary. The command objects are implemented using the design by contracts idiom. The whole mechanism is encapsulated using a Facade class, which acts as an API layer for the application logic. The application logic uses entity objects (reference) to store the taxable entities, attributes such as tax parameters are stored as value objects. We use data transfer object (DTO) to transfer the data from the application layer to the computational layer. The Arlow/Nuestadt-based archetype pattern is the unit of structuring the tax computation logic.

For some developers, the preceding language/platform-independent description of the software being developed is enough to understand the approach taken. This will boost developer productivity (during all phases of SDLC, including development, maintenance, and support) as the developers will be able to get a good mental model of the code base. Without Pattern catalogs, such succinct descriptions of the design or implementation would have been impossible.

In an Agile software development scenario, we develop software in an iterative fashion. Once we reach a certain maturity in a module, developers refactor their code. While refactoring a module, patterns do help in organizing the logic. The case study given next will help you to understand the rationale behind patterns as refactoring targets.

APIs based on well-defined patterns are easy to use and impose less cognitive load on programmers. The success of the ASP.NET MVC framework, NHibernate, and APIs for writing HTTP modules and handlers in the ASP.NET pipeline are a few testimonies to the process. You will see how these three key advantages are put into practice in the ensuing chapters and case studies.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.145.191.22