Presentation is loading. Please wait.

Presentation is loading. Please wait.

Designing Architectures

Similar presentations


Presentation on theme: "Designing Architectures"— Presentation transcript:

1 Designing Architectures
Software Architecture Chapter-4

2 How Do You Design? Where do architectures come from? Creativity Method
Efficient in familiar terrain Not always successful Predictable outcome (+ & - ) Quality of methods varies Fun! Fraught with peril May be unnecessary May yield the best Method

3 Objectives Creativity Enhance your skill set Provide new tools Method
Focus on highly effective techniques Develop judgment: when to develop novel (original) solutions, and when to follow established method

4 Engineering Design Process
Feasibility stage: identifying a set of feasible concepts for the design as a whole Preliminary design stage: selection and development of the best concept. Detailed design stage: development of engineering descriptions of the concept. Planning stage: evaluating and altering the concept to suit the requirements of production, distribution, consumption and product retirement.

5 Potential Problems If the designer is unable to produce a set of feasible concepts, progress stops. As problems and products increase in size and complexity, the probability that any one individual can successfully perform the first steps decreases. The standard approach does not directly address the situation where system design is at stake, i.e. when relationship between a set of products is at issue. As complexity increases or the experience of the designer is not sufficient, alternative approaches to the design process must be adopted.

6 Alternative Design Strategies
Standard Linear model described above Cyclic Process can revert (go back) to an earlier stage Parallel Independent alternatives are explored in parallel Adaptive (“lay tracks as you go”) The next design strategy of the design activity is decided at the end of a given stage Incremental Each stage of development is treated as a task of incrementally improving the existing design

7 Identifying a Viable (feasible) Strategy
Use fundamental design tools: abstraction and modularity. But how? Inspiration, where inspiration is needed. Predictable techniques elsewhere. But where is creativity required? Applying own experience or experience of others.

8 The Tools of “Software Engineering 101”
Abstraction Abstraction(1): look at details, and abstract “up” to concepts Abstraction(2): choose concepts, then add detailed substructure, and move “down” Example: design of a stack class Separation of concerns First view is the standard (dictionary) understanding Second view is how CS people think of it; it is top-down design (you’re always betting on the chance that you’ll be able to come up with a workable substructure)

9 A Few Definitions… from the OED Online
Abstraction: “The act or process of separating in thought, of considering a thing independently of its associations; or a substance independently of its attributes; or an attribute or quality independently of the substance to which it belongs.” Reification: “The mental conversion of … [an] abstract concept into a thing.” Deduction: “The process of drawing a conclusion from a principle already known or assumed; spec. in Logic, inference by reasoning from generals to particulars; opposed to INDUCTION.” Induction: “The process of inferring (concluding) a general law or principle from the observation of particular instances (opposed to DEDUCTION, q.v.).”

10 Abstraction and the Simple Machines
What concepts should be chosen at the outset (start) of a design task? One technique: Search for a “simple machine” that serves as an abstraction of a potential system that will perform the required task For instance, what kind of simple machine makes a software system embedded in a fax machine? At core, it is basically just a little state machine. Simple machines provide a plausible (possible) first conception (idea) of how an application might be built. Every application domain has its common simple machines.

11 Simple Machines Domain Simple Machines Graphics Pixel arrays
Transformation matrices Widgets Abstract depiction graphs Word processing Structured documents Layouts Process control Finite state machines Income Tax Software Hypertext Spreadsheets Form templates Web pages Composite documents Scientific computing Matrices Mathematical functions Banking Databases Transactions

12 Choosing the Level and Terms of Discourse (discussion)
Any attempt to use abstraction as a tool must choose a level of discourse, and once that is chosen, must choose the terms of discourse. Alternative 1: initial level of discourse is one of the application as a whole (step-wise refinement). Alternative 2: work, initially, at a level lower than that of the whole application. Once several such sub-problems are solved they can be composed together to form an overall solution Alternative 3: work, initially, at a level above that of the desired application. E.g. handling simple application input with a general parser.

