Presentation is loading. Please wait.

Presentation is loading. Please wait.

Unit 4 - Architectural Styles By Prof. Dr. Chandramouli.

Similar presentations


Presentation on theme: "Unit 4 - Architectural Styles By Prof. Dr. Chandramouli."— Presentation transcript:

1 Unit 4 - Architectural Styles By Prof. Dr. Chandramouli

2 Unit 4 - ARCHITECTURAL STYLES Syllabus Introduction Data flow styles – Call-return styles – Shared Information styles – Event styles Case studies for each style.

3 3 Common Architectural Styles of our Homes

4 What is Architectural style ? To keep the integrity of the architecture from programming structure ( low level) to the application structure ( high level), a few key features and rules to integrate them are used. These features and rules are called “Architectural style”

5 Components affecting styles Runtime function components – Data Repository – Process – Procedure … Constraints – No ‘edit’ allowed on repository data; Only sequential updates ! … Communication between components – Subroutine call – Remote procedure call – Data streams – Data sockets …

6 Benefits of styles Reuse – Design ( Appointment system Vs Reservation system ) – Code ( Calendar function) Understandability Interoperability Style specificity

7 Common styles Traditional, language-influenced – Main program and subroutines – Object-oriented Layered – Virtual machines – Client-server Data-flow – Batch sequential – Pipe and filter Shared memory – Repository – Blackboard – Rule based Interpreter – Interpreter – Mobile code Implicit invocation – Event-based – Publish-subscribe Peer-to-peer

8 Traditional, language-influenced ( Main program and subroutines)

9 Main Program and Subroutines 9

10 Call and Return style It is the classical programming paradigm (Used for the past 30+ years). The requester ( main prog) calls for a service from a subroutine and waits until a requested service completes its actions and return the control to main program with the result. A program is decomposed hierarchically. There is typically a single thread of control and each component in the hierarchy gets this control (optionally along with some data) from its parent and passes it along to its children. The goal is to decompose a program into smaller pieces to help achieve modifiability.

11 Remote procedure call Main program and subroutine systems that are decomposed into parts that live on different computers connected via a network. The goal is to increase performance by distributing the computations and taking advantage of multiple processors. In remote procedure call systems, the actual assignment of parts to processors is deferred until runtime, meaning that the assignment is easily changed to accommodate performance tuning. In fact, except that subroutine calls may take longer to accomplish if it is invoking a function on a remote machine, a remote procedure call is indistinguishable from standard main program and subroutine systems.

12 Traditional, language-influenced (Object-oriented) Object Method

13 Object oriented Here, the objects are components that provide black- box services e.g an object (4 legged animal with its attributes) inherits other component ( e.g cat/ dog with its attributes) thro methods. This bundle is an encapsulation that hides its internal secrets from its environment. The user of a service need not know, and should not know, anything about how that service is implemented.( information hiding) This encapsulation promotes reuse and modifiability, principally because it promotes separation of concerns.

14 Object-Oriented 14

15 Advantages and Disadvantages Advantages – Can break problems into interacting agents – Can distribute across multiple machines or networks – Change implementation without affecting clients Disadvantages – Objects must know their interaction partners; when partner changes, clients must change – Side effects: if A uses B and C uses B, then C’s effects on B can be unexpected ( unknown) to A ABC

16 LAYERED STYLE

17 An ordered sequence of layers, each layer offers services (interfaces) that can be used by programs (components) residing with the layer(s) above it. In this, the components are assigned to layers to control inter component interaction. In the pure version of this architecture, each level communicates only with its immediate neighbours. The goal is to achieve the qualities of modifiability and portability. Layer bridging: functions is one layer may talk to other than its immediate neighbor

18 Advantages and Disadvantages Advantages – They support designs based on increasing levels abstraction. – Allows implementers to partition a complex problem into a sequence of incremental steps. – They support enhancement – They support reuse. Disadvantages – Not easily all systems can be structures in a layered fashion. – Performance may require closer coupling between logically high-level functions and their lower-level implementations.

19 LAYERED STYLE (VIRTUAL MACHINES) Virtual machines are SWA style that simulate some functionality that is not native to the hardware and/or software on which it is implemented.

20 VM benefits It can allow one to simulate (and test) platforms that have not yet been built (such as new hardware), and it can simulate "disaster'' modes (as is common in flight simulators and safety- critical systems) that would be too complex, costly, or dangerous to test with the real system. Common examples of virtual machines are interpreters, rule-based systems, syntactic shells, and command language processors

