Chapter 6. Struts Model Components
This chapter introduces the components that make up the model portion of a Struts application. The model represents the business data for an application and should closely resemble the real-world entities and business processes for the organization. In this chapter, we’ll explore the roles and responsibilities of the model components within the Struts framework and focus on building an architecturally correct implementation for the Storefront application. Special attention will be given to using a persistence framework that can easily and effortlessly be integrated into a Struts application.
The “M” in MVC
The model components of an application arguably are the most valuable software artifacts to an organization. The model includes the business entities and the rules that govern access to and modification of the data. It’s vital that this be kept in a single location in order to maintain valid data integrity, reduce redundancy, and increase reusability.
The model should remain independent of the type of client that’s being used to access the business objects and their associated rules. In fact, the components within the model should not be aware of what type of client or framework is using it. There’s an axiom that goes, “Dependencies go down, data goes up.” The idea is that when using a layered architecture, the upper layer may have dependencies on lower layers, but the lower layers should not depend on the layers above them. Figure 6-1 illustrates ...