65
Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September 23, 2010

Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Embed Size (px)

Citation preview

Page 1: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Design I: Web Application Architecture and Patterns

Peter Dologdolog [at] cs [dot] aau [dot] dk2.2.05Intelligent Web and Information SystemsSeptember 23, 2010

Page 2: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

This Lecture

IS Architecture for the Web, MVCModel PatternsView PatternsController Patterns

2Peter Dolog, Web Engineering, Design I

Page 3: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

3Peter Dolog, Web Engineering, Design I

Historical Perspective

presentation layer

resource management

layer

application logic layer

client

info

rmat i

on

syste

m

1. define access channelsand client platforms

2. define presentation formats and protocols forthe selected clients andprotocols

3. define the functionalitynecessary to deliver thecontents and formats neededat the presentation layer

4. define the data sourcesand data organization neededto implement the applicationlogic

top-down design

Copyright Springer Verlag Berlin Heidelberg 2004

Page 4: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

4Peter Dolog, Web Engineering, Design I

clientpresentatio

n layer

resource management

layer

application logic layer

info

rmat i

on

syste

m

3-tier architecture

middleware

Copyright Springer Verlag Berlin Heidelberg 2004

Page 5: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

5Peter Dolog, Web Engineering, Design I

client

resource management

layer

application logic layer

info

rmat i

on

syste

m

N-tier architecture

middleware

presentationlayer

Web server

Web browser

HTML filter

Copyright Springer Verlag Berlin Heidelberg 2004

Page 6: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Model-View-Controller

6Peter Dolog, Web Engineering, Design I

Model

View Controller

Page 7: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Model

Page 8: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Domain Model

8Peter Dolog, Web Engineering, Design I

Page 9: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Database

9Peter Dolog, Web Engineering, Design I

Page 10: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Model as a Transaction Script

10Peter Dolog, Web Engineering, Design I

Page 11: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Structuring Domain Model: Analysis Patterns

11Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Analysis Patterns

Page 12: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

12Peter Dolog, Web Engineering, Design I

Accountability

A relationship of responsibility between responsee and responsible

Organizational structuresEmploymentsContracts

Page 13: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

13Peter Dolog, Web Engineering, Design I

Address Book (C) Martin Fowler: Analysis Patterns

Page 14: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

14Peter Dolog, Web Engineering, Design I

Party

(C) Martin Fowler: Analysis Patterns

Page 15: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

15Peter Dolog, Web Engineering, Design I

Organization Structure with Explicit Levels

(C) Martin Fowler: Analysis Patterns

Page 16: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

16Peter Dolog, Web Engineering, Design I

Organization Supertype

(C) Martin Fowler: Analysis Patterns

Page 17: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

17Peter Dolog, Web Engineering, Design I

Two organizational hierarchies

(C) Martin Fowler: Analysis Patterns

Page 18: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

18Peter Dolog, Web Engineering, Design I

Typed Relationships

(C) Martin Fowler: Analysis Patterns

Page 19: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

19Peter Dolog, Web Engineering, Design I

Rules (C) Martin Fowler: Analysis Patterns

Page 20: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

20Peter Dolog, Web Engineering, Design I

Accountability

(C) Martin Fowler: Analysis Patterns

Page 21: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

21Peter Dolog, Web Engineering, Design I

Knowledge and operational levels

(C) Martin Fowler: Analysis Patterns

Page 22: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

22Peter Dolog, Web Engineering, Design I

Party Type Generalizations

(C) Martin Fowler: Analysis Patterns

Page 23: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

23Peter Dolog, Web Engineering, Design I

Hierarchic Accountability Type

(C) Martin Fowler: Analysis Patterns

Page 24: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

24Peter Dolog, Web Engineering, Design I

Leveled Accountability Type

(C) Martin Fowler: Analysis Patterns

Page 25: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

25Peter Dolog, Web Engineering, Design I

Subtypes of Acountability Types

(C) Martin Fowler: Analysis Patterns

Page 26: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

26Peter Dolog, Web Engineering, Design I

Operating Scopes

(C) Martin Fowler: Analysis Patterns

Page 27: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

27Peter Dolog, Web Engineering, Design I

Accounting

Tracing how money move througout the companyTacking of earnings and expendituresPosts of money and goods to record – entries

Page 28: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

28Peter Dolog, Web Engineering, Design I

Account (C) Martin Fowler: Analysis Patterns

Page 29: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

29Peter Dolog, Web Engineering, Design I

A Transaction with Two Entries

(C) Martin Fowler: Analysis Patterns

Page 30: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

30Peter Dolog, Web Engineering, Design I

Instance Example

