Categorization of Software Architectures Dataflow architectures Pipes and Filters Batch sequential Independent components Client-server systems Parallel communicating processes Event systems Service-Oriented Architecture (SOA) Virtual machines Interpreters Rule-based systems Repository architectures Databases Hypertext systems Blackboards Layered architectures
Data Flow Architectures Each processing unit of the Data Flow Diagram is designed INDEPENDENTLY of the others Data arises from sources, such as the users and flows back to users or collapse such as account databases.
Partial Data Flow Diagram for ATM Application member banks Get deposit Get inquiry User bank name error account # error account # & deposit account display Validate deposit Validate inquiry Display account Make inquiry account # account # & deposit Printer account data balance query Do deposit transaction Create account summary deposit transaction account data account database
Pipe and Filter Architecture Processing elements (filters) accept streams as input (sequences of a uniform data elements) at any time, and produce output streams Each filter must be designed to be implemented of the other filters. The advantage is modularity
Pipe and Filter Style Advantages: Simplicity – Allows designer to understand overall input/output behavior of a system in terms of individual filters. Maintenance and reuse Concurrent Execution –Each filter can be implemented as a separate task and be executed in parallel with other filters.
Pipe and Filter Style Disadvantages Interactive transformations are difficult Filters being independent entities designer has to think of each filter as providing a complete transformation of input data to output data. No filter cooperation. Performance – may force a lowest common denominator on data transmission -parse and unparse
Data Flow Architecture I: Pipe and Filter Architectures stream > Stateless data stream Source end feeds filter input and sink receives output. pipe filter filter filter filter pipe Independent entities Does not share state with other filters. filter < stream
Responsibilities and Collaborations of Pipes and Filters A filter takes a message from its input, applies a transformation, and sends the transformed message as output. A pipe transports messages between filters. (Sources and sinks are special filters without inputs or outputs.) Collaborations A filter produces and consumes messages. A pipe connects the filter with the producer and the consumer. A pipe transports and buffers messages
Example of Pipe & Filter Data Flow Architecture The application maintains accounts as transactions arrives at random times from communication lines. The architecture includes a step for logging transactions in case of system failure . The processing elements wait until all of the input has arrived before processing account data deposit account data transaction result account data deposit data Bank data transaction Log analyze record transaction Comm withdrawal transaction result bank address withdraw A character stream example withdraw function’s input is AliBasHesapNo1234Miktar 34566TL or , bank address is BankNumara234. account data
Printing Web service with Pipes and Filters Incoming messages are based on the XML specification Each agency has added proprietary extensions to the standard transactions. A print request message specifies the type of document to be generated ( HTML or PDF…) The request also includes policy data (client information, endorsements,… ). The Web service processes the proprietary extensions and adds the jurisdiction-specific information that should appear on the printed documents (local or regional requirements,…) The Web service then generates the documents in the requested format and returns them to the agency management system. These processing steps can be implemented as a single transformation within the Web service. But this solution does not let reuse the transformation in a different context. For new requirements, it is required to change several components of the Web service.
Pipes and Filters provides an alternative for the printing Web service. The solution involves three separate transformations. The transformations are implemented as filters that handle conversion, enrichment, rendering.
Data Flow Architecture II : Batch Sequential Data Flow Architecture Requirement: Manage bank funds available for mortgages & unsecured lending. Architecture: Collect mortgage funds Mortgage pool Account balances Collect unsecured funds Unsecured pool
Bath Sequential Architecture Processing elements are only given batches of data, the result is a batch sequential form of data flow. Disadvantages of DFD is the fact that they don’t map cleanly to code, whether object oriented or not.
Independent Components Architecture Independent components are operated in parallel and communicated with each other from time to time. This can be found on the WWW, where millions of servers and browsers continuously in parallel and periodically communicate each other Components are portions of software that do not change and that do not require knowledge of the software using them.
Independent Component Examples .NET assemblies and Java NetBeans are example component technologies Eclipse is a development platform designed to accommodate plug-ins. These are independent components that can be created by developers for various purposes, and added to the platform without affecting existing functionality
Independent Components I : Tiered and Client Server Architectures The server component serves the needs of the client upon requests Client server architectures have the advantage of low coupling between the components. When more than one person performs implementation, developers’ packages are often related as client and server It is naturel to parcel out (tie up) a package of classes to each developer and developers require the services of classes for which others are responsible
Independent Components I : (cont’d) Tiered and Client- Server Architectures A server component acts more effectively when its interface is Narrow. Narrow means that the interface (a collection of functions) contains only necessary parts , is collected in one place , is clearly defined. If a third tier lies between client and server, three-tiered architecture is constituted.
Client-Server Architecture The computer runs software called the client and it interacts with another software known as the server located at a remote computer. The client is usually a browser such as Internet Explorer, Netscape Navigator or Mozilla. Browsers interact with the server using a set of instructions called protocols. These protocols help in the accurate transfer of data through requests from a browser and responses from the server. There are many protocols available on the Internet. The World Wide Web, which is a part of the Internet, brings all these protocols. We can use HTTP, FTP, Telnet, email etc. from one platform (web browser.)
Example I : Two –Tiered Client-Server Architecture Static HTML pages The client (browser) requests for an HTML file stored on the remote machine through the server software. The server locates this file and passes it to the client. The client then displays this file on machine. In this case, the HTML page is static. Static pages do not change until the developer modifies them.
Example II: CGI Scripts The server has to do more work since CGI programs consume the server machine's processing power. Suppose a searchable form on a web page that runs a CGI program and browser sends the request to the server. The server checks the headers and locates the necessary CGI program and passes it the data from the request The CGI program processes this data and returns the results to the server. The server then sends this formatted in HTML to the browser which in turn displays the HTML page. Thus the CGI program generates a dynamic HTML page. The contents of the dynamic page depend on the query passed to the CGI program.
-Server Side Scripting Technologies Example III: Client-Server Architecture -Server Side Scripting Technologies This case also involves dynamic response generated by the use of server side technologies. There are many server side technologies Active Server Pages (ASP): A Microsoft technology (the extension .asp). PHP: Hypertext Preprocessor (PHP): An open source technology. PHP (.php, .phtml or .php3 ) Java Server Pages: .jsp pages contain Java code. Server Side Includes (SSI): Involves the embedding of small code snippets inside the HTML page.(.shtml as its file extension).
Independent Components II: Parallel Communication Processes Architecture Several processes or threads are executed at the same time A process as the combination of parallel parts can simplify the design (Disjkstra) An example of this is a simulation of bank customers Traditionally, many much simulations were designed without parallelism by storing and handling the events However such design can sometimes be simplified , if the movement of each customer is a separate process (a thread object in Java) Such a parallel communicated process matches more closely to the activities that it simulates.
Platforms for Communicating Processors Parallel processes may run on a single platform or on separate platforms as in figure comunication execution
Example I Parallel Communicating Processes Architecture Requirement: Manage ATM traffic. Architecture beginning with first session: Customer_n :Customer: session_m :Session customer_n_ checking :Account ‡ 1 2 3 Customer n creates session m Session m retrieves an Account object customer n checking. The retrieval is performed asynchronously . A thread (parallel process) is created create retrieve* 4 5 deposit deposit* (more work) (thread detail omitted)*
Processing of the Parallel Architecture step by step (1)An object for customer is created (2)Customer n creates session m . (3)Session m retrieves an Account object customer n checking The retrieval is performed asynchronously . A thread (parallel process) is created because it may take time. This allows the customer to carry out other business in the same time. (4)The customer object immediately performs a deposit transaction by sending a message to the Session object (5) The session object executes the deposit transaction by sending a message to the session object, producing a new thread Other work can go on while deposit is processed
Example II: Parallel Communicating Processes Architecture Manage ATM traffic. customer_ s_saving : Account Architecture: 1 Customer_n :Customer: session_m :Session session_k :Session customer_n_ checking :Account 2 3 customer s :Customer create retrieve* create retrieve* 4 5 deposit deposit* withdraw withdraw* (thread detail omitted)*
Independent Components III: Event System Architectures and Design Patterns Many set of components are viewed . Each of them waits until an event occurs that effect it. A word processor waits for the user to click on an icon. It then reacts. Event systems are achieved as state transaction systems . The state pattern solves the problem how to use an object without having to know its state.
State Design Pattern Applied to Game Encounter RolePlayingGame RPGame handleEvent() state GameState handleEvent() { state.handleEvent(); } EncounterGame State design pattern can be used to handle the states and actions of Encounter. The framework class RPGGame (role-playing game) has an attribute called state , which is of type GameState. The subtype of state (which class of GameState it belong to) determines what happens when handleEvent() is called on an RPGameObject. The code for handleEvent() in RPGGame passes control to the handleEvent() function of state.
Virtual Machine Architectures Threats an application as a program written in a specific-purpose language. Since an interpreter for such a language has to be built , this architecture is effective only if several programs are to be written in the language, generating several applications Advantages: If the application consists of processing of complex entities, and if these entities (such as the orders in an example) are readily describable by a grammar. Application 2 Interpreter Program 2 written in language understood by interpreter Application 1 Interpreter Program 1 written in language understood by interpreter Leveraging Interpreter to Facilitate Creation of Applications
Layered Architectures An architectural layer is a coherent collection of software artifacts (like a package of classes) A layer uses at most one other layer and is used by at most one other layer Building application layer by layer can simplify the process Some layers, such as frameworks can serve several applications.
Layered Architecture 3D engine layer Role-playing game layer «uses» Characters RolePlayingGame Layout «uses» Application layer Encounter Characters Encounter Environment Encounter Game
Application Framework Library Framework Layer Application Layer Framework Layer StarOffice API Application Framework Library SVX Library Infrastructure Layer From http://www.openoffice.org/white_papers/tech_overview/tech_overview.html#3
Layered Architecture Example Using Aggregation Ajax common library contains classes throughout Ajax applications and adresses Architecture: “uses” Ajax bank printing Layer Accounts Layer Ajax bank common library Layer Vendor-supplied Layer Class model: (relationships within packages not shown) Ajax bank printing Printer Formatter Page Accounts Vendor-supplied layer not shown Account Customer Ajax bank common library AjaxLogo AjaxDisclaimer Regulations
Repository Architectures An architecture built primary around data is called a repository architecture. These systems are designed to perform transactions against a database For example , an electric company maintains a data base customers that includes details about them. Other examples are IDEs (ınteractive development Environment IDEs apply processes such as editing and compiling to a database of source and object files.
A Typical Repository Architecture GUI Analysis process 1 Analysis process n Control …... …... DBMS This figure mixes the data flow between entities and control . «Control «means that one of the entities prompts the operation of other (for example turns it on and off) Database Key: Control flow: Data flow:
More Repository Architectures Blackboard architectures developed for artificial intelligence applications are repositories that behave in accordance with posting rules Hypertext architecture The most common use of hypertext is on the Web. An application that manages the artifacts of a software engineering application The word repository used in industry to denote a application that provides a unified view of a collection of databases (not just one) – Data Warehouses Repositories don’t change the structure of databases, but they allow uniform access to them .
When is Repository Architecture Preferred? Many applications make their databases their core, therefore repository architectures occupy significant part of applications. When the processing is negligible compared to the formatting of data from the database, repository architectures are appropriate.
Bank Teller Analogy for Service-Orientation Different types of tellers offer different services – Tellers specialized to perform only certain types of transactions (which are typically closely related) Example partitioning: •Account Management (Opening and closing accounts) Credits (inquiry about conditions, consulting, applying for mortgages) Cash Register (Withdrawals, deposits, funds transfers) Currency exchange (buy and sell foreign currencies) There may be several tellers offering the same set of services (for load balancing / failover) What happens behind the counter is not your business (bulletproof glass, iron bars) If you require a complex transaction, you may have to visit several tellers (customer as transaction coordinator
Service (Definition) A service is a package of closely related standardized Functions They are called repeatedly in a similar fashion, therefore it may be implemented by a dedicated facility, which can be specialized to perform them. Example: Account Management – A service can be partitioned and have multiple service functions. Example: Open new account – The smallest subunits within service functions are called service primitives. Example: Generate next available account number
Characteristics to completely describe a service Service requester (“client”) Who/which components use or need the service? For the service requester, the provided service is most important, and not how it is implemented (principle of information and implementation hiding) Service provider (“server”) Who/which components implement or provide the service? is responsible for hosting the service, and ensuring the promised QoS may charge for service usage Qualities of Service (QoS) What are the parameters that allow to distinguish good service provisioning from bad? Examples: Reliable, predictable execution, cost, execution time, level of privacy, other guarantees
Interface An interface constitutes the specification of a service, that is implemented by a certain component. The interface defines a contract, to which the component that implements it has to comply. Signature of interfaces can be described using formal languages Web Services Description Language (WSDL) OMG/ISO Interface Definition Language (IDL) (for CORBA) UML Object Constraint Language (OCL) But also: Java, C++ headers, . . . Type-safe interfaces sometimes introduce tight coupling Web Services don’t force you into type-safe interfaces Different message types may be acceptable to a service
Software Architecture Software architecture encompasses the set of significant decisions about the organization of a software system selection of the structural elements from which the systemis composed, and the interfaces to these behavior as specified in collaborations among those elements (de)composition of these structural and behavioral elements into a larger system architectural style that guides this organization
Service-Oriented Architecture The architectural style of an application is called service-oriented if it meets the following criteria: It is not monolithic; common blocks of functionality are broken out of the applications and are instead provided by services A significant part of the overall functionality is implemented by services, which exist otherwise independent of the application Design elements for an SOA are: Components: services (can be composites), consumers, providers Connector type: (remote) service invocations Configuration rules for an SOA are: No strict layering (service implementations can use other services) No centralized control entity Services are designed for shared use, and for use that may not even have been anticipated at design time
Service-Orientation Service-Orientation is an organizational principle – A set of principles for building large systems – It is not tied to any particular technology Examples: Common “horizontal” services: Logging, authentication/single-sign-on, systems management, Directory lookup of services, event notification “Vertical” services, specific to your business domain Product feature search service, Address management, Order Status Tracking Service, Truck/trailer tracking service As in organizations, there is always more than one way to structure a large system The most important question: How to decompose? – What is the guiding abstraction mechanism? – Why would one favor one decomposition for another?