21 Network Client Server(s) dB Print Application LAYERED STYLE (Client - Server)

22 Client-Server LL 22

23 LAYERED STYLE (Client - Server) One or many servers provide services to instances of subsystems, called clients Each client calls on the server, which performs some service and returns the result The clients know the interface of the server The server does not need to know the interface of the client The response in general is immediate End users interact only with the client.

24 CS – e.g Library Management System Client -end: User application (LMS) – Customized user interface – Front-end processing of data – Initiation of server remote procedure calls – Access to database server across the network Server-end: Database access and manipulation (server) – Centralized data management – Data integrity and database consistency – Database security – Concurrent operations (multiple user access) – Centralized processing (for example archiving)

25 Thick and Thin Clients Thick (or “fat”) client ( with data storage facility - HDD) – Does as much processing as possible – Passes only data required for communications and archival storage to the server – Advantages: less network bandwidth, fewer server requirements Thin client ( only OS and Browser in ROM) – Has little or no application logic – Depends primarily on the server for processing activities – Advantages: lower IT admin costs, easier to secure, lower hardware costs.

26 Advantages and disadvantages Advantages – Makes effective use of networked systems – May allow for cheaper hardware – Easy to add new servers or upgrade existing servers – Increased Availability (redundancy) Disadvantages – Data interchange can be hampered by different data layouts – Communication may be expensive – Data integrity functionality must be implemented for each server – Single point of failure ( affects all clients)

27 DATAFLOW STYLE Dataflow styles focus on how data moves between processing elements. T The data-flow style is characterized by viewing the system as a series of transformations on successive pieces of input data. Data enter the system and then flows through the components one at a time until they are assigned to some final destination (output or a data store). A data flow system is one in which: – the structure of the design is determined by the motion of data from component to component – the availability of data controls the computation – the pattern of data flow is explicit Variations – Batch Sequential – Pipe and Filter

28 Dataflow ( Batch Sequential) Date format check Standard format Use logic To validate

29 Batch-Sequential LL Not advisable for a successful lunar mission!

30 Batch-Sequential: A Financial Application (e.g Dayend, Payroll)

31 Batch sequential style Processing steps, or components, are independent programs. The assumption is that each step runs to completion before the next step starts. Each batch of data is transmitted as a whole between the steps. The typical application for this style is classical data processing. – Payroll computations – Tax reports – Patient management – Student management – Library management etc..

32 Dataflow ( Pipe and Filter) Data Flow Controls

33 Pipe and Filter

34 Dataflow ( Pipe and Filter) Components (filters) are connected through connector, (pipe). A pipe is a connector that conveys streams of data from the output port of one filter to the input port of another filter. A filter is a data transforming component that reads streams of data through one or more input ports and writes streams of data to one or more output ports. Pipes provide an order-preserving, buffered communication channel to transmit data generated by filters. The only way that filters interact with each other is through pipes.

35 Dataflow ( Pipe and Filter) … Computation in a pipe-filter system proceeds in a data-driven fashion The availability of data on the input ports of its filters allows them to compute values that are written to their output ports. Because pipes buffer data in the communication, filters can act asynchronously, concurrently, and independently. Pipes must connect output ports to input ports Pipe-filter systems are often associated with implementations in which filters are separate processes( programs written by us), and operating systems infrastructure is used to provide pipe communication between the processes. – The best known example is Unix, LEX/YACC based compiler, DIP etc

36 Advantages and Disadvantages Advantages – Makes it easy to understand overall function of the system as a composition of filter functions – Encourages reuse of filters: any two filters can be connected if they agree on data format – Facilitates maintenance: filters can be added or replaced – Facilitates deadlock and throughput analysis – Potential for parallelism: filters implemented as separate tasks, consuming and producing data incrementally Disadvantages – Often leads to batch-type processing – Not good for interactive applications – Can’t coordinate stream inputs – Data transmission critical for system performance – Sharing global data expensive or limiting – Scheme is highly dependent on order of filters – Can be difficult to design incremental filters – Error handling is difficult – Data type must be greatest common denominator, e.g. ASCII

37 Shared Memory style Repository Black board Rule based

38 Shared Memory Style Features – Consumer’s knowledge on data availability Store informs the consumer – blackboard Consumer is responsible - repository – Used when there are multiple accessors and persistence – Decouple producer from consumer – Data store performance, security, privacy, compatibility with other stores… Used in – Artificial Intelligence (AI) - Rule based – Compiler architecture – Rule based – Facebook Chat – Black board – Google drive - Repository