(C) Martin Fowler: Analysis Patterns

Page 31: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

31Peter Dolog, Web Engineering, Design I

Multiledged Transactions

(C) Martin Fowler: Analysis Patterns

Page 32: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

32Peter Dolog, Web Engineering, Design I

2-legged transaction without entries

(C) Martin Fowler: Analysis Patterns

Page 33: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

33Peter Dolog, Web Engineering, Design I

Summary and Detail Accounts

(C) Martin Fowler: Analysis Patterns

Page 34: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

34Peter Dolog, Web Engineering, Design I

Account hierarchies without separating summary and detail accounts

(C) Martin Fowler: Analysis Patterns

Page 35: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

35Peter Dolog, Web Engineering, Design I

Posting Rules Multiplied by a Factor or a method to calculate an entry

(C) Martin Fowler: Analysis Patterns

Page 36: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

36Peter Dolog, Web Engineering, Design I

Individual Instance Methods with Singletons

(C) Martin Fowler: Analysis Patterns

Page 37: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

37Peter Dolog, Web Engineering, Design I

Implementation with Strategy Pattern

(C) Martin Fowler: Analysis Patterns

Page 38: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

38Peter Dolog, Web Engineering, Design I

Implementation with Internal Case Statement

(C) Martin Fowler: Analysis Patterns

Page 39: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

39Peter Dolog, Web Engineering, Design I

Implementation with Parametrized Method

(C) Martin Fowler: Analysis Patterns

Page 40: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

40Peter Dolog, Web Engineering, Design I

Posting Rules for Many Accounts

(C) Martin Fowler: Analysis Patterns

Page 41: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

41Peter Dolog, Web Engineering, Design I

Account finder and Eligibility Conditions

(C) Martin Fowler: Analysis Patterns

Page 42: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

42Peter Dolog, Web Engineering, Design I

Acount Groups: Accounting Practices

(C) Martin Fowler: Analysis Patterns

Page 43: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

43Peter Dolog, Web Engineering, Design I

Sources for Transactions

(C) Martin Fowler: Analysis Patterns

Page 44: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

44Peter Dolog, Web Engineering, Design I

Balance Sheet and Income Statement

(C) Martin Fowler: Analysis Patterns

Page 45: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

45Peter Dolog, Web Engineering, Design I

Corresponding Accounts

(C) Martin Fowler: Analysis Patterns

Page 46: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

46Peter Dolog, Web Engineering, Design I

Supporting Inventories

(C) Martin Fowler: Analysis Patterns

Page 47: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

47Peter Dolog, Web Engineering, Design I

Multiple Summary Accounts

(C) Martin Fowler: Analysis Patterns

Page 48: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

48Peter Dolog, Web Engineering, Design I

Derived Accounts

(C) Martin Fowler: Analysis Patterns

Page 49: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

49Peter Dolog, Web Engineering, Design I

Expenses to Abandon Accounting Model

(C) Martin Fowler: Analysis Patterns

Page 50: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Interesting Domain Models 1

50Peter Dolog, Web Engineering, Design I

-Value(scenario)

Contract

-Value(scenario)

Portfolio

* *

«derived»

{All instances on contract on which self.filter is true}

ContractSelector

Date

Instrument Party

*

+primaryparties

*

*

+counterparties

** *

+start0..1* +end0..1 *

+selectContracts(in Collection)

-isIncluded

ContractFilter

1..1

*

-Value(scenario)

HardCodedFilter

BooleanMethod

*

+filter1..1

SetFilter SetOperation{documentation = Instances: Union, Intersection, Negation}

* 1..1

*

*

(C) Martin Fowler: Analysis Patterns

Page 51: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

View

Page 52: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Template View

52Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 53: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Transform View

53Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 54: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Two Step View

54Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 55: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Example on two step view2

55Peter Dolog, Web Engineering, Design I(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 56: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Controller

Page 57: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Page Controllers

57Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 58: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Application Controller

58Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 59: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Sequence view

59Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 60: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Other Patterns

Page 61: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Data Mapper

61Peter Dolog, Web Engineering, Design I

Story MapperInsertUpdateDelete

Page 62: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Row Data Gateway

62Peter Dolog, Web Engineering, Design I

StoryGatewayTypeTitleInsertUpdateDelete

Page 63: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Active Record

63Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 64: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Lazy Load

64Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration

Page 65: Design I: Web Application Architecture and Patterns Peter Dolog dolog [at] cs [dot] aau [dot] dk 2.2.05 Intelligent Web and Information Systems September

Service Layer

65Peter Dolog, Web Engineering, Design I

(C) Martin Fowler: Patterns of Enterprise Application Integration