|
Patterns of Enterprise Application Architecture
Preface.
Who this Book is for.
Acknowledgements.
Colophon.
Introduction.
Architecture.
Enterprise Applications.
Kinds of Enterprise Application.
Thinking About Performance.
Patterns.
Limitations of These Patterns.
I. THE NARRATIVES.
Layering.
Evolution
of Layers in Enterprise Applications.
The Three Principal Layers.
Choosing Where to Run Your Layers.
Organizing Domain Logic.
Making a Choice.
Service Layer.
Mapping to Relational Databases.
Architectural Patterns.
The Behavioral Problem.
Reading in Data
Structural Mapping Patterns.
Going about Building the Mapping.
Using Metadata.
Database Connections.
Some Miscellaneous Points.
Further Reading.
Web Presentation.
View Patterns.
Input Controller Patterns.
Further Reading.
Concurrency.
Concurrency Problems.
Execution Contexts.
Isolation and Immutability.
Optimistic and Pessimistic Concurrency Control.
Transactions.
Patterns for Offline Concurrency Control.
Application Server Concurrency.
Further Reading.
Session State.
The Value of Statelessness.
Session State.
Ways to Store Session State.
Distribution Strategies.
The Allure of Distributed Objects.
Remote and Local Interfaces.
Where you Have to Distribute.
Working with the Distribution Boundary.
Interfaces for Distribution.
Putting it all Together.
Starting With the Domain Layer.
Down to the Data Source.
Some Technology Specific Advice.
Other Layering schemes.
II. The Patterns.
Domain Logic Patterns.
Transaction Script.
How it Works.
When to Use It.
The Revenue Recognition Problem.
Example: Revenue Recognition (Java).
Domain Model.
How it Works.
When to Use It.
Further Reading.
Example: Revenue Recognition (Java).
Table Module.
How it Works.
When to Use It.
Example: Revenue Recognition with a Table Module (C#).
Service Layer.
How it Works.
When to Use It.
Further Reading.
Example: Revenue Recognition (Java).
Data Source Architectural Patterns.
Table Data Gateway.
How it Works.
When to Use It.
Further Reading.
Example: Person Gateway (C#).
Example: Using ADO.NET Data Sets (C#).
Row Data Gateway.
How it Works.
When to Use It.
Example: A Person Record (Java).
Example: A data Holder for a Domain Object (Java).
Active Record.
How it Works.
When to Use It.
Example: A Simple Person (Java).
Data Mapper.
How it Works.
When to Use It.
Example: A Simple Database Mapper (Java).
Example: Separating the Finders (Java).
Example: Creating an Empty Object (Java).
Object-Relational Behavioral Patterns.
Unit of Work.
How it Works.
When to Use It.
Example: Unit of Work with Object Registration (Java).
Identity Map.
How it Works.
When to Use It.
Example: Methods for an Identity Map (Java).
Lazy Load.
How it Works.
When to Use It.
Example: Lazy Initialization (Java).
Example: Virtual Proxy (Java).
Example: Using a Value Holder (Java).
Example: Using Ghosts (C#).
Object-Relational Structural Patterns.
Identity Field.
How it Works.
When to Use It.
Further Reading.
Example: Integral Key (C#).
Example: Using a Key Table (Java).
Example: Using a Compound Key (Java).
Foreign Key Mapping.
How it Works.
When to Use It.
Example: Single Valued Reference (Java).
Example: Multi-Table Find (Java).
Example: Collection of References (C#).
Association Table Mapping.
How it Works.
When to Use It.
Example: Employees and Skills (C#).
Example: Using Direct SQL (Java).
Example: Using a Single Query for Multiple Employees (Java).
Dependent Mapping.
How it Works.
When to Use It.
Example: Albums and Tracks (Java).
Embedded Value.
How it Works.
When to Use It.
Further Reading.
Example: Simple Value Object (Java).
Serialized LOB.
How it Works.
When to Use It.
Example: Serializing a Department Hierarchy in XML (Java).
Single Table Inheritance.
How it Works.
When to Use It.
Example: A Single Table for Players (C#).
Class Table Inheritance.
How it Works.
When to Use It.
Further Reading.
Example: Players and Their Kin (C#).
Concrete Table Inheritance.
How it Works.
When to Use It.
Example: Concrete Players (C#).
Inheritance Mappers.
How it Works.
When to Use It.
Object-Relational Metadata Mapping Patterns.
Metadata Mapping.
How it Works.
When to Use It.
Example: Using Metadata and Reflection (Java).
Query Object.
How it Works.
When to Use It.
Further Reading.
Example: A Simple Query Object (Java).
Repository.
How it Works.
When to Use It.
Further Reading.
Example: Finding a Person's dependents (Java).
Example: Swapping Repository Strategies (Java).
Web Presentation Patterns.
Model View Controller.
How it Works.
When to Use It.
Page Controller.
How it Works.
When to Use It.
Example: Simple Display with a Servlet Controller and a JSP View (Java).
Example: Using a JSP as a Handler (Java).
Example: Page Handler with a Code Behind (C#).
Front Controller.
How it Works.
When to Use It.
Further Reading.
Example: Simple Display (Java).
Template View.
How it Works.
When to Use It.
Example: Using a JSP as a View with a Separate Controller (Java).
Example: ASP.NET Server Page (C#).
Transform View.
How it Works.
When to Use It.
Example: Simple Transform (Java).
Two Step View.
How it Works.
When to Use It.
Example: Two Stage XSLT (XSLT).
Example: JSP and Custom Tags (Java).
Application Controller.
How it Works.
When to Use It.
Further Reading.
Example: State Model Application Controller (Java).
Distribution Patterns.
Remote Facade.
How it Works.
When to Use It.
Example: Using a Java Session Bean as a Remote Facade (Java).
Example: Web Service (C#).
Data Transfer Object.
How it Works.
When to Use It.
Further Reading.
Example: Transferring Information about Albums (Java).
Example: Serializing Using XML (Java).
Offline Concurrency Patterns.
Optimistic Offline Lock.
How it Works.
When to Use It.
Example: Domain Layer with Data Mappers (187) (Java).
Pessimistic Offline Lock.
How it Works.
When to Use It.
Example: Simple Lock Manager (Java).
Coarse-Grained Lock.
How it Works.
When to Use It.
Example: Shared Optimistic Offline Lock (441) (Java).
Example: Shared Pessimistic Offline Lock (451) (Java).
Example: Root Optimistic Offline Lock (441) (Java).
Implicit Lock.
How it Works.
When to Use It.
Example: Implicit Pessimistic Offline Lock (451) (Java).
Session State Patterns.
Client Session State.
How it Works.
When to Use It.
Server Session State.
How it Works.
When to Use It.
Database Session State.
How it Works.
When to Use It.
Base Patterns.
Gateway.
How it Works.
When to Use It.
Example: A Gateway to a Proprietary Messaging Service (Java).
Mapper.
How it Works.
When to Use It.
Layer Supertype.
How it Works.
When to Use It.
Example: Domain Object (Java).
Separated Interface.
How it Works.
When to Use It.
Registry.
How it Works.
When to Use It.
Example: A Singleton Registry (Java).
Example: Thread Safe Registry (Java).
Value Object.
How it Works.
When to Use It.
Money.
How it Works.
When to Use It.
Example: A Money Class (Java).
Special Case.
How it Works.
When to Use It.
Further Reading.
Example: A Simple Null Object (C#).
Plugin.
How it Works.
When to Use It.
Example: An Id Generator (Java).
Service Stub.
How it Works.
When to Use It.
Example: Sales Tax Service (Java).
Record Set.
How it Works.
When to Use It.
|