Analysis Patterns


By: M. Fowler
Published in: Addison-Wesley, 1997

Summary: Analysis that reflects conceptual structures of business processes rather than actual software implementations. Patterns for various business domains.

Category: Analysis

Pattern: Party

Pages: 18-19

Define a party object as a supertype for a person or an organization. This allows relationships to be established between a person or an organization by relating to a party.

Category: Analysis, Business Process

Pattern: Organization Hierarchies

Pages: 19-20

Model organizational hierarchies with a recursive structure. Enforce relationships between organizational entities with rules. It's easier to change rules than to change the model.

Category: Analysis, Business Process, System Modelling

Pattern: Organization Structure

Pages: 21-22

Use types to define relationships between organizational entities.

Category: Analysis, Business Process

Pattern: Accountability

Pages: 22-24

Abstract responsibilities of people or organizations to an accountability entity.

Category: Analysis, Business Process

Pattern: Accountability Knowledge Level

Pages: 24-27

Separate an organizational model into operational and knowledge levels. The operational level comprises accountability, party, and their interrelationships. The knowledge level comprises accountability type, party type, and their interrelationships. At the operational level, the model records day-to-day events. At the knowledge level, the model records general rules that govern the structure. Some data modelers call the knowledge level a "meta level."

Category: Analysis, Business Process, System Modelling

Pattern: Party Type Generalizations

Pages: 27-28

Allow party types to have sub- and supertype relationships.

Category: Analysis, Business Process, Health Care

Pattern: Hierarchic Accountability

Pages: 28-30

Create a hierarchic accountability type that captures the responsibility of parties in a hierarchy.

Category: Analysis, Business Process

Pattern: Operating Scope

Pages: 30-32

Accountability has a number of operating scopes, each of which is a subtype that describes the actual characteristics.

Category: Analysis, Business Process, Health Care

Pattern: Post

Pages: 32-33

Introduce a post type that contains the responsibilities of a position. This allows job responsibilities to be attached to the post, not the person. This should only be used when there are significant responsibilities that are static, and people change posts often.

Category: Analysis, Business Process, Health Care

Pattern: Quantity

Pages: 36-38

Define an object type that comprises a number and units.

Category: Analysis

Pattern: Conversion Ratio

Pages: 38-39

Define a conversion ratio object between units, and give Quantity an operation, convertTo(Unit), that returns a new quantity in the unit.

Category: Analysis

Pattern: Compound Units

Pages: 39-41

A compound unit is a combination of atomic units, e.g., meters per second. A sophisticated conversion operation can use Conversion Ratio on atomic units to convert compound units. Compound Units must know the atomic units and their powers or relationships.

Category: Analysis

Pattern: Measurement

Pages: 41-42

If a large number of possible measurements would make the interface for a person object too complex, define a phenomenon object. A person would then have one attribute for all measurements. Attributes could be added to a measurement, e.g., who took the measurement and when.

Category: Analysis, Health Care

Pattern: Observation

Pages: 42-46

Some attributes are qualitative, e.g., blood group, whether a patient has diabetes. Define an observation type that links the object to a phenomenon. Each phenomenon is a value for some phenomenon type.

Category: Analysis, Health Care

Pattern: Subtyping Observation Concepts

Pages: 46

Some phenomena are special cases of another phenomenon. Define an observation type that links the object to a phenomenon. Each phenomenon is a value for some phenomenon type.

Category: Analysis, Health Care

Pattern: Protocol$$$1

Pages: 46-47

The method of observing can occasionally cause different interpretations when dealing with similar phenomena. Record the protocol used in a protocol object.

Category: Analysis, Business Planning, Health Care

Pattern: Dual Time Record

Pages: 47-48

An Observation may have a limited period during which it can be applied, so use two time records for each observation, one when the observation is applicable and one when it is recorded.

Category: Analysis, Health Care, Time

Pattern: Rejected Observation

Pages: 48

Sometimes mistakes are made when an Observation is made. This record must be kept but it can be linked to an observation that replaces it.

Category: Analysis, Health Care

Pattern: Active Observation, Hypothesis, and Projection

Pages: 49-50

