1 / 29

Architectural Styles

Architectural Styles. Chapter 15. Architecture. Architecture is a high level description of a solution to a problem Recall architecture (high level design ) includes: Main Components Functionalities and properties of components Major Relations

page
Download Presentation

Architectural Styles

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Architectural Styles Chapter 15

  2. Architecture • Architecture is a high level description of a solution to a problem • Recall architecture (high level design) includes: • Main Components • Functionalities and properties of components • Major Relations • Components collaborating among the components

  3. Architectural Style • An Architectural Style defines a set of rules that describe: • the properties of and constraints on its components and • The way in which the components interact Architectural Style is a High Level Design Pattern

  4. Architectural Styles (Patterns) • Architectural Styles may be viewed as a set of Architectural Design solutions that have been used successfully before. • These styles (or patterns) offer multiple benefits: • Promote communications among the designers because the pattern names are used as a shorthand for a lengthy description • Streamline documentation for the same reason above • Support high level of reuse if the pattern is applicable • Improve development efficiency and productivity for above reasons and not having to profile or prototype all the existing patterns • Provide a starting point for additional and new design ideas. A software design pattern is a model for a class of solutions to a software design problem. At high level we call these patterns architectural styles.

  5. Software Design Patterns • Software Design Patterns is a recent event, although programming level “patterns” have been studied in our industry such as Sorts, Search, Access Methods, etc. • A building architect named Christopher Alexander introduced building designs based on “patterns” in the 1970’s and catalogued these designs in a book. • Has not been widely accepted by building architects • But has influenced the software design community in the last 15 years in terms of cataloguing and using design patterns. My personal thoughts: Design Patterns come in different levels: 1. - the high level architecture is not detailed enough and should only serve as a guideline pattern for further refinement 2. - the middle level ones is where the current work is focused on and may be domain dependent 3. - low level ones (e.g. data structures and algorithms) have been employed relatively successfully via provided libraries

  6. Major Architectural Styles (Patterns) • Layered Architecture • Pipe and Filter • Shared (Central) Data Store • Event Driven • Model-View-Controller (MVC) • “Distributed & Emerging” Service Oriented Architecture (SOA)

  7. Layered architecture • The high level design solution is decomposed into Layers: • Structurally, each layer provides a related set of services • Dynamically, each layer may only use the layers below it • Using and evoking is not necessarily the same (subtle difference)) • Layer A mayuse layer B because it depends on something B does (e.g. data written to a db by B to be used by A), but never call upon it. • Layer A evokeslayer B says Layer A passes control or data or both directly to B. Screen Presentation layer 1. If any layer only uses the layer directly below it, then it is a Strict Layered Style. 2. If a layer may useany of the layers below it, then it is a Relaxed Layer Style Logic layer File layer Problems that seem to fit this architecture include tele-comm and op-sys

  8. Simple Example with “Mailing Address” Processing Country State City Street Recipient Name Mail processing to establish which delivery plane/truck to distribute the US Postal mail The sequence is from top layer to the lower layer. This same scheme is often used in communications protocol architecture

  9. “Sample” Layered Communications Architecture Application layer Presentation layer Session layer Transport layer Network layer Data Link layer Physical layer

  10. A Simplified “Experiential” Discussion Information I/o Layer cust info I/O ord. info I/O prod info I/O customer info valid. order info valid. product info valid. Cust. Info validation . . . product Info validation add add add Information validation Layer Add, Delete, and Update delete delete delete Info Processing Layer update update update Viewing from internal structure and form; then designing with “commonality” in mind Ending up with layered architecture Viewing and designing directly from functional requirements Discuss - - Pros and Cons in class: modularity; coupling; cohesion

  11. Sample Layered Architecture for OS Utilities (editors, sys commands, compilers, internet access, libraries, etc.) Resource (I/O, page, network, file, etc.) management kernel (Device & memory Processing) drivers Process (classification & management) How many of the layers would we need to worry about ---- for the currently popular “security” issue ?

  12. Advantages and Disadvantages ofLayered Architecture • Advantages: • Each layer is selected to be a set of related services; thus the architecture provides high degree of cohesionwithin the layer. • Each layer may hide private information from other layers • Layers may use only lower layers, constraining the amount ofcoupling. • Each layer, being cohesive and is coupled only to lower layers, makes it easier forreuseby others and easier to be replaced or interchanged(change of DB touches only the data store/access layer, change of browser only changes the presentation layer of the previous slide) ---- good for component design • Disadvantages: • Strict Layered Style may cause performance problem depending on the number of layers • Debugging in Strict Layered Style may be complex (questionable?) • May be difficult to decide on the number of layers I beg to differ

  13. Pipe and Filter Architecture • Main components: • Filter: process the a stream of input data and turn into some output data • Pipe: a conduit that allows the flow of data read input file process file filter This architecture style focuses on the dynamic (interaction) rather than the structural pipe

  14. Pipe and Filter : UNIX Influence • UNIX command line processing of the pipe symbol, l - the output from the command to the left of the symbol, l, is to be sent as input to the command to the right of the pipe; - this mechanism got rid of specifying a file as std output of a command and then specifying that same file as the std input to another command, including possibly removing this intermediate fileafterwards Example ( UNIX commands) : $ cat my.txt I live in the city of Atlanta $ cat my.txt I sed “s/i/o/g” I love on the coty of Atlanta $ Example : Assume that in the file called my.txt is the following: I live in the city of Atlanta Note the pipe symbol, l First cat command outputs my.txt to screen. The second cat command reads my.txt and sends it to sed command which “search” for “i’ and “globally” replace it with “o.”

  15. More Modern Version of Pipe-filter • Consider the MS Office Product • Specifically --- think about how the component called “copy” works in conjunction with the component called “paste” across office product (e.g. spread sheet to word document ) How may this be extended to the way e-mail with file attachment work?

  16. Pipe-Filter architecture • The high level design solution is decomposed into 2 parts (filters and pipes): • Filter is a service that transforms a stream of input data into a stream of output data • Pipe is a mechanism or conduit through which the data flows from one filter to another Input time cards Prepare for Check processing Process Checks Problems that require batch file processing seem to fit this architecture: e. g. payroll and compilers

  17. Pipe – Filter with error processing • Even though interactive error processing is difficult, but batch error processing can be done with pipe and filter architecture Input time cards Splitting the good time cards from the bad ones Validate for payroll processing Manually Reprocess Card and Cut Check Automatically Process Checks Do the data streams need to be synchronized here for report? Payroll report

  18. Advantages and Disadvantages ofPipe-Filter • Advantages: • Filters are self containing processing service that performs a specific function thus it is fairly cohesive • Filters communicate (pass data most of the time) through pipes only, thus it is “somewhat”constrained in coupling • Disadvantages: • Filters processes and sends streams of data over pipes is a solution that fits well with heavy batch processing, but may not do well with any kind of user-interaction. • Anything that requires quick and short error processing is still restricted to sending data through the pipes, possibly making it difficult to interactively react to error- events.

  19. Shared Data • The high level design solution is based on a shareddata-storewhich acts as the “central command” with 2 variations: • Blackboard style: the data-store alerts the participating parties whenever there is a data-store change (trigger) • Repository style: the participating parties check the data-store for changes Lab testing physician diagnosis Very Common In Business where Data is central Patient database accounting & administration pharmacy & drug processing Problems that fit this style such as patient processing, tax processingsystem, inventory control system; etc. have the following properties: 1. All the functionalities work off a single data-store. 2, Any change to the data-store may affect all or some of the functions 3. All the functionalities need the information from the data-store

  20. Blackboard Style & DB triggers • In database management system we can set up a trigger which has 3 parts: • 1) Event : change to the database that alerts or activates the trigger • 2) Condition: a test that is true when the trigger is activated • 3) Action: a procedure which is executed when the trigger is activated and the condition is true. 1) A trigger may be thought as a monitor of the database for changes to the database that matches the event specification (e.g. debit of bank cust. accnt) 2) Then the condition is checked to see if it is true (e.g. debited cust account results in negative bank accnt amount). 3) If the debited account has a negative accnt amount, then kick off a procedure to send error message out and delay the execution of cust account debiting.

  21. Advantages and Disadvantages ofShared Data • Advantages: • The independent functions are cohesivewithin itself and the coupling is restricted to the shared data • Single data-store makes the maintenance of data in terms of back-up recovery and security easier to manage • Disadvantages: • (common and control coupling through data) Any data format change in the shared data requires agreement and, potentially, changes in all or some the functional areas - - this becomes a bigger problem as more functionalities are introduced that have dependency on the shared data. (e.g. popular commercial product such as CRM or ERP) • ** If the data-store fails, all parties are affected and possibly all functions have to stop**(may need to have 1)redundant db for this architecture style; also, should have 2) good back up- and recovery procedures.)

  22. Event-Driven (Realtime) • The high level design solution is based on an event dispatcher which manages events and the functionalities which depends on those events. These have the following characteristics: • Events may be a simple notification or may include associated data • Events may be prioritized or be based on constraints such as time • Events may require synchronous or asynchronous processing • Events may be “registered” or “unregistered” by components voice call Phone processing text msg Personal (device) dispatcher Txt processing Image Image processing keypad Problems that fit this architecture includes real-time systems such as: airplane control; medical equipment monitor; home monitor; embedded device controller; game; etc. - - - try a commercial flight control system - - -

  23. Advantages and Disadvantages ofEvent-Driven • Advantages: • The event sensors and the event processors are separate, providing decoupled and individual functionalities. • The replacement and additions are independent and thus easier to perform • Any sensor or processing malfunction will not affect the other sensors and processors • Disadvantages: • It is difficult for the dispatcher to react to a myriad of sensor inputs and respond in time (especially on simultaneous inputs)- - - the dispatcher is the “single grand connector” • A dispatcher malfunction will bring the whole system down !! • Dispatcher is very much performance gated (must be fast --- may be able to use a queue in some cases)

  24. Model-View-Controller (MVC) • The high level design solution is based on 3 main components: • Models: the portion that handles the data model and the data logic related to the application functions • View: the component that handles the displaying of information to the users • Controller: the component that handles the users needs in terms of accepting the requests and responding to the requests << app and db>> << user interface >> <<use>> controller model View << user interface>> << app and db>> <<use>> vew model controller Problems that fit this architecture includes most of the inter-active web-applications. --Discuss how this can be “adapted” to be shared data, event-driven or layered architecture--

  25. Advantages and Disadvantages ofMVC • Advantages: • Views, controller, and modelare separate components that allow modification and change in each “layer” without significantly disturbing the other • The view component, which often needs changes (UI technology improvement) and updates to keep the users continued interests, is separate • The View-Controller can keep on partially functioning even if the model component is down. • Disadvantages: • Heavily dependent on the development and production system environment and tools that match the MVC architecture (e.g. TomCat, .Net, Rail, etc.)

  26. Further Discussion on Software Architecture We have introduced 5 different software architectural style which described - the layout of the major components - the interaction among the components How do you decide on what should be your major components and the layout? Who provides the mechanisms for the component interactions?

  27. Software Connectorsfor networked services • Software connectors form a discrete architectural element that represent a set of mechanisms that enable & mediate component interactions: • Communications: support transmission of data among components • Coordination: support transfer of control among components • Conversion: converts the interaction interface required by one component to that provided by another component • Facilitation: manage the interaction among the components from deadlocking, from overflow, from unauthorized access, etc. This is a relatively new field and these definitions are still under study

  28. A Sample High Level Component Architecture App Comp App Comp . . . App Comp App Comp . . . Component Framework Component Framework The component framework and the arrows in this diagram represent the functionalities of software connectors. Examples: DCOM (Microsoft), CORBA (OMG), .NET (Microsoft), etc.

  29. Service Oriented Architecture (SOA)“currently (2008-2010) popular & emerging” • An architecture that is composed mainly of three “layers”: • Networked IT infrastructure (bottom layer) • Independently developed software & services (middle layer) • Coordinated business processes (top layer) • A distributed architecture based on http/SOAP/WSDL networked services. • The services are described using XML language to ensure that: • The business process and procedures match • The exchange of data and the format of the data match

More Related