KATHOLIEKE UNIVERSITEIT LEUVEN DEPT. OF COMPUTER SCIENCE ESC Europe 1999 report 1 System Design: Architectures and Archetypes (Shlaer-Mellor Method) by Steve Mellor
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
1
System Design: Architectures and Archetypes(Shlaer-Mellor Method)
by Steve Mellor
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
2
In general Speaker
Stephen J. Mellor (Project Technology inc.) worked at CERN (accelerator control systems) now Senior Vice President of Project Technology
Presentation (very) interesting detailed theory but few examples
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
3
Presentation Overview
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
4
Architectural Styles
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
5
Architectural Styles
Architectural style is the particular approach to building a software architecture
Most common architectures in real-time and embedded systems: Monitor and Control Systems Transporter Systems Transactions Systems
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
6
Monitor and Control Systems
Definition: collection of interrelated control loops (control loop: reads in values, computes desired value, compares, writes values)
example: chemical plant, car, airplane, ... characteristics:
often hard deadlines data represents `real world` (or part of it) data must be up to date significant computation on data
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
7
Transporter Systems
definition: systems that move data from one place to another
examples: telephony, telemetry, ... characteristics:
generally little computation on data itself high throughput requirements generally reponse time requirements management of buffers have persistent application data describing routing
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
8
Transaction Systems
definition: systems that maintain a picture of a real or hypothetical world, accepting requests to query or update that picture
examples: on-line banking, reservation systems, ... characteristics:
considerable persistent application data variable response times significant throughput requirements
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
9
Hybrids
Of course ... ... most systems are hybrid
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
10
Selecting an Architecture Christopher Alexander:
form and context
In terms of software: the form (= software architecture) is determined by its context (=properties of the `environment`)
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
11
Context of a System The External World
rate and volume of events in the external worldnormal ratesburst rates
its natural periodicities how frequently data values change
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
12
Context of a System Non-Localized Requirements
continuous operation? fault tolerance/recovery personnel and equipment safety
Business Constraints number/location of processors upward compatability hardware/software platforms
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
13
Context of a System The context of a system also shows performance
requirements detect the `High Spots`
Identify critical threads Identify worst case bursts Identify the required processing for each ...
= quantitative requirements
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
14
Shlaer-Mellor Method
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
15
Shlaer-Mellor Method
Shlaer-Mellor method is based on separation of subject matters
I/O, User Interaction, Application domain, Software Architecture
specification of (executable) model for each subject matter translation of these models into code
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
16
Subject Matters
Shlaer-Mellor method is based on separation of subject matters
I/O, User Interaction, Application domain, Software Architecture
specification of (executable) model for each subject matter translation of these models into code
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
17
Subject Matters
different categories of subject matters (domains) application domain (visible to end user) services domain (more general domains) software architecture domain (data, control, structures and
time) implementation domain (OS and programming languages)
separate teams can work on separate domains
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
18
Subject Matters
example: chemical plant
Chemical Plant domain
User Interface
I/OAlarm Service
Software Architecture
Unix C++
end user domain
services domain
s.a. domain
impl. domain
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
19
Model Specification
Shlaer-Mellor method is based on separation of subject matters
I/O, User Interaction, Domain1, Software Architecture specification of (executable) model for each subject matter translation of these models into code
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
20
Model Specification Special focus on
end user domain:specification of an executable model
software architecture domainconsists out of an execution engineand a set of archetypes
both domains should be strictly separated
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
21
Model Specification
public class A{...}
Translation
code
Application Model
Architecture- execution engine- set of archetypes
Phone
On
Off
Hook
Hook
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
22
Translation into Code Shlaer-Mellor method is based on
separation of subject matters I/O, User Interaction, Application domain, Software Architecture
specification of (executable) model for each subject matter translation of these models into code
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
23
Translation into code
The translation is done with archetypes specify how model concepts are translated to code
In fact we get some form of a model compiler a `standard` compiler generates assembler from source code a `model` compiler generates source code from a model (for
example in UML)
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
24
Software Architecture
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
25
The Software Architecture
Software Architecture is the abstract organization of the software
Proclaims and enforces system-wide rules for the organization of data control structures time
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
26
Data
The software architect prescribes storage schemes tables or arrays trees, linked lists, ... ...
And how to access them direct access by name or by pointer? indirect access (encapsulation)?
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
27
Control
The software architect prescribes control what causes a task to execute? what causes a task to relinquish control? what`s the next function to execute in a taks? how to coordinate multiple tasks accessing common data to
ensure consistency?
Strongly dependent on organization of data
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
28
Structure
The software architect prescribes how to package code and data (= the application) in: tasks functions shared data areas classes
and the allocation criteria for allocating parts of the application to these structures
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
29
Time
The software architect prescribes how to provide time-related services: absolute time relative time
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
30
Executable domain models
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
31
Executable Domain Models Notation chosen: UML Purpose: define an executable model for each subject
matter Three kinds of models
Essential models: capture the complete scope and behavior of the system
Derived models: additional views of the essential models Auxiliary Models: augment the essential models
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
32
Executable Domain Models
Essential models: Package Diagram Class Diagram State Diagram Processing Spec
Example used: Chemical plant Recipes: how can a substance be made Batch: an amount of identical substances to make Temperature Ramp: status for one substance in a batch
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
33
Three steps
Create a class diagram Create a state diagram for each class Associate actions to states
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
34
Class Diagram
Example: chemical plant
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
36
Actions
Specifiy the logic for each state`s action
Creating
Do Temp. Ramp(Batch ID,End Time, End Temp)
Start Controlling (Ramp ID)
Creating
Entry/BatchID, EndTime, EndTemp
>> TempRamp;CurrentTime > Self.StartTime;Self -> [R4] CookingTank.ActualTemp
> Self.StartTemp;Signal Start Controlling(Ramp ID);
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
37
An Executable Model
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
38
Capturing the Models
How to capture the executable model? use a model repository
The structure of this repository is defined by a metamodel
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
42
Translation
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
43
Translation
To generate code traverse the repository (= MetaModel Database) and output text using archetypes
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
44
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
45
Archetype Language
Generation of code text not preceded by `.` is copied as is text preceded by `.` are commands
select for ifelse ...
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
46
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
47
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
48
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
49
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
50
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
51
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
52
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
53
Archetype Language
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
54
Specifying the architecture
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
55
Specifying the Architecture
To specify the architecture build a model of its conceptual entities
This can also be done in UML
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
56
Specifying the Architecture
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
57
Example Architecture Remember our example: Chemical Plant Possible architecture
two tasks one of which is periodic and of higher priority one bit per instance to indicate presence in periodic state duplicated data for the control loop copied over by the periodic task when required by it
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
58
Example Architecture
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
59
Example Architecture
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
60
Example Architecture
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
61
System construction
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
62
System Construction
Recap: at this point we have a populated instance database for the application describing the
system to be built archetypes for objects in the OOA (Object Oriented Architecture)
of the architecture
What`s next: Producing the executable code
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
63
System Construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
64
System Construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
65
System Construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
66
System Construction
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
67
System Construction
An architecture is an OOA-model compiler It translates a system specified in OOA into the target
programming language incorporating decisions made by the architect about data control structures time
Architectures, like programming languagecompilers, can be bought
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
68
Conclusion
Architectural Styles Shlaer-Mellor Method
Subject matters Executable domain models Translation
Software Architecture Executable domain models Translation Specifying the architecture System construction Conclusion
KATHOLIEKEUNIVERSITEITLEUVEN
DEPT. OFCOMPUTERSCIENCE
ES
C E
urop
e 19
99 r
epor
t
69
Conclusion Benefits of the Shlaer-Mellor Method:
ensures that the architectural design decisions are made by the architect
offers the possibility to alter performance without affecting the system behavior (=application)
adaptable to changes in context enforces uniformity across different development teams facilitates integration