As observations are recorded, levels of assurance are reached. An active observation is the one currently adopted; a hypothesis requires further testing. Projections are observations that might be seen in the future.

Category: Analysis, Health Care

Pattern: Associated Observation

Pages: 50-51

To record the chain of evidence behind a diagnosis, treat the diagnosis as an Observation with an association to the observations used in evidence.

Category: Analysis, Health Care

Pattern: Process of Observation

Pages: 51-55

A clinician makes an Observation and considers an Associated Observation. The clinician proposes further observations and interventions as needed as well as reevaluation of contradictory observations. As these steps produce further observations, this leads to a continuous process of observation.

Category: Analysis, Health Care

Pattern: Enterprise Segment

Pages: 59-65

To decompose a large enterprise using different criteria for different segments with varying degrees of granularity, define each decomposition criterion as a dimension, and represent it as a hierarchy of elements. Define an enterprise segment as the combination of one element from each dimension.

Category: Analysis, Business Planning

Pattern: Measurement Protocol

Pages: 65-76

Corporate analysis involves measurement. Measurements are usually read from a database or calculated. Define a measurement protocol type so that this information is not lost.

Category: Analysis, Business Computation

Pattern: Range

Pages: 76-77

To make sense of a collection of data, you can group measurements into categories. Describe ranges of measurements. Then use Phenomenon with Range. Define a range type with upper and lower bounds and suitable operations.

Category: Analysis, Business Computation

Pattern: Phenomenon with Range

Pages: 77-81

Give a phenomenon an attribute of range, or create a range function that links the range to the phenomenon under conditions described by other phenomena.

Category: Analysis, Business Computation

Pattern: Name

Pages: 86-87

Give an object a string as its identifier.

Category: Design Process

Pattern: Identification Scheme

Pages: 88-89

In simple systems there is usually a single identifier for each object, while complex systems may have many identifiers for one object. Define schemes so each identifier refers to only one unit. An identifier then refers to only one object but different parties can refer to the object differently.

Category: Design Process

Pattern: Object Merge

Pages: 90-92

In a complex system, two objects may be considered the same. To avoid redundancy: (1) Copy the attributes of the first to the second, switch all references from the first to the second, and then delete the first. (2) Mark the first as superseded and give it a link to the second. (3) Link the two object appearances with an essence that indicates they are the same.

Category: Design Process, Health Care

Pattern: Object Equivalence

Pages: 92-93

Some people think two objects are the same but others may think they are different. Create an equivalence relationship for the two objects.

Category: Design Process, Health Care

Pattern: Account

Pages: 97-98

When you're recording a history of changes to some quantity, create an account object. Each change is recorded as an entry against the account. The balance of the account gives the current value.

Category: Accounting, Inventory Control Systems

Pattern: Transaction

Pages: 98-101

You're using Account to record the history of changes to some quantity and must check that entries do not get lost. Entries withdrawn from one account must be deposited in another. Entries cannot be created or destroyed. "Two-legged" transactions move an entry from one account to another, while "multi-legged" allow entries in several accounts as long as the complete transaction balances.

Category: Accounting, Inventory Control Systems

Pattern: Summary Account

Pages: 101-103

Accounts can be grouped. Create a summary account object with the other accounts as children.

Category: Accounting, Inventory Control Systems

Pattern: Memo Account

Pages: 103-104

Sometimes account entries are not intended to balance. Allow a quantity to be stored in a side account without using a transaction. Create a memo account that does not affect real transactions and does not hold real entries.

Category: Accounting, Inventory Control Systems

Pattern: Posting Rules

Pages: 104-105

To automate transfers between accounts, define posting rules. This allows the building of active networks of accounts that update each other and reflect business rules.

Category: Accounting, Inventory Control Systems

Pattern: Individual Instance Method

Pages: 106-111

To attach methods to instances, use Singleton [Gamma+95], Strategy [Gamma+95], a case statement, an interpreter, or a parameterized method.

Category: Accounting, Inventory Control Systems

Pattern: Posting Rule Execution

Pages: 111-115