13 Separation of Concerns (matters)
Separation of concerns is the subdivision of a problem into (hopefully) independent parts. The difficulties arise when the issues are either actually or apparently intertwined (entangled). Separations of concerns frequently involves many tradeoffs Total independence of concepts may not be possible. Key example from software architecture: separation of components (computation) from connectors (communication)

14 The Grand Tool: Refined (developed)Experience
Experience must be reflected upon and refined. The lessons from prior work include not only the lessons of successes, but also the lessons arising from failure. Learn from success and failure of other engineers Literature Conferences Experience can provide that initial feasible set of “alternative arrangements for the design as a whole”.

15 Patterns, Styles, and DSSAs
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

16 Domain-Specific Software Architectures
A DSSA is an assemblage of software components specialized for a particular type of task (domain), generalized for effective use across that domain, and composed in a standardized structure (topology) effective for building successful applications. Since DSSAs are specialized for a particular domain they are only of value if one exists for the domain wherein the engineer is tasked with building a new application. DSSAs are the pre-eminent (greatest) means for maximal reuse of knowledge and prior development and hence for developing a new architectural design.

17 Architectural Patterns
An architectural pattern is a set of architectural design decisions that are applicable to a recurring (returning) design problem, and parameterized to account for different software development contexts in which that problem appears. Architectural patterns are similar to DSSAs but applied “at a lower level” and within a much narrower scope.

18 State-Logic-Display: Three-Tiered Pattern
Application Examples Business applications Multi-player games Web-based applications Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

19 Model-View-Controller (MVC)
Objective: Separation between information, presentation and user interaction. When a model object value changes, a notification is sent to the view and to the controller. So that the view can update itself and the controller can modify the view if its logic so requires. When handling input from the user the windowing system sends the user event to the controller; If a change is required, the controller updates the model object.

20 Model-View-Controller
Draw a graph as an example Graph drawn as circles and lines Graph drawn as a bit matrix: a 1 indicates that those two nodes (x, y) are connected Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

21 Sense-Compute-Control
Objective: Structuring embedded control applications Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

22 The Lunar Lander: A Long-Running Example
A simple computer game that first appeared in the 1960’s Simple concept: You (the pilot) control the descent rate of the Apollo-era Lunar Lander (LL) Throttle setting controls descent engine Limited fuel Initial altitude and speed preset If you land with a descent rate of < 5 fps: you win (whether there’s fuel left or not) “Advanced” version: joystick controls attitude & horizontal motion

23 Sense-Compute-Control LL
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

24 Architectural Styles An architectural style is a named collection of architectural design decisions that are applicable in a given development context constrain architectural design decisions that are specific to a particular system within that context elicit beneficial qualities in each resulting system A primary way of characterizing lessons from experience in software system design Reflect less domain specificity than architectural patterns Useful in determining everything from subroutine structure to top-level application structure Many styles exist and we will discuss them in detail in the next lecture

25 Definitions of Architectural Style
Definition. An architectural style is a named collection of architectural design decisions that are applicable in a given development context constrain architectural design decisions that are specific to a particular system within that context elicit beneficial qualities in each resulting system. Recurring organizational patterns & idioms Established, shared understanding of common design forms Mark of mature engineering field. Shaw & Garlan Abstraction of recurring composition & interaction characteristics in a set of architectures Taylor

26 Basic Properties of Styles
A vocabulary of design elements Component and connector types; data elements e.g., pipes, filters, objects, servers A set of configuration rules Topological constraints that determine allowed compositions of elements e.g., a component may be connected to at most two other components A semantic interpretation Compositions of design elements have well-defined meanings Possible analyses of systems built in a style

27 Benefits of Using Styles
Design reuse Well-understood solutions applied to new problems Code reuse Shared implementations of invariant aspects of a style Understandability of system organization A phrase such as “client-server” conveys a lot of information Interoperability Supported by style standardization Style-specific analysis Enabled by the constrained design space Visualizations Style-specific depictions matching engineers’ mental models

28 Style Analysis Dimensions
What is the design vocabulary? Component and connector types What are the allowable structural patterns? What is the underlying computational model? What are the essential invariants of the style? What are common examples of its use? What are the (dis)advantages of using the style? What are the style’s specializations?

