cisc 323 intro to software engineering
play

CISC 323 Intro to Software Engineering Week 8: Software - PowerPoint PPT Presentation

CISC 323 Intro to Software Engineering Week 8: Software Architecture (Continued) CISC 323 Intro to Software Engineering Lecture 8-1 Data-Centered and Interpreter Architectural Styles Architectural Style Examples [Shaw&Garlan]


  1. CISC 323 Intro to Software Engineering Week 8: Software Architecture (Continued)

  2. CISC 323 Intro to Software Engineering Lecture 8-1 Data-Centered and Interpreter Architectural Styles

  3. Architectural Style Examples [Shaw&Garlan] • Pipes and Filters • Layers • Event-Based • Data-Centered • Interpreter • PAC Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 3

  4. Data-Centered Architecture Style • Repository – Allows data to be allowing shared amongst a set of components • Blackboard – Active repository cooperative, distributed decision making Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 4

  5. Repository • Set of components share data • E.g., database or data structure shared by Repository multiple components • Connectors permit components to read/write to repository Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 5

  6. Example Compiler based on pipes and filter • architecture style • Parse tree is complex data structure passed between phases • Needs to be converted into a stream that can be passed over a pipe -- overhead program Scanner • Use repository to represent abstract text syntax tree tokens Parser parse Semantic tree Analyzer parse Code executable tree code Generator

  7. Compiling as Pipe and Filter Architecture Augmented with Repository program Scanner text Repository: Parse Tree tokens Parser control Semantic Analyzer control Control information passed Code executable between phases rather than code Generator parse tree Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 7

  8. Properties of Repository Architecture Style • Performance – For complex data c1 c2 structures, saves overhead of passing data structure from one component to Repository another – If components on different machines, this overhead might be considerable c3 – If components on different machines, cost of accessing repository might be high Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 8

  9. Properties of Repository Architecture Style • Performance – E.g., if components and c1 c2 repositories on different machines, each call to repository goes over network Repository – Need to balance this cost vs cost of moving data between phases using pipes and filters – E.g., if c2 makes 1000 calls for c3 information to repository, each call takes 1 ms, total time = 1 s. Compare to time to pass repository from c1 to c2 Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 9

  10. Properties of Repository Architecture Style • Performance – Need to ensure repository can c1 c2 scale to load of components making requests of it – Ideally, do not want Repository components waiting while repository operates on long queue of requests – This analysis is complex, out c3 of scope of this course Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 10

  11. Properties of Repository Architecture Style • Development Time c1 c2 – Numerous infrastructures for repositories already exist -- e.g. Repository • Commercial databases • Java Remote Method Invocation (RMI) – Need to balance savings in c3 development time vs need to learn infrastructures Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 11

  12. Properties of Repository Architecture Style • Security Repository potentially available c1 c2 – to anyone who can connect to it – Particularly dangerous in distributed setting where Repository repository available via Internet protocol – E.g., don’t want medical patient information available to anyone c3 who knows IP address of medical database Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 12

  13. Properties of Repository Architecture Style • Availability – Repository becomes critical c1 c2 component in system – Failure in repository causes entire system to fail Repository c3 Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 13

  14. Blackboard Architecture Style c1 c2 • Variant of repository • Repository is active – Can activate components Blackboard in response to changes in blackboard contents • Typical application c3 – Use blackboard to mediate cooperative activity amongst components Update/request information – Tasks where desired from repository outcome is imprecisely Activate components as new defined or error prone information becomes available Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 14

  15. Catalogue Requests for book info HTTP Server Inventory (e.g. Apache) Requests for delivery time Requests for book info, Request Order delivery times, orders, availability placement etc. Order System HTML document HTTP Client Recall example of (e.g., Netscape, online book ordering Internet Explorer) system...

  16. Example: Inventory System using the Blackboard Architecture • Inventory blackboard used to Receiver coordinate filling orders • Order system initiates orders Order Record new • Receiver records new stock as it stock stock arrives • Shipper sends order to be Record stock Inventory shipped packaged Shipper • All communication via inventory Request Inform Initiate availability order filled shipping Order System Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 16

  17. Example: Smart office • Tracking who is in the office – Using: Active badges, voice recognition, cameras – Allows • Ease of finding colleagues • User authentication (no need to have door keys, logins at machines) • People’s environments to follow them – Sitting down at someone else’s PC is just like sitting down at your own • Smart commands – Use gestures/voice to • Turn on projector, connect to PC • Record contents of whiteboard save them under my username – Combine modalities • Say “Save *this* on my laptop”, while pointing at whiteboard Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 17

  18. Example: Smart office • Application depends on combining a set of physical devices – Cameras, microphones, door switches • and a set of services – Voice recognition speech recognition, gesture recognition • and a set of models – Who is in room, what command are they executing Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 18

  19. Active Badge Reader Microphone Voice Camera1 Badge samples data ooo Camera n Camera inputs Model: command Model: people in room Command detector People detector

  20. Interesting scenarios • Person enters room, but their active badge is malfunctioning • When they first speak, voice recognition detects their presence Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 20

  21. Architectural Style Examples [Shaw&Garlan] • Pipes and Filters • Layers • Event-Based • Data-Centered • Interpreter • PAC Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 21

  22. Interpreter Architecture Style • Develop domain-specific language for problem area • Express solution in terms of this language • Include interpreter in system to evaluate the solution • Motivation – Providing higher level language for problem domain simplifies programming problem – Examples • XML parsers • Extensible interpreters such as JVM, tcl • Rule-based/expert systems Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 22

  23. Interpreter Architecture [Shaw&Garlan p. 27] Program being Program state interpreted inputs program code Internal Simulated outputs selected data Interpreter Interpretation selected instruction State Engine Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 23

  24. E.g., Interpreting Java Programs Program state Java class files inputs program code outputs selected data Java Virtual JVM State Machine (JVM) selected instruction Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 24

  25. Interpreting Java Programs • Java programs are represented as a set of class files – Contain byte code describing operations on the Program state Java class files Java Virtual Machine inputs program code • These programs are executed as if they were outputs selected data Java Virtual JVM State Machine (JVM) selected instruction being run on a native machine • Program state is actually represented in JVM Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 25

  26. Example: Processing XML • XML (eXtensible Markup Language) is a way of encoding structured data for – Archiving – Interchanging between applications – Sending over the Internet (e.g. e-commerce business-to-business applications) • • XML processing is implemented via the interpreter architecture style See e.g. http://www.xml101.com:8081/xml/ Queen’s University, CISC 323 http://www.cs.queensu.ca/~cisc323 26

Recommend


More recommend