Separate the strategy of firing the posting rules from the rules themselves. Use: (1) Eager Firing, where rules are fired when a suitable entry is made in a trigger account; (2) give the Account the responsibility for firing the rules; (3) let an external agent be responsible for firing the rule; or (4) give accounts responsibility for firing their rules and the rules for all dependent accounts.

Category: Accounting, Inventory Control Systems

Pattern: Posting Rules for Many Accounts

Pages: 116-118

Use Accountability Knowledge Level where posting rules for more than one Account are linked to account types, or define a posting rule on a Summary Account

Category: Accounting, Inventory Control Systems

Pattern: Choosing Entries

Pages: 118-119

Posting Rules may need a subset of entries from its trigger Account. This can be done by: (1) having the account return all entries and selecting the required subset; (2) defining a method that selects the subset; or (3) using a filter--an object that encapsulates the query.

Category: Accounting, Inventory Control Systems

Pattern: Accounting Practice

Pages: 119-122

A network of accounts with Posting Rules can become too complex. Define an accounting practice to be a subset of the network posting rules. Each account is assigned an accounting practice for a given function.

Category: Accounting, Inventory Control Systems

Pattern: Sources of an Entry

Pages: 122-123

Each transaction should know which posting rule created it and which entries were input. This pattern forms a chain of entries and transactions across the network.

Category: Accounting, Inventory Control Systems

Pattern: Balance Sheet and Income Statement

Pages: 123-124

When you're using Account to describe a system, distinguish between the balance sheet and income statement accounts.

Category: Accounting, Inventory Control Systems

Pattern: Corresponding Account

Pages: 124-125

Two parties may have different views of the same Account. Treat the views as separate accounts that correspond to each other.

Category: Accounting, Inventory Control Systems

Pattern: Specialized Account Model

Pages: 125-127

The general accounting patterns can be used for a domain by subtyping the patterns' types.

Category: Accounting, Inventory Control Systems

Pattern: Booking Entries to Multiple Accounts

Pages: 127-131

There may be more than one Account for an entry. (1) Treat one account as the real account and use Memo Account for the other. (2) Treat one account as the real account and use a derived account for the other.

Category: Accounting, Inventory Control Systems

Pattern: Proposed and Implemented Action

Pages: 158-160

Divide the possible states of a planned action into two subtypes: the intention and what actually happened.

Category: Business Planning, Health Care, Time

Pattern: Completed and Abandoned Actions

Pages: 160-161

Describe the end of an action as "completed" or "abandoned."

Category: Business Planning, Health Care

Pattern: Suspension

Pages: 161-162

When an action is deferred, link a suspension object to the action.

Category: Business Planning, Health Care

Pattern: Plan

Pages: 162-164

A plan is a collection of proposed actions linked in some sequence.

Category: Business Planning, Health Care

Pattern: Protocol$$$2

Pages: 165-168

Actions can be carried out according to a standard operating procedure, or protocol. A protocol can be divided into subprotocols linked by dependencies.

Category: Analysis, Business Planning, Health Care

Pattern: Resource Allocation

Pages: 168-172

In planning, a resource requirement is specified at a general level; then in the execution of the plan, a specific instance is allocated.

Category: Business Planning, Health Care

Pattern: Outcome and Start Functions

Pages: 172-174

Outcome and start functions link a protocol to the observation concepts that trigger it and may be the result of it.

Category: Business Planning, Health Care

Pattern: Contract

Pages: 176-180

Describe each trade with a contract for buying or selling goods.

Category: Trading

Pattern: Portfolio

Pages: 180-184

A portfolio is a collection of Contract objects.

Category: Trading

Pattern: Quote

Pages: 185-188

A quote represents two numbers: the buying price (the bid) and the selling price (the offer).

Category: Trading

Pattern: Scenario

Pages: 188-196

Prices change over time. A scenario is a collection of Quote objects that represent the state of the market at a point in time.

Category: Trading

Pattern: Forward Contracts

Pages: 198-200

A forward contract is an agreement to do a deal some time in the future. It represents separate trade and delivery dates for the Contract

Category: Trading

Pattern: Options

Pages: 200-205

An option gives the holder the right to buy currency at a prearranged exchange rate if the holder wishes. Define option to be a subtype of Contract, or define option as a separate object with a contract as an attribute.

