720 likes | 876 Views
System Design: Architectures and Archetypes ( Shlaer-Mellor Method). by Steve Mellor. 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
E N D
System Design: Architectures and Archetypes(Shlaer-Mellor Method) by Steve Mellor
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
Presentation Overview Architectural Styles Shlaer-Mellor Method Subject matters Executable domain models Translation Software Architecture Executable domain models Translation Specifying the architecture System construction
Architectural Styles Architectural Styles Shlaer-Mellor Method Subject matters Executable domain models Translation Software Architecture Executable domain models Translation Specifying the architecture System construction
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
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
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
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
Hybrids Of course ... ... most systems are hybrid
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`)
Context of a System The External World rate and volume of events in the external world normal rates burst rates its natural periodicities how frequently data values change
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
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
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
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
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
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
Subject Matters • example: chemical plant Chemical Plant domain end user domain I/O User Interface services domain Alarm Service Software Architecture s.a. domain Unix C++ impl. domain
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
Model Specification • Special focus on • end user domain: • specification of an executable model • software architecture domain • consists out of an execution engine • and a set of archetypes • both domains should be strictly separated
Model Specification On Phone Hook Translation Off Hook Application Model public class A { ... } Architecture - execution engine - set of archetypes code
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
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)
Software Architecture • Architectural Styles • Shlaer-Mellor Method • Subject matters • Executable domain models • Translation • Software Architecture • Executable domain models • Translation • Specifying the architecture • System construction
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
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)?
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
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
Time • The software architect prescribes how to provide time-related services: • absolute time • relative time
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
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
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
Three steps • Create a class diagram • Create a state diagram for each class • Associate actions to states
Class Diagram Example: chemical plant
Actions Specifiy the logic for each state`s action Creating Do Temp. Ramp(Batch ID, End Time, End Temp) Entry/ BatchID, EndTime, EndTemp >> TempRamp; CurrentTime > Self.StartTime; Self -> [R4] CookingTank.ActualTemp > Self.StartTemp; Signal Start Controlling(Ramp ID); Creating Start Controlling (Ramp ID)
How to capture the executable model? use a model repository The structure of this repository is defined by a metamodel Capturing the Models
Translation • Architectural Styles • Shlaer-Mellor Method • Subject matters • Executable domain models • Translation • Software Architecture • Executable domain models • Translation • Specifying the architecture • System construction
Translation • To generate code • traverse the repository (= MetaModel Database) • and output text • using archetypes
Archetype Language • Generation of code • text not preceded by `.` is copied as is • text preceded by `.` are commands • select • for • if • else • ...