Скачать презентацию CSSE 377 Software Architecture and Design 2 Steve Скачать презентацию CSSE 377 Software Architecture and Design 2 Steve

940cc4c47c5284c08f570af962e26bc4.ppt

  • Количество слайдов: 35

CSSE 377 Software Architecture and Design 2 Steve Chenoweth, Rose-Hulman Institute Week 2, Day CSSE 377 Software Architecture and Design 2 Steve Chenoweth, Rose-Hulman Institute Week 2, Day 4, Thursday, Sep 16, 2011 Architectural Styles 2 Left – Model for the “repository” style of architecture is a warehouse. Half the battle is designing it so that the same lift truck can access anything you might need. The other half, perhaps, is knowing where that is! Fisheye image from www. moodleman. net/archives/202.

Today n n HW 2 – Tim will post HW comments in Angel dropbox. Today n n HW 2 – Tim will post HW comments in Angel dropbox. More on arch styles – this ¨ n Bonus: a few examples of possible questions on the next biweekly quiz! Project 2 – Time to work on Project 2 in class ¨ 11: 55 PM – File a spreadsheet showing the “availability” of the part of the system you stressed, and how much you predict you can improve it. Also turn in your journal with a discussion of that spreadsheet – how you decided on the numbers, especially. ¨ 2

Acknowledgements n Some of the material in these slides is taken from “An Introduction Acknowledgements n Some of the material in these slides is taken from “An Introduction to Software Architecture” by Garlan and Shaw. 3

Arch styles, continuing… Garlan & Shaw’s TOC: n n Quick review of yesterday’s styles Arch styles, continuing… Garlan & Shaw’s TOC: n n Quick review of yesterday’s styles New styles for today: ¨ ¨ ¨ Repository Interpreter Distributed Processes Domain Specific State Transition Systems … and 1 more example 4

Review from Yesterday Call and Return Main One Three Two Foo Bar 5 Review from Yesterday Call and Return Main One Three Two Foo Bar 5

Review from Yesterday Data Abstraction (Object Oriented) 6 Review from Yesterday Data Abstraction (Object Oriented) 6

Review from Yesterday Implicit Invocation (Callback) Register interest in events Event 1 Event 2 Review from Yesterday Implicit Invocation (Callback) Register interest in events Event 1 Event 2 Event 3. . . Foo Notification of events Bar Announcement of events Example implicit invocation biweekly quiz question: 1. Why does “filters not knowing their neighbors” imply easy evolution? 7

Review from Yesterday Pipe and Filter Example pipe-and-filter biweekly quiz questions: 1. What does Review from Yesterday Pipe and Filter Example pipe-and-filter biweekly quiz questions: 1. What does “often leads to batch processing” mean? 2. Suppose this whole system ran in one computer, and passed large images from filter to filter for processing. How would you modify its operation to save memory? 8

Review from Yesterday Layered U p C v Example layered system biweekly quiz question: Review from Yesterday Layered U p C v Example layered system biweekly quiz question: 1. Suppose you discover that the “Useful system” level has to communicate directly with the “core level” to handle errors. What would you need to do to be sure doing this didn’t mess up your system design? 9

New! Repositories (Database or Blackboard) D C 10 New! Repositories (Database or Blackboard) D C 10

Repositories Repository Properties n Components: Central data structure ¨ Independent computational elements ¨ n Repositories Repository Properties n Components: Central data structure ¨ Independent computational elements ¨ n n Database: input stream selects processes Blackboard: State of central data structure selects processes Used for finding nondeterministic solutions ¨ Has “knowledge base” vs DB at its center ¨ n Invariant: decisions are based on data on the shared blackboard Today’s quiz – Q 1 11

Repositories Repository Advantages/ Disadvantages n Similar to Implicit Invocation style: ¨ Knowledge sources don’t Repositories Repository Advantages/ Disadvantages n Similar to Implicit Invocation style: ¨ Knowledge sources don’t know ID’s, but ¨ Control is driven by the blackboard n Context is important for reasoning ¨ Usually complex interpretation is the goal 12

