Enterprise Application Patterns - Computer Science and Engineering

4 downloads 562 Views 408KB Size Report
Mar 2, 2007 ... What are the drivers and tradeoffs? • What technologies to select? • Fowler: Patterns of Enterprise Application Architecture, Addison. Wesley ...
Enterprise Application Patterns

Ingolf H. Krueger

Department of Computer Science & Engineering University of California, San Diego La Jolla, CA 92093-0404, USA

California Institute for Telecommunications and Information Technologies La Jolla, CA 92093-0405, USA

Typical Business Information System

Client Devices

Presentation & Content

Appliances

Client Tier

Web Server

Presentation Tier

App Server Business Processing

Data Management

Business Tier

Info Server

Information Tier adapted from [M05]

March 2, 2007

© Ingolf H. Krueger

CSE

2

Enterprise Application Patterns • How to build and integrate layers: – Client (access devices) – Presentation (handling of client requests) – Domain (application logic) – Data (databases, other data sources)

• What alternative approaches exist? • What are the drivers and tradeoffs? • What technologies to select? • Fowler: Patterns of Enterprise Application Architecture, Addison Wesley, 2003

March 2, 2007

© Ingolf H. Krueger

CSE

3

Enterprise Application Patterns

Domain Logic: • • • •

Transaction Script Domain Model Table Module Service Layer

adapted from [F03] March 2, 2007

© Ingolf H. Krueger

CSE

4

Example: Domain Model

Data Mapper

Data Store

Selection Made

Init

Add to Cart

Checkout

Application Server

March 2, 2007

© Ingolf H. Krueger

CSE

5

Enterprise Application Patterns

Presentation:

adapted from [F03] March 2, 2007

• • • • •

MVC Page/Front Controller Template/Two Step View Application Controller …

© Ingolf H. Krueger

CSE

6

Example: Page Controller

• handle HTTP get/post • select model/view

servlet JSP

Selection Made

Init

display HTTP

Add to Cart

Checkout

Application Server adapted from [F03] March 2, 2007

© Ingolf H. Krueger

CSE

7

Enterprise Application Patterns adapted from [F03]

Data Access: • • • • • •

Table/Row Data Gateway Active Record Data Mapper Unit of Work Identity Map Lazy Load March 2, 2007

• • • • • •

Identity Field Foreign Key Mapping Association Table Mapping Dependent Mapping Embedded Value Lazy Load © Ingolf H. Krueger

• Serialized LOP • Single/ Class/ Concrete Table Inheritance • Inheritance Mappers CSE

8

Enterprise Application Patterns

Data Access: • Metadata Mapping • Query Object • Repository adapted from [F03] March 2, 2007

© Ingolf H. Krueger

CSE

9

Example: Data Mapper

Data Store

Application Server

Data Mapper adapted from [F03]

March 2, 2007

© Ingolf H. Krueger

CSE

10

Enterprise Application Patterns adapted from [F03]

Distribution, Concurrency, State: • Remote Facade • Data Transfer Object

• Optimistic/Pessimistic Offline Lock • Coarse Grained/Implicit Lock

• Client/Server/Database Session State March 2, 2007

© Ingolf H. Krueger

CSE

11

Enterprise Application Patterns adapted from [F03]

Base: • • • •

Gateway Mapper Layer Supertype Separated Interface

March 2, 2007

• • • •

Registry Value Object Money Special Case

© Ingolf H. Krueger

• Plugin • Service Stub • Record Set

CSE

12

Configuration Example: Simple Application

Transaction Script MVC with Two Step View or Application Controller

March 2, 2007

© Ingolf H. Krueger

Table Data Gateway

CSE

13

Configuration Example: Complex Application

Domain Model Service Layer MVC Data Mapper Metadata Mapper

March 2, 2007

© Ingolf H. Krueger

CSE

14

Archetype Example: Person (partial) adapted from [AN03]

March 2, 2007

© Ingolf H. Krueger

CSE

15

Archetype Example: PartyRole (partial) adapted from [AN03]

March 2, 2007

© Ingolf H. Krueger

CSE

16

Archetype Example: ProductCatalog (partial) ProductCatalog

adapted from [AN03]

1 0..* CatalogEntry

0..* 1..* 1

1..*

1

mandatory

ProductType

ProductIdentifier

0..*

1..*

optional 0..*

ProductFeature Type

1

0..* SerialNumber

March 2, 2007

1 0..1

ProductInstance

ProductFeatureInstance

1 © Ingolf H. Krueger

1..* CSE

17

Example: Party – Role – Relationship – Policy Model* * courtesy of Matthew Arrott; adapted from [AN03]

March 2, 2007

© Ingolf H. Krueger

CSE

18