29 Some Common Styles Interpreter Main program and subroutines
Traditional- Language Influenced Styles Main program and subroutines Object-oriented Layered Styles Virtual machines Client-server Data-flow Styles Batch sequential Pipe and filter Shared Memory Styles Blackboard Rule based Interpreter Styles Interpreter Mobile code Implicit Invocation Styles Event-based Publish-subscribe Peer-to-Peer Styles “Derived” Styles C2 CORBA

30 Traditional, Language-influenced Styles Main-program & Sub-program Object Oriented
The styles are discussed with a common running example of LUNAR LANDER (LL) application

31 Main Program and Subroutines LL
Main program displays greetings and instructions, then enters a loop in which it calls the three subroutines in turn. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

32 Main Program and Subroutines

33 Object-Oriented Style
Components are objects Data and associated operations Connectors are messages and method invocations Style invariants Objects are responsible for their internal representation integrity Internal representation is hidden from other objects Advantages “Infinite malleability (flexibility)” of object internals System decomposition into sets of interacting agents Disadvantages Objects must know identities of servers

34 Object-Oriented LL The object-oriented design of the Lunar Lander game has three encapsulations: the spacecraft, the user’s interface, and the environment (essentially a physics model that allows calculation of the descent rate) Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

35 OO/LL in UML Some details of the object-oriented design are apparent in figure which is a Unified Modelling Language characterization of the objects. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

36 Virtual Machine Client - Sever
Layered Style Virtual Machine Client - Sever

37 Layered Style Hierarchical system organization
“Multi-level client-server” Each layer exposes an interface (API) to be used by above layers Each layer acts as a Server: service provider to layers “above” Client: service consumer of layer(s) “below” Connectors are protocols of layer interaction Example: Operating Systems Virtual Machine Style results from fully opaque (unclear) layers

38 Layered Style (cont’d)
Advantages Increasing abstraction levels Evolvability Changes in a layer affect at most the adjacent two layers Reuse Different implementations of layer are allowed as long as interface is preserved Standardized layer interfaces for libraries and frameworks

39 Layered Style (cont’d)
Disadvantages Not universally applicable Performance Layers may have to be skipped

40 Layered Systems/Virtual Machines
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

41 Layered LL A five-level version of the lunar lander game is shown in Figure 4-11. The top layer handles inputs received from the user through the keyboard; it calls the second layer to service those inputs, Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

42 Layered LL The second layer includes all the details of the lunar lander that pertain to the game logic and the environment simulator. It calls the third layer to begin the process of displaying the updated Lander state to the user. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

43 Layered LL The third layer is a generic, two-dimensional game engine.
Such a layer is capable of supporting any of a wide variety of games that only require two-dimensional graphics. The fourth layer is the operating system, which provides, among other things, platform-specific user interface (UI) support. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

44 Layered LL The bottom layer is provided by firmware or hardware, and
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

45 Client-Server Style A kind of two layer virtual machine style with network connections Server is a virtual machine that is below the Client Components are clients and servers Servers do not know number or identities of clients Clients know server’s identity Connectors are RPC-based network interaction protocols

46 Client-Server LL Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

47 Client-Server LL In the system shown, three players simultaneously and independently play the game. All game state, game logic, and environment simulation is performed on the server. The clients perform the user interface functions. The connectors in this example are Remote Procedure Calls (RPC), which are procedure call connectors combined with a distributor, A distributor identifies network interaction paths and subsequently routes communication along those paths. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

48 Batch-Sequential Pipe and Filter
Data-Flow Styles Batch-Sequential Pipe and Filter

49 Data-Flow Styles Batch Sequential
Separate programs are executed in order; data is passed as an aggregate (collective) from one program to the next. Connectors: “The human hand” carrying tapes between the programs, a.k.a. “sneaker-net ” Data Elements: Explicit, aggregate elements passed from one component to the next upon completion of the producing program’s execution. Typical uses: Transaction processing in financial systems.

50 Batch-Sequential: A Financial Application
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

51 This is obviously not a highly interactive, real-time game!
Batch-Sequential LL This is obviously not a highly interactive, real-time game! Each functional processing step of the game is performed by a separate program. Upon performing the step’s function, the program produces an updated version of the game state, which is then handed off to the next program in the process. After the final step of displaying the game state is performed, the produced tape is carried back to the first program for another pass. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

