The application of patterns occurs early in the architectural process and continues throughout application design and well into the implementation stages. In order, you would apply architectural patterns, design patterns, and idioms to the stages of development. An architectural pattern guides the structure of a system from the user through the database and any layers that make up the application structure. Design patterns guide the structure or mechanics of classes and components within an architectural subsystem. Idioms are common techniques within a particular technology or language.
Patterns and catalogs of patterns are best understood if they all relate to a common application. This book uses a simplified case study that lays out a company vision and a variety of common requirements that the application must fulfill as a basis for the patterns. Throughout the text, the patterns and examples fill in the architectural and design details to complete core portions of the case study.
The case study introduced in this chapter is the P.T. Monday Coffee Company. The company roasts and delivers coffee beans to individuals and restaurants . The P.T. Monday Coffee Company exists as a part of a value chain. The end of the value chain for direct customers is the delivery of the beans to the customer. The P.T. Monday Coffee Company owns the entire value chain and leverages other companies to fulfill portions of the chain. For a restaurant purchasing beans, the end of the value chain is actually the purchase of a cup of coffee by a customer. In this case, a large portion of the value chain actually exists outside of the company, and the P.T. Monday Coffee Company merely enables a portion of the value chain that the restaurant originates.
Your goal will be to get the P.T. Monday Coffee Company "online" as efficiently as possible and support the company's vision. In building the online system, you want to create room for flexibility within the application. For example, the P.T. Monday Coffee Company today uses a single shipper for all orders; there are many reasons that shipping decisions should be more dynamic than this. Instead of creating a static shipping decision, you will use the Service Factory pattern to ensure the application is flexible enough to withstand different decisions in shipping that occur after completing the application.
It is important in any architecture to start with a vision. In this case, you need to understand the vision of where the company should be within the next five years . You also need to gather the proper functional and nonfunctional requirements and start fulfilling them with the architecture and design process. This chapter covers the common architecture patterns that the system uses.