39 Shared Memory Style (REPOSITORY)

40 Shared Memory Style (REPOSITORY)… A repository architecture consists of a central data structure (often a database) and a collection of independent components which operate on the central data structure. Subsystems access and modify data from a single data structure called the repository Subsystems are loosely coupled (interact only through the repository) Control flow is dictated by the repository through triggers or by the subsystems through locks and synchronization primitives

41 Shared Memory Style (Black board)

42 Blackboard 42

43 Shared Memory Style (Black board) A Blackboard is a database into which a process can insert, retrieve, or remove data. Allows multiple processes to communicate by reading and writing information and requests to a global data store. Each participating process has expert knowledge in its own. Solution to a problem depends not only on a subsystem but also on other subsystems Processes communicate strictly through the common blackboard whose content is visible to all processes. A control unit is responsible for selecting an appropriate process to solve it.

44 Advantages and Disadvantages Advantages – Efficient way to share large amounts of data – Data integrity localized to repository module – Solution strategies should not be preplanned – Data/problem determines the solutions Disadvantages – Subsystems must agree (i.e., compromise) on a repository data model – Schema evolution is difficult and expensive – Distribution can be a problem – Interaction between “independent” programs needs a complex regulation – Data on the blackboard is a subject to frequent change

45 Shared Memory Style (Rule based) A list of rules or rule base, which is a specific type of knowledge base.knowledge base An inference engine or semantic reasoner, which infers information or takes action based on the interaction of input and the rule base. The interpreter executes a production system program by performing the following match-resolve- act cycleinference enginesemantic reasoner Temporary working memory.working memory A user interface or other connection to the outside world through which input and output signals are received and sent.user interface

46 e.g. Game of Chess - AI

47 Rule Based 47

48 Shared Memory Style (Rule based) 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. 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. Rule-based systems are used as a way to store and manipulate knowledge to interpret information in a useful way. They are often used in artificial intelligence applications and research.artificial intelligence Rule-based systems can be used to perform lexical analysis to compile or interpret computer programs, or in natural language processing.lexical analysiscompilenatural language processing

49 INTERPRETER STYLE (INTERPRETER) 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 Used in : LISP, Java VM ( translates Java code to platform independent byte code)

50 INTERPRETER components Interpretation engine: to do the work Memory: that contains pseudo code to be interpreted. Representation of control state of interpretation engine Representation of control state of the program being simulated

51

52 Interpreter 52

53 Advantages and Disadvantages Advantages – 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. Disadvantages – Performance takes longer to execute the interpreted code but many optimizations might be possible – Memory management when multiple interpreters are invoked simultaneously

54 INTERPRETER STYLE (Mobile code) 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; data Variants: Code-on-demand, remote execution, and mobile agent. Examples : processing large amounts of distributed data, dynamic behavior / customization

55 Mobile Code Scripting languages (i.e. JavaScript, VBScript), ActiveX control, embedded Word/Excel macros.

56 Advantages and Disadvantages Advantages – dynamic adaptability – performance (resources) Disadvantages – security challenges – network/transmission costs

57 IMPLICIT INVOCATION STYLE ( Event Based) Independent components asynchronously emit and receive events communicated over event buses Events – data sent as a first-class entity over the event bus Components communicate with the event buses, not directly to each other. Component communication with the event bus may either be push or pull based. Highly scalable, easy to evolve, effective for highly distributed applications. Simplify system design, development, and testing because they minimize relationships between system parts

58 Event Bus Component

59 Event-based

60 Event processing styles Simple event processing – Directly related to specific, measurable changes of condition – A notable event happens which initiates downstream action(s) – Used to drive the real-time flow of work, thereby reducing lag time and cost Event stream processing – Both ordinary and notable events happen – Ordinary events (orders, RFID transmissions) are screened for notability and streamed to information subscribers – Used to drive the real-time flow of information in and around the enterprise, which enables in-time decision making Complex event processing – Allows patterns of simple and ordinary events together to be considered to infer that a complex event has occurred – Evaluates a confluence of events and then takes action – Used to detect and respond to business anomalies, threats, and opportunities

61 Example use Programming environment - tools integration Editor announces it has finished editing a module Compiler registers for such announcements and automatically re-compiles module Editor shows syntax errors reported by compiler Debugger announces it has reached a breakpoint Editor registers for such announcements and automatically scrolls to relevant source line