52 Pipe and Filter Style Components are filters
Transform input data streams into output data streams Possibly incremental production of output Connectors are pipes Conduits for data streams Style invariants Filters are independent (no shared state) Filter has no knowledge of up- or down-stream filters Examples UNIX shell signal processing Distributed systems parallel programming Example: ls invoices | grep -e August | sort

53 Pipe and Filter (cont’d)
Variations Pipelines — linear sequences of filters Bounded pipes — limited amount of data on a pipe Typed pipes — data strongly typed

54 Pipe and Filter (cont’d)
Advantages Intermediate files unnecessary, but possible. File system clutter is avoided and concurrent execution is made possible. Flexibility by filter exchange. It is easy to exchange one filter element for another with the same interfaces and functionality. Flexibility by recombination. It is not difficult to reconfigure a pipeline to include new filters or perhaps to use the same filters in a different sequence.

55 Pipe and Filter (cont’d)
Reuse of filter elements. The ease of filter recombination encourages filter reuse. Small, active filter elements are normally easy to reuse if the environment makes them easy to connect. Rapid prototyping of pipelines. Flexibility of exchange and recombination and ease of reuse enables the rapid creation of prototype systems. Efficiency by parallel processing. Since active filters run in separate processes or threads, pipes-and-filters systems can take advantage of a multiprocessor.

56 Pipe and Filter (cont’d)
Disadvantages Sharing state information is expensive or inflexible. The information must be encoded, transmitted, and then decoded. Efficiency gain by parallel processing is often an illusion. The costs of data transfer, synchronization, and context switching may be high. Data transformation overhead. The use of a single data channel between filters often means that much transformation of data must occur, for example, translation of numbers between binary and character formats. Error handling. It is often difficult to detect errors in pipes-and-filters systems. Recovering from errors is even more difficult.

57 Pipe and Filter LL GetBurnRate runs continuously on its own, prompting the user for a new burn rate. In this design the Compute new values determines how much time has passed. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

58 Blackboard Rule-based
Shared memory Blackboard Rule-based

59 Blackboard Style Two kinds of components
Central data structure — blackboard Components operating on the blackboard System control is entirely driven by the blackboard state Examples Typically used for AI systems Integrated software environments (e.g., Interlisp*) Compiler architecture See other PPT file for more … * Interlisp was a popular Lisp development tool for AI researchers

60 Black- board LL A single connector regulates access from the various experts in manipulating the information on the blackboard. The blackboard maintains the game state; the experts perform the independent tasks of (1) updating the descent engine burn rate based upon input from the user, (2) displaying to the user the current state of the spacecraft and any other aspect of the game state, and (3) updating the game state based upon a time and physics model. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

61 Rule-Based Style Inference engine parses user input and determines whether it is a fact/rule or a query. If it is a fact/rule, it adds this entry to the knowledge base. Otherwise, it queries the knowledge base for applicable rules and attempts to resolve the query.

62 Rule-Based Style (cont’d)
Components: User interface, inference engine, knowledge base Connectors: Components are tightly interconnected, with direct procedure calls and/or shared memory. Data Elements: Facts and queries Behavior of the application can be very easily modified through addition or deletion of rules from the knowledge base. Caution: When a large number of rules are involved understanding the interactions between multiple rules affected by the same facts can become very difficult.

63 Rule Based LL With regard to the user interaction model, the user enters the value of burn rate as a fact: burnrate(25) To see what the status of the spacecraft is, the user can switch to the goal mode and asks whether the spacecraft has landed safely: landed (spacecraft) To handle this query, the inference engine queries the database, If the existing facts and other production rules satisfy the conditions “altitude <= 0” and “velocity < 3 ft/s,” then the engine returns true to the user interface. Otherwise, it returns false Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

64 Basic Interpreter Mobile Code
Interpreter Style Basic Interpreter Mobile Code