Category: Trading

Pattern: Product

Pages: 205-211

A combination option is seen as one item by the seller and as a collection of simpler contracts internally (or by the dealers). Define what the seller sells as a product and what is internally valued as a Contract

Category: Trading

Pattern: Subtype State Machines

Pages: 211-216

A barrier option has different behaviors from an option and so seems to be a subtype of option. Ensure that both sub- and supertype objects respond to the same events.

Category: Trading

Pattern: Parallel Application and Domain Hierarchies

Pages: 216-223

When displaying a list of objects of various types, some properties should not be displayed. The user interface objects must not send messages to inappropriate objects: (1) check the type of the object before the message is sent; (2) provide a supertype interface that encompasses all subtype behaviors; (3) treat the properties as a run-time attribute; (4) use an intermediate object loaded by the user interface; or (5) raise an exception.

Category: Trading

Pattern: Multiple Access Levels to a Package

Pages: 226-230

Different clients of a package need different amounts of behavior. (1) Split the package into separate packages or (2) allow packages to have more than one interface.

Category: Trading

Pattern: Mutual Visibility

Pages: 230-233

Types in two packages need to see each other. (1) Combine the two packages, (2) have two mutually visible packages, or (3) do not allow one type to see the other.

Category: Trading

Pattern: Subtyping Packages

Pages: 233-234

When a subtype is used with a package, the subtype can be in a separate package. The subtype is visible to the supertype but not vice versa.

Category: Trading

Pattern: Two-Tier Architecture

Pages: 240-242

In client-server applications, partition the system into a shared database that sits on a server and several clients with interfaces that allow direct access to the data.

Category: Analysis, Architectural, Client-Server

Pattern: Three-Tier Architecture

Pages: 242-245

In a Two-Tier Architecture, the user interface is tightly coupled to the database. Partition the system into three logical layers: application, domain, and database.

Category: Analysis, Architectural

Pattern: Presentation and Application Logic

Pages: 245-251

The application layer in Three-Tier Architecture has two responsibilities. Separate the application layer into presentation (user interface) and application logic. Structure the application layer as a set of Facade [Gamma+95] objects for the presentation subsystem.

Category: Analysis, Architectural

Pattern: Database Interaction

Pages: 251-255

You're using Three-Tier Architecture. Let domain classes be responsible for saving themselves in the database or create a separate layer to handle the interactions between the domain layer and the database.

Category: Analysis, Architectural

Pattern: Implementing Associations

Pages: 274-281

(1) Choose one direction in an association to implement, and use an operation and a pointer. (2) Put operations and pointers in both directions. (3) Put operations in both directions but a pointer only in one. Use lookup for the other direction or (4) put operations in both directions and use a table and lookup for the pointers.

Category: Design Process

Pattern: Implementing Generalizations

Pages: 281-288

(1) Use inheritance. (2) Use classes for each combination of subtypes with multiple inheritance. (3) Use an internal flag. (4) Delegate to a hidden class, State [Gamma+95] or (5) copy and replace.

Category: Design Process

Pattern: Object Creation

Pages: 289

Use a creation method with arguments for all mandatory and immutable mappings.

Category: Design Process

Pattern: Object Destruction

Pages: 290-291

Define a destruction method and define how far the method should cascade.

Category: Design Process

Pattern: Entry Point

Pages: 291-294

How can objects of a type be located? Let the class store and retrieve its instances, or define a registrar to do this.

Category: Design Process

Pattern: Implementing Constraints

Pages: 294

Define an operation in each object to check its constraints. Call it at the end of modifiers when debugging.

Category: Design Process

Pattern: Associative Type

Pages: 298-301

Create an associative type when you want to treat an association as a separate type.

Category: Design Process

Pattern: Keyed Mapping

Pages: 301-303

Use a lookup table or dictionary to implement relationships.

Category: Design Process

Pattern: Historic Mapping

Pages: 303-307

Objects do not just represent objects that currently exist; they often represent the memories of objects that once existed but have since disappeared. Use a dictionary implementation with time period keys.

Category: Design Process, Time