Semantic Analysis Patterns
An analysis pattern is a set of classes and associations that have some meaning in the context of an application; that is, it is a conceptual model of a part of the application. However, the same structure may be valid for other applications, and this aspect makes analysis patterns very
Analysis patterns can be atomic or composite [Riehle1997]. Analysis patterns have been studied in [Cook+1994] and [Fowler1997], inspired by the work of Hay [Hay1996]. In particular, the analysis patterns discussed in these references are atomic patterns,
We have proposed a type of composite pattern that we call Semantic Analysis Patterns. An SAP is a minimal application that corresponds to a few basic use cases and defines a semantic unit that can be combined with other SAPs to build complex systems. The use cases are selected in such a way that the pattern can be applied to a variety of applications. We have developed several SAPs, including patterns for inventories [Fernandez2000B], for reservation and use of reusable entities [Fernandez+1999], for order processing [Fernandez+2000A], and others. |
Development of SAPs
SAPs are based on well-known principles such as abstraction, composition, minimal coupling, and regularity. They also
Abstraction
Abstraction is the most fundamental principle of the object-oriented approach. It implies including only the essential aspects of a model, leaving out details that are not relevant or needed. We illustrate this concept with a basic model for an inventory system for discrete items. Its basic functions can be summarized as
The most basic inventory model just keeps track of the quantities of some type of item in stock (see Figure 47.1). The items in this inventory can be finished products,
Figure 47.1. A basic inventory system
Figure 47.2. Distribution of items
We can consider the diagrams shown in Figures 47.1 and 47.2 to be atomic analysis patterns. They describe two abstractions that
Each stage of XP typically implements one or two of these use cases or stories. DecompositionTo be able to model a complex system, we need to apply decomposition, the divide-and-conquer principle. For example, a manufacturing system is far too complex to handle as a single unit. A decomposition for this system would consist of a set of UML packages such as Inventory Control, Shop Orders, Customer Orders, Shipping, and Money. The interactions between packages are important to define the needed operations in the classes of each package. Decomposition is very important for XP; each stage implies an explicit or implicit decomposition of the requirements. Composition
Patterns can be
Figure 47.3. Authorized inventory
Projection
Projection is the combination of different diagrams or views of the system to provide a more complete picture. It can be likened to the need to describe a mechanical piece using different views, or projections; a single view would give a
Minimal Coupling
This principle is frequently used in design patterns, in which a main objective is flexibility [Gamma+1995]. It is also heavily used in Fowler's analysis patterns [Fowler1997]. The idea is to separate some aspects to enable them to
In the example, if we had a detailed description of the structure of items, we could use the Composite pattern [Gamma+1995] to describe this structure recursively. This would decouple the structural aspects of a component or product from more basic aspects. We could also decouple other aspects of the item description. Precision
A model such as the one shown in Figure 47.1 may not be precise enough to represent some of the constraints in the requirements. For example, to
{sum of quantities must be constant}
However, this is not precise enough for many cases. If we had more complex constraints, statements of this form may be ambiguous. This ambiguity cannot be tolerated in safety-critical applications, for example. Both Z [Cook+1994] and OCL [Wanner+1998] have been used to add precision to UML constraints. A comparison of Z and OCL as constraint languages is given in [Jiang+1999]. AuthorizationWhen we build systems using atomic patterns or SAPs, we know the actor roles in the use cases that correspond to these units. These actors need specific rights to perform the functions defined in the use case. We can then define authorization rules according to the principles of Role-Based Access Control (RBAC) [Fernandez+1997]. For example, in the inventory, we could include the authorizations shown in Figure 47.3, where classes such as StockManager indicate roles (denoted by the UML stereotype <<role>> ). For example, in Figure 47.3 the InventoryManager is authorized to transfer stock between locations. Testability
Use cases (or
|