65 Interpreter Style Interpreter parses and executes input commands, updating the state maintained by the interpreter Components: Command interpreter, program/interpreter state, user interface. Connectors: Typically very closely bound with direct procedure calls and shared state. Highly dynamic behavior possible, where the set of commands is dynamically modified. System architecture may remain constant while new capabilities are created based upon existing primitives. Superb for end-user programmability; supports dynamically changing set of capabilities

66 Interpreter Style Care should be taken to make the interpreter as flexible as possible, so that the implementation can be changed at later stages without having tight coupling. Other advantage of Interpreter is that you can have more than one interpreter for the same output and create the object of interpreter based on the input

67 Interpreter LL When the user enters “BurnRate(50),” the interpreter takes BurnRate as the command and the parameter as the amount of fuel to burn. It then calculates the necessary updates to the altitude, fuel level, and velocity. Time is simulated by having t incremented each occasion the user enters a BurnRate command. When the user enters the CheckStatus command, the user receives the current state of altitude, fuel, time, and velocity. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

68 Mobile-Code Style It enable code to be transmitted to a remote host for interpretation. This may be due to a lack of local computing power, lack of resources, or due to large data sets remotely located. Mobile code may be classified as: - code on demand, remote evaluation, or mobile agent depending on where the code is being transmitted, who requested the transmission, and where the program state resides.

69 Mobile-Code Style Code on demand is when the initiator has resources and state but downloads code from another site to be executed locally, Remote evaluation is when the initiator has the code but lacks the resources (such as the interpreter) to execute the code, Thus, it transmits code to be processed at a remote host, such as in grid computing. Results are returned to the initiator. Mobile agent is when the initiator has the code and the state but some of resources are located elsewhere. Thus the initiator moves to a remote host with the code, the state, and some of the resources. Processing need not return to the initiator.

70 Mobile-Code Style Summary: a data element (some representation of a program) is dynamically transformed into a data processing component. Components: “Execution dock”, which handles receipt of code and state; code compiler/interpreter Connectors: Network protocols and elements for packaging code and data for transmission. Data Elements: Representations of code as data; program state Variants: Code-on-demand, remote evaluation, and mobile agent.

71 Mobile Code LL One client Web browser downloads code-on-demand in the form of a Lunar Lander game applet via HTTP. A second browser loads a JavaScript Lunar Lander; a third uses some other form that is not detailed. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

72 Mobile Code LL Here, all the game logic moves to the client machines, freeing the server’s computing resources. In the figure as shown, each client machine maintains the game state independently of other clients. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

73 Publish-Subscribe Event-Based Peer-to-Peer
Implicit Invocation Publish-Subscribe Event-Based Peer-to-Peer

74 Implicit Invocation Style
Such styles are characterized by calls that are invoked (called up) indirectly and implicitly (unconditionally) as a response to a notification or an event Ease of adaptation and enhanced scalability are benefits of the indirect interaction between very loosely coupled components.

75 Implicit Invocation Style
Event announcement instead of method invocation “Listeners” register interest in and associate methods with events System invokes all registered methods implicitly Component interfaces are methods and events Two types of connectors Invocation is either explicit or implicit in response to events Style invariants “Announcers” are unaware of their events’ effects No assumption about processing in response to events

76 Implicit Invocation (cont’d)
Advantages Component reuse System evolution Both at system construction-time & run-time Disadvantages No knowledge of what components will respond to event No knowledge of order of responses

77 Publish-Subscribe Subscribers register/de-register to receive specific messages or specific content. Publishers broadcast messages to subscribers either synchronously or asynchronously.

78 Publish-Subscribe (cont’d)
Components: Publishers, subscribers, proxies for managing distribution Connectors: Typically a network protocol is required. Content-based subscription requires sophisticated connectors. Data Elements: Subscriptions, notifications, published information Topology: Subscribers connect to publishers either directly or may receive notifications via a network protocol from intermediaries Qualities yielded Highly efficient one-way dissemination (broadcast) of information with very low-coupling of components

79 Pub-Sub LL Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

80 Pub-Sub LL In the example, the lunar lander software is deployed to various network hosts. Players, who are the subscribers, register their hosts to a game server that publishes information, such as:- new Lunar terrain data, new spacecraft, and the (Lunar) locations of all the registered spacecraft currently playing the game. Once registered, the subscribed hosts receive notifications when any of the information they have registered for has been updated. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