Repositories Repository – A Blackboard Example n n n Hearsay II (in Garlan & Repositories Repository – A Blackboard Example n n n Hearsay II (in Garlan & Shaw’s article) Speech recognition Input stream – speech signal Blackboard – hypotheses about what was being said Independent computing elements – opportunistically tried to reach higher level conclusions – like “If these words say ‘Welcome to Terre Haute. ” then that could be a coherent sentence. Hearsay II’s blackboard architecture – from www. cs. cmu. edu/afs/cs/project/tinker-arch/www/html/T 13

Repositories Additional uses for blackboards n n n n Breaking complex cryptographic codes Sensory Repositories Additional uses for blackboards n n n n Breaking complex cryptographic codes Sensory interpretation and analysis (such as computer vision) Command Control Systems Surveillance Systems Workflow Processing Case-based reasoning Symbolic learning Data Fusion 14

Interpreters Interpreter 15 Interpreters Interpreter 15

Interpreters Interpreter Properties n Components: ¨ Interpretation engine ¨ Memory containing pseudo-code ¨ Control Interpreters Interpreter Properties n Components: ¨ Interpretation engine ¨ Memory containing pseudo-code ¨ Control state of interpretation engine ¨ Current state of program being simulated n Connectors: ¨ Closely state. n Interpreter examples – See PLC! ¨ Lisp n bound, with direct procedure calls and shared and Scheme, etc. Invariant? Details of the data manipulation are hidden by the high-level language. Today’s quiz – Q 2 16

Interpreters – what you get n n Binary instructions for a virtual machine, often Interpreters – what you get n n Binary instructions for a virtual machine, often called bytecode, as is done in Lua, Python, Ruby, Smalltalk, and many other systems (the approach was popularized in the 1970 s by the UCSD P-system and UCSD Pascal) A tree-like representation of the original program, such as an abstract-syntax tree, as is done for many prototype or educational interpreters A tokenized representation of the source program, similar to Tcl The characters of the source program, as was done in MINT and TRAC 17

Interpreters Interpreter Advantages/ Disadvantages Superb end-user programmability and maintainability; supports dynamically changing capabilities. n Interpreters Interpreter Advantages/ Disadvantages Superb end-user programmability and maintainability; supports dynamically changing capabilities. n Slower than “raw code” doing the same thing. n 18

Distributed Processes n n SAP, as an example: Each server has a “dispatcher” and Distributed Processes n n SAP, as an example: Each server has a “dispatcher” and a number of work processes These vary, depending on resource needs ¨ E. g. , one may have only “dialog processes” and another may have just “background processing”. ¨ 19

Distributed Processes n Often described in terms of their topology: ¨ ring ¨ star Distributed Processes n Often described in terms of their topology: ¨ ring ¨ star n Sometimes described in terms of communication protocols: ¨ client/server ¨ peer-to-peer ¨ Heartbeat n Invariant? Physical isolation of functions goes with separation of responsibilities 20

Distributed Processes Advantages/ Disadvantages n n Inherently flexible and reliable Can be slow instead Distributed Processes Advantages/ Disadvantages n n Inherently flexible and reliable Can be slow instead of fast! ¨ Use data close to its source, or batch it ¨ Keep “conversations” short n Maintenance of individual parts ¨ What n happens when you change 1 interface? Reliability ¨ Minimize the number of transactions 21

Distributed Processes Distributed Process Example – Client/Server Like Web browser connected to a server… Distributed Processes Distributed Process Example – Client/Server Like Web browser connected to a server… n What are good & bad features of that? n PC Client Database Servers Application Servers Gets requested data Web Servers Each doing individual tasks Runs major applications Hands out Web pages PC Client A typical 4 -tiered client-server system Clients “request services, ” Servers “respond”. 22

Distributed Processes Distributed Process Example – Cloud (peer-to-peer) Issues – n Achieving scalability via Distributed Processes Distributed Process Example – Cloud (peer-to-peer) Issues – n Achieving scalability via distribution n Achieving availability via duplication n What’s “stateless vs stateful” From “Building cloud-ready, multicore-friendly applications, Part 1: Design principles, ” at http: //www. javaworld. com/javaworld/jw-032009/jw-03 -multicore-and-cloud-ready 1. html? page=4. Today’s quiz – Q 3 23

Domain-Specific Arch Domain-Specific Styles n The prototypical example of a refined style – transaction Domain-Specific Arch Domain-Specific Styles n The prototypical example of a refined style – transaction processing using a credit / debit card: 24

Domain-Specific Arch Domain-Specific Styles Specific to a family of systems -- a product line Domain-Specific Arch Domain-Specific Styles Specific to a family of systems -- a product line n Some components are common, but may be implemented in different ways n Connections between common components are preserved across family n 25

Domain-Specific Arch Domain-Specific Example Transaction processing systems n n Used in banking, retail, loading Domain-Specific Arch Domain-Specific Example Transaction processing systems n n Used in banking, retail, loading docks, etc. Domain idea is that some activity of real value occurs and needs to be recorded. Usually, assets change hands: ¨ You get money at a bank machine ¨ You buy an i. Tune for your i. Pod ¨ You checkout your groceries at Kroger’s ¨ 60 refrigerators get loaded onto your store’s truck at the manufacturer’s warehouse Image from www. handiramp. com/dock_equipment. htm. 26

Domain-Specific Arch Domain-Specific Example Transaction processing systems What quality attributes are important? n n Domain-Specific Arch Domain-Specific Example Transaction processing systems What quality attributes are important? n n Performance – usually impacts productivity or customer patience. Reliability – different meaning. Want all transactions to be “atomic. ”* Usually are distributed systems, with parts owned by different organizations. Invariant: Guaranteed completion or roll-back of transactions * Famously, we want all the ACID properties in transactions: Atomicity, Consistency, Isolation and Durability. See, e. g. , http: //en. wikipedia. org/wiki/ACID. Today’s quiz – Q 4 27

Domain-Specific Arch Domain-Specific Example Transaction processing systems n Example – Buying groceries at Kroger’s: Domain-Specific Arch Domain-Specific Example Transaction processing systems n Example – Buying groceries at Kroger’s: PIN Pad Gets VISA data POS Register Scanner Store Records transaction Scans groceries Tracks item-level sales In-store processor Supplies item info to POS, Updates inventory system POS = Point of Sale Kroger’s Inventory system VISA Authorizes payment Kroger image from compulsivec. wordpress. com/2007/03/. 28

State-Transition Sys State Transition Systems n n Remember formal methods? Here’s where a state State-Transition Sys State Transition Systems n n Remember formal methods? Here’s where a state diagram IS the design! 29

State-Transition Sys State Transition Systems Set of states as components n Set of transitions State-Transition Sys State Transition Systems Set of states as components n Set of transitions between states, as connectors n ¨ Often built on hardware “events” Good style for reactive systems n Invariant: The various “states” defined determine what can be done there. n 30

State-Transition Sys State Transition System Example – Process Control n Use feedback or feedforward State-Transition Sys State Transition System Example – Process Control n Use feedback or feedforward to control a process: Diagram from http: //en. wikipedia. org/wiki/Feedback image from http: //ocw. mit. edu/Ocw. Web/Electrical-Engineering-and-Computer-Science/6302 Feedback-Systems. Fall 2002/Course. Home/, an MIT open course on feedback systems 31 Today’s quiz – Q 5

Examples Again, taken from Garlan & Shaw’s Case Studies section. Examples Again, taken from Garlan & Shaw’s Case Studies section.

Compiler – Pipe and Filter n A first try at compiler architecture – hand Compiler – Pipe and Filter n A first try at compiler architecture – hand off the data from one step to the next, in “passes. ” 33

Compiler – Modified Pipe and Filter n But the steps all use the common Compiler – Modified Pipe and Filter n But the steps all use the common Symbol Table built during compilation, so need to have that large, shared area to update. 34

Compiler – Repository n And more improvements occur when the steps can interact, using Compiler – Repository n And more improvements occur when the steps can interact, using rules to guide decisions … ¨ n Like whether you are trying to make a single block of object code out of one segment of source code. Which leads to more of a repository style architecture. 35