62 IMPLICIT INVOCATION STYLE Features – Subscribers connect to publishers directly (or through network) – Components communicate with the event bus, not directly to each other Advantages – Strong support for reuse: plug in new component by registering it for events – Maintenance: add and replace components with minimum effect on other components in the system Disadvantages – Sometimes become quite unpredictable – Hard to control.

63 Advantages and Disadvantages Advantages – Scalable – Easy to evolve – Heterogeneous (as long as components can communicate with the bus they can be implemented in any possible way) Disadvantage – No guarantee when the event will be processed

64 IMPLICIT INVOCATION STYLE (PUBLISH-SUBSCRIBE ) Subscribers register/deregister to receive specific messages or specific content. Publishers broadcast messages to subscribers. Analogy: newspaper subscription Subscriber chooses the newspaper Publisher delivers only to subscribers. Publisher has to maintain a list of subscribers Sometimes proxies may be needed to manage distribution. It is the job of publish-subscribe runtime infrastructure to make sure that each published event is delivered to all subscribers of that event.

65 Routine

66 Pub-Sub 66

67 Message Filtering Subscribers typically receive only a subset of the total messages published. The process of selecting messages for reception and processing is called filtering. Two forms : Topic-based system : messages are published to "topics" or named logical channels. Subscribers receive all messages published to the topics to which they subscribe, and all subscribers to a topic will receive the same messages. The publisher is responsible for defining the classes of messages to which subscribers can subscribe. ( cricinfo –latest score only / score card) Content-based system : messages are only delivered to a subscriber if the attributes or content of those messages match constraints defined by the subscriber. The subscriber is responsible for classifying the messages. ( any search engine) Some systems support a hybrid of the two : publishers post messages to a topic while subscribers register content-based subscriptions to one or more topics.

68 Example use of publish/subscribe Social media “friending” GUI (Role based apps) Multi-player network-based games ( FIFA ) WhatsApp group

69 Advantages and Disadvantages Advantages – Subscribers are independent from each other – Very efficient one-way information dissemination Disadvantages – When a number of subscribers is very high, special protocols are needed

70 PEER-TO-PEER STYLE State and behavior are distributed among peers which can act as either clients or servers. No asymmetry as in client-server. Peers: independent components, having their own state and control thread. Connectors: Network protocols, often custom. Data Elements: Network messages 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 in the face of failure of any given node. Scalable in terms of access to resources and computing power.

71 Peer-to-Peer LL 71

72 Advantages and Disadvantages Advantages – Robustness (if a node is not available the functionality is taken over) – Scalability – Decentralization Disadvantages – Security (peers might be malicious or egoistic) – Latency (when information retrieval time is crucial)

73 Question Bank – 2 marks 1.What is architectural style ? 2.What components affect the architectural styles? 3.What are the benefits of using architectural styles ? 4.List the common styles used in SWA ? 5.Define an architectural pattern. 6.Differentiate Architectural Style and Architectural Pattern. 7.What do you mean by concurrent processing? 8.Explain call and return style 9.What do you understand by remote procedure call ? 10.Mention the variations in data flow systems. 11.List the key aspects of routines. 12.What are called layered systems? 13.State the strengths and weakness of layered systems. 14.Mention some of the properties of object oriented architecture. 15.List some examples for event based implicit invocation. 16.State the properties of layered system 17.What do you mean by open and closed layered architecture? 18.What are the properties of a model-view-controller? 19.What do you mean by code-on-demand? 20.What are called distributed process architecture?

74 Question Bank – 2 marks 21.What are called State-Transition Architecture ? 22.Differentiate between thick and thin clients 23.Mention the properties of pipes and filters. 24.What are the components in blackboard system architecture? 25.What are the uses of rule-based systems? 26.Give an example of an event-driven architecture. 27.What do you mean by match-resolve-act in a rule-based system? 28.Mention some of the message delivery issues in a pub/sub system. 29. List some of the heterogeneous styles. 30.State the application areas where shared memory style can be used.

75 Question Bank – 16 marks 1.Discuss the various call-return styles considering suitable examples. 2.Explain object oriented style with its advantages and disadvantages 3.Explain various type of layered style with its advantages and disadvantages 4.Explain the various data flow styles with suitable examples. 5.Describe the shared information architectural styles stating its pros and cons. 6.Explain various type of Interpreter style with its advantages and disadvantages 7.Explain various type of implicit invocation style with its advantages and disadvantages 8.Explain the peer to peer style in detail.


Download ppt "Unit 4 - Architectural Styles By Prof. Dr. Chandramouli."

Similar presentations


Ads by Google