81 Event-Based Style Independent components asynchronously emit and receive events communicated over event buses Components: Independent, concurrent event generators and/or consumers Connectors: Event buses (at least one) Data Elements: Events – data sent as a first-class entity over the event bus Topology: Components communicate with the event buses, not directly to each other. Variants: Component communication with the event bus may either be push or pull based. Highly scalable, easy to evolve, effective for highly distributed applications.

82 Event-based LL Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

83 Event-based LL The clock component drives the game. Every fraction of a second, the clock component sends out a tick notification to the event bus, which distributes that event to the other components. The spacecraft component maintains the state of the spacecraft (its altitude, fuel level, velocity, and throttle setting). Upon receiving a predefined number of notifications from the clock, the spacecraft component recalculates the altitude, fuel level, and velocity (corresponding to simulated flight for that number of ticks) and then emits those values to the event bus. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

84 Event-based LL GUI component drives the game player’s display.
Receipt of events providing the spacecraft’s altitude, fuel, and velocity causes the GUI component to update its display based on those values. The GUI component also obtains new burn rate settings from the user; when this happens the component emits a notification of this new value onto the event bus. The game logic component, receiving both information about the state of the spacecraft and the amount of time that has passed (by counting clock ticks), determines the player’s score. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

85 Peer-to-Peer (P2P) Style
This architectural style consists of a network of loosely coupled autonomous peers (nodes) which can act as either clients or servers Peers communicate using a network protocol. Unlike the client-server style where state and logic are centralized on the server, P2P decentralizes both information and control. Peers: independent components, having their own state and control thread. Connectors: Network protocols, often custom. Data Elements: Network messages

86 Peer-to-Peer Style (cont’d)
Topology: Network (may have redundant connections between peers); can vary arbitrarily and dynamically Supports decentralized computing with flow of control and resources distributed among peers. Highly robust (strong) in the face of failure of any given node. Scalable in terms of access to resources and computing power.

87 Peer-to-Peer LL In the example of Figure, a group of lunar lander spacecraft are on their way to land in different parts of the moon. Multiple Landers are used in this example to highlight that the P2P architectural style is designed to support interaction between highly autonomous components. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

88 Peer-to-Peer LL Lunar Lander 1 (LL1) wants to find out if another spacecraft has already landed in a specific area, so that collisions can be avoided. Each of the spacecraft is configured to communicate with the others using a P2P protocol over a network. A spacecraft will only be able to communicate with others that are within a specified, limited distance. Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

89 More Complex Styles

90 Heterogeneous Styles More complex styles created through composition of simpler styles REST Complex history presented later in course C2 Implicit invocation + Layering + other constraints Distributed Objects OO + client-server network style CORBA

91 C2 Style An indirect invocation style in which independent components communicate exclusively (entirely) through message routing connectors. Strict rules on connections between components and connectors induce layering.

92 C2 Style (cont’d) Components: Independent, potentially concurrent message generators and/or consumers Connectors: Message routers that may filter, translate, and broadcast messages of two kinds: notifications and requests. Data Elements: Messages – data sent as first-class entities over the connectors. Notification messages announce changes of state. Request messages request performance of an action. Topology: Layers of components and connectors, with a defined “top” and “bottom”, wherein notifications flow downwards and requests upwards.

93 C2 LL Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

94 KLAX Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

95 KLAX in C2 Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

96 Distributed Objects: CORBA
“Objects” (coarse- or fine-grained) run on heterogeneous hosts, written in heterogeneous languages. Objects provide services through well-defined interfaces. Objects invoke methods across host, process, and language boundaries via remote procedure calls (RPCs). Components: Objects (software components exposing services through well-defined provided interfaces) Connector: (Remote) Method invocation Data Elements: Arguments to methods, return values, and exceptions Topology: General graph of objects from callers to callees. Additional constraints imposed: Data passed in remote procedure calls must be serializable. Callers must deal with exceptions that can arise due to network or process faults. Location, platform, and language “transparency”. CAUTION

97 CORBA Concept and Implementation
Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

98 CORBA LL Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc. Reprinted with permission.

