OOD Design of Processes 1 Procedure Call Pattern ITV Modelbased Analysis and Design of Embedded Software Anders P. Ravn & Arne Skou Aalborg University February 2011
Purpose Link Design to Platform Focus: Interfaces between Components Event handling Concurrency – Active Classes OAD Ch 11
Basis from Design Detailed Designs Architecture
Simple Generic Architecture OAD p.196 «component» Interface «component» Model «component» UserInterface «component» SubsystemInterface «component» Platform «component» OS «component» FileSystem «component» Function...
The Task to Solve Assume: Design is already mapped to Sequential Programs (Classes) «component» QQQQQQQQQ «component» MMMMMMMMM Provide: Architecture mapped to Concurrent Programs on a Platform «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Function «component» Platform «component» OS «component» FileSystem
Platform Characteristics onenone Ordinary c++, c threadsshared objects Java,CORBA, posix, SYMBION tasksasynch. message posix, RTOS ProcessesSynchronizationExample
Procedure call Pattern: Interface Component «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Platform «component» OS «component» FileSystem «component» Function «interface» Application read(Key) : ReadData update(UpdateData) compute(Mode) : Result attach(SignalHandler) Wrapper... read(Key k) : ReadData update(UpdateData u) compute(Mode m) : Result attach(SignalHandler sh) IFunction from Function implements IModel from Model
Procedure Call Pattern: Function Component «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Function «component» Platform «component» OS «component» FileSystem «interface» IFunction read(Key) : ReadData update(UpdateData) compute(Mode) : Result attach(SignalHandler) Administrator... read(Key k) : ReadData update(UpdatDatae u) compute(Mode m) : Result attach(SignalHandler s) IModel from Model implements
Procedure Call Pattern: Model Component «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Function «component» Platform «component» OS «component» FileSystem «interface» IModel read(Key) : Data update(Data) put(Data) attach(SignalHandler) Model... read(Key k) : Data update(Data d) put(Data d) attach(SignalHandler s) implements
Procedure Call Pattern a:Function::Administratorh: Interface::Wrapperm: Model::Model update(u) read(k) put(d) + efficient code + simple code -long response times - no concurrency OAD p
Creating an Instance «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Platform «component» OS «component» FileSystem «component» Function «interface» Application h: Wrapper IFunction from Function implements instance: CreateInstance h: Wrapper... getAPI(): Application
Observer Pattern OAD p.278 «interface» Subject attach(Observer) detach(Observer) notifyObservers() get(): Object ObservedObject State s get(): State «interface» Observer update(Subject) ObjectObserver State observation observers 1* subject
Observers across Subsystems «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Platform «component» OS «component» FileSystem «component» Function «component» Interface «component» UserInterface «component» SystemInterface «component» Model «component» Platform «component» OS «component» FileSystem «component» Function «subsystem» A«subsystem» B ObservedObject ObjectObserver
Exercises 1.Define an AP-Interface for your Model Component. 2.Outline an implementation in Procedure Call Pattern 3.How are signals from the Model Component handled? 4.How would you get an update from an external subsystem?