99 Observations Different styles result in Different architectures
Architectures with greatly differing properties A style does not fully determine resulting architecture A single style can result in different architectures Considerable room for Individual judgment Variations among architects A style defines domain of discourse About problem (domain) About resulting system

100 Style Summary (1/4)

101 Style Summary, continued (2/4)

102 Style Summary, continued (3/4)

103 Style Summary, continued (4/4)

104 Design Recovery What happens if a system is already implemented but has no recorded architecture? The task of design recovery is examining the existing code base determining what the system’s components, connectors, and overall topology are. A common approach to architectural recovery is clustering of the implementation-level entities into architectural elements. Syntactic clustering Semantic clustering

105 Syntactic Clustering Focuses exclusively on the static relationships among code-level entities Can be performed without executing the system Embodies inter-component (a.k.a. coupling) and intra-component (a.k.a. cohesion) connectivity May ignore or misinterpret many subtle relationships, because dynamic information is missing

106 Semantic Clustering Includes all aspects of a system’s domain knowledge and information about the behavioral similarity of its entities. Requires interpreting the system entities’ meaning, and possibly executing the system on a representative set of inputs. Difficult to automate May also be difficult to avail oneself of it

107 When There’s No Experience to Go On…
The first effort a designer should make in addressing a novel design challenge is to attempt to determine that it is genuinely a novel problem. Basic Strategy Divergence – shake off inadequate prior approaches and discover or admit a variety of new ideas Transformation – combination of analysis and selection Convergence – selecting and further refining ideas Repeatedly cycling through the basic steps until a feasible solution emerges.

108 Analogy Searching Examine other fields and disciplines unrelated to the target problem for approaches and ideas that are analogous to the problem. Formulate a solution strategy based upon that analogy. A common “unrelated domain” that has yielded a variety of solutions is nature, especially the biological sciences. E.g., Neural Networks

109 Brainstorming Technique of rapidly generating a wide set of ideas and thoughts pertaining to a design problem without (initially) devoting effort to assessing the feasibility. Brainstorming can be done by an individual or, more commonly, by a group. Problem: A brainstorming session can generate a large number of ideas… all of which might be low-quality. The chief value of brainstorming is in identifying categories of possible designs, not any specific design solution suggested during a session. After brainstorm the design process may proceed to the Transformation and Convergence steps.

110 “Literature” Searching
Examining published information to identify material that can be used to guide or inspire designers Many historically useful ways of searching “literature” are available Digital library collections make searching extraordinarily faster and more effective IEEE Xplore ACM Digital Library Google Scholar The availability of free and open-source software adds special value to this technique.

111 Morphological Charts The essential idea:
identify all the primary functions to be performed by the desired system for each function identify a means of performing that function attempt to choose one means for each function such that the collection of means performs all the required functions in a compatible manner. The technique does not demand that the functions be shown to be independent when starting out. Sub-solutions to a given problem do not need to be compatible with all the sub-solutions to other functions in the beginning.

112 Removing Mental Blocks
If you can’t solve the problem, change the problem to one you can solve. If the new problem is “close enough” to what is needed, then closure is reached. If it is not close enough, the solution to the revised problem may suggest new venues for attacking the original.

113 Controlling the Design Strategy
The potentially chaotic (disordered) nature of exploring diverse approaches to the problem demands that some care be used in managing the activity Identify and review critical decisions Relate the costs of research and design to the penalty for taking wrong decisions Insulate uncertain decisions Continually re-evaluate system “requirements” in light of what the design exploration yields

114 Insights from Requirements
In many cases new architectures can be created based upon experience with and improvement to pre-existing architectures. Requirements can use a vocabulary of known architectural choices and therefore reflect experience. The interaction between past design and new requirements means that many critical decisions for a new design can be identified or made as a requirement

115 Insights from Implementation
Constraints on the implementation activity may help shape the design. Externally motivated constraints might dictate Use of a middleware Use of a particular programming language Software reuse Design and implementation may proceed cooperatively and contemporaneously Initial partial implementation activities may yield critical performance or feasibility information


Download ppt "Designing Architectures"

Similar presentations


Ads by Google