Modeling and Documenting Software Architectures 1 Hany H. Ammar, Professor, LANE Department of...

Preview:

Citation preview

Modeling and Documenting Software Architectures

1

Hany H. Ammar, Professor,LANE Department of Computer Science and Electrical Engineering

West Virginia University, Morgantown, West Virginia, USA, andVisiting Professor, Faculty of Computers and Information, Cairo University, Cairo,

Egypt

Software Architecture Styles

الرحيم الرحمن الله بسمالله ا رسول على والسالم والصالة ، لله لحمد

Modeling and Documenting Software Architectures

2

OUTLINE

• Introduction• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• SW Systems Mix of Architecture Styles• Other Important Styles

Introduction

Recall the definition of Styles• An architectural style is a coordinated set of

architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements within any architecture that conforms to that style.

Introduction

What does it give us? • An architectural style describes a certain

codification of elements and their arrangements.

• Conversely, an architectural style constrains both the elements and their interrelationships.

• It specifies components and connectors types

IntroductionExample Component Types

Ex:Connector

Types

Examples of Popular Architecture Styles

Modeling and Documenting Software Architectures

8

Families of Architecture Styles• There is a number of families of styles that has been

defined and used in many software systems Notable examples are:

1. Independent Components: Event-based Architectures

2. Virtual Machines3. Data Flow: Pipes and Filters4. Data-Centered Systems5. Call-and Return Architectures

Modeling and Documenting Software Architectures

9

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

Modeling and Documenting Software Architectures

10

Architectural Styles Independent Components

1. Independent Components. Architecture is viewed a set of independent processes or objects or components that communicate through messages.

Two subfamilies: - Event based systems (implicit and direct invocation style), and - Communicating processes family (client-server style).

Modeling and Documenting Software Architectures

11

Architectural styles: Event-based ArchitectureSome processes post events, others express an interest in events

Event-basedArchitecture

Event-based ArchitectureImplicit Invocation: The Observer Pattern

Modeling and Documenting Software Architectures

14

Modeling and Documenting Software Architectures

15

Another Example: Lunar Lander GamePlayers Subscribers register to the Game Server that Publishes information on new Lunar

Terrain data, new spacecraft, and the locations of currently registered space crafts

Component-connector notation

Summary of Event-Based Style

1.Independent Components asynchronously emit and receive events communicated over event buses

2.Components are independent concurrent even generators and consumers

3.Data elements are events sent as first class entities over the event bus

Communicating Processes: Client-Server Architecture Style

Modeling and Documenting Software Architectures

20

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

Modeling and Documenting Software Architectures

21

Architectural Styles Virtual Machines

2. Virtual Machines. Originated from the concept that programs are treated as data by a virtual machine, which is an abstract machine implemented entirely in software, that runs on top of the actual hardware machine. Ex: rule-based style.

Architectural Styles Virtual Machines

Modeling and Documenting Software Architectures

23

Virtual Machines: The primary benefits are the separation between instruction and implementation,(Used when inputs are defined by a script and data)

Example: Java Virtual Machine. Java code translated to platform independent bytecodes. JVM is platform specific and interprets (or compiles -JIT) the bytecodes.

Virtual Machines Style

Virtual Machines Style Example

Modeling and Documenting Software Architectures

26

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

Modeling and Documenting Software Architectures

27

3. Data Flow. Include Batch Sequential Systems (BSS) and Pipes and Filters (PF).

- BSS: different components take turns at processing a batch of data, each saving the result of their processing in a shared repository that the next component can access. Ex. Dynamic control of physical processes based on a feedback loop.

- PF: A stream of data processed by a complex structure of process (filters). Ex, UNIX.

Architectural StylesData Flow

Modeling and Documenting Software Architectures

28

Architectural StylesData Flow: Control Loop and Pipes and Filters

Control Loop

BSS Architecture Style Example

BSS Style Summary

PF Exampleconcurrency between components (Filters) is allowed

PF example in Embedded Systemsconcurrency between components (Filters) is allowed

A Robotics Example

Modeling and Documenting Software Architectures

33

Modeling and Documenting Software Architectures

34

PF Another Architecture Example:Watch for the Two Views

PFs Style Summary

Modeling and Documenting Software Architectures

36

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

Modeling and Documenting Software Architectures

37

Data-Centered Architectural Styles

4. Data-Centered Systems. Consist of having different components communicate through shared data repositories. When data repository is an active repository that notifies registered components of changes in it then-blackboard style.

Data-Centered Architectural StylesRepository Architecture Style

Data-Centered Architectural StylesRepository Architecture Example: CASE Tools Example

Data-Centered Architectural StylesRepository Architecture Example: Compiler Architecture

Modeling and Documenting Software Architectures

41

Data-Centered Architectural Styles

Blackboard Architecture Style: Components perusing shared data, and communicating through it.

Used in Database intensive systems

Data-Centered Architectural StylesBlackboard Architecture Style Example

Compare with the PFs Style

Data-Centered Architectural StylesBlackboard Architecture Style: Intelligent Agent Systems Example

Data-Centered Architectural StylesBlackboard Architecture Style:

Travel Counseling System Example

Data-Centered Architectural StylesBlackboard Architecture Style: Intelligent Agent Systems Example

Blackboard Architecture Style: Intelligent Agent Systems Example

Data-Centered Architectural StylesBlackboard and Publish/Subscribe Styles: Intelligent Agent Systems

Example

Blackboard Architecture Style

Rule-Based or Expert System Architecture Style: Three components, a user interface, an inference engine, and a knowledgebase

Rule-Based or Expert Systems Style

Modeling and Documenting Software Architectures

51

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• SW Systems Mix of Architecture Styles

Modeling and Documenting Software Architectures

52

Architectural stylesCall-and Return Family

5. Call-and Return Architectures. Due to heir simple control paradigm and component interaction mechanism , these architectures have dominated the SW landscape by the early decades of the SW Eng.

• There are several styles within this family: examples are main program and subroutine, and layered architectures.

-) Main Program and Subroutine Style. Programs are modularized based on functional decomposition, single thread of control held by the main program, which is then passed to subprograms, along with some data on which the subprograms can operate.

Modeling and Documenting Software Architectures

53

Main Program and Subroutine Style

CourseInfo

PeopleInfo

Course

CourseOffering

StudentInfo ProfessorInfo

Register.exe

Course registrationSystem example

Modeling and Documenting Software Architectures

54

Call-and Return Architectural styles-) Layered. Functionality is divided into layers of abstraction-

each layer provides services to the layer(s) above it, and uses the services of layer(s) below it. In its purest form, each layer access only the layer below it, but does not depend on lower layers.

Based on general systemsArchitecture, Network Architectures, etc.

Layered Architectural stylesExample of a Layered Application Architecture

Layered Architectural stylesExample: Interactive Electronic Technical Manual Layered Architecture

Data Access

IETM Electronic Display System (EDS)

IETM Data User Interface

PresentationLayer

Business LayerData Layer

Layered Architectural stylesA Robotics Architecture

The Reactive Layer contains basic skills of the robot such as grasping an object and behavior that must execute immediately in response to inputs from sensors. The Sequencing Layer combines functions in the reactive layer into more complex behavior. The Planning Layer performs slowerLong-term planning

Modeling and Documenting Software Architectures

58

OUTLINE

• Introduction

• Software Architecture Styles• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• SW Systems Mix of Architecture Styles

Modeling and Documenting Software Architectures

59

SW Systems-Mix of Architecture Styles

• Most SW systems use a mix of architecture styles. Ex, personnel management system with a scheduling component, implemented using the independent component style, and a payroll component, using the batch sequential style.

SW Systems-Mix of Architecture StylesQuality Attributes tradeoffs

• Choosing a style to implement a particular system depends on several factors based on stakeholders concerns.

• The typical factors concern the level of quality attributes that each style enables us to attain. EX, event-based systems-achieve very high level of evolvability, at the expense of performance and complexity.

• Virtual-machine style-achieve very high level of portability, at expense of performance and perhaps even testability.

SW Systems-Mix of Architecture StylesComponents of each Layer use different architecture styles

SW Systems-Mix of Architecture Styles

Modeling and Documenting Software Architectures

63

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• SW Systems Mix of Architecture Styles• Other Important Styles

• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Buffered Massage-Based Software Architecture Style

In the J2EE Paltform,• Java Massage Server (JMS) ia an API thatprovides

Asynchronous massage queuing mechanism

• Massage Driven Bean (MDB) is a special type of EJBs that consumes asynchronous massages

Buffered Massage-Based Software Architecture Style

Clients can publish massages on the JMS and MDBs register with the JMS to receive Certain massage topics (asynchronous massage based publish/subscribe).

Buffered Massage-Based Software Architecture Style

• The MDB plays the role of a massage listenerIt can connect remote Session EJBs or Entity EJBs

Web Application Example

Massage-Based Architecture Styleconsists of three types of components

Massage-Based Architecture Style

Massage-Based Architecture Style

Modeling and Documenting Software Architectures

71

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• Other Important Styles• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Model-View-Controller Architecture Style

• The Controller manipulates the data Model• The View retrieves data from the model and

displays needed information

Model-View-Controller Architecture StyleDynamic Interactions

Model-View-Controller Architecture StyleWeb Applications Java-based Implementation Example

Modeling and Documenting Software Architectures

75

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• Other Important Styles• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Presentation-Abstraction-Control Agents Architecture Style

• Based on MVC Style but geared towards agent-oriented Systems• Consists of a Hierarchy of Agents, each agent with a P, A, and C components• The C component in each agent is in charge with communicating with other agents• The top-level agent is in charge of the core data and business logics• Lower-Level Agents provides detailed data and presentation

Presentation-Abstraction-Control Agents Architecture Style Example

• Simple Presentation Application that can displayPages of a presentation • Consists one a top-level agent 1 and four lower levelagents• Agent 1 have access to the pages,and the other agents respond touser requests for first, previous, nextand last pages

A scenario capturingthe event of pressing the next button

Presentation-Abstraction-Control Style

Presentation-Abstraction-Control Style

PAC Style vs MVC Style

Modeling and Documenting Software Architectures

81

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• Other Important Styles• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Broker Architecture Style

Brokers gets requests from client proxies and manages them by forwarding to serverProxies or dispatches them to other connected brokers

Broker Architecture Style

Broker Architecture Style

Broker Architecture Style

Example: CORBA, Common Object Request Broker Architecture

Client-Side ProxyIDL

Server-Side Proxy(IDL)

Example: CORBA, Common Object Request Broker Architecture

Modeling and Documenting Software Architectures

88

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• Other Important Styles• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Service Oriented Architecture (SOA) StyleMakes use of an Enterprise Service Bus ESB

Used in web-based systems and distributed computing

nodes make resources available to other participants in the system as independent services that the participants access in a standardized way using the ESB

BeforeSOA

The SOA Style

Service Oriented Architecture (SOA) StyleA Map of SOA Components

Process Services

Orchestration

System BPM

Business Logic

Databases

Data Services

Enterprise Service Bus (ESB)

Systems of Record

Web Portals

Human Business Process Management (BPM)

Sec

urity

Reg

istr

y an

d R

epos

itory

Man

age

and

mon

itor

The ESB Performs: • data transformation• Intelligent routing• Real time monitoring• Exception handling• Service security

Cloud Services ArchitectureSOA supports Cloud Computing Models

Cloud Services ArchitectureHuman as a service, Software as a service, Infrastructure as a service

Modeling and Documenting Software Architectures

93

OUTLINE• Introduction• Software Architecture Styles

• Independent Components• Virtual Machines• Data Flow• Data-Centered• Call-and return

• Other Important Styles• Buffered Massage-Based • Model-View-Controller• Presentation-Abstraction-Control• Broker Architecture Style• Service Oriented Architecture (SOA)• Peer-to-Peer Architecture

Peer-to-Peer Architecture Style

Peer-to-Peer Architecture StyleThe Gnutella Example

• Pure Peer-to-PeerArchitecture• A sends query for a data resource to neighbors B and H, they pass it on until the peer havingthe resource is found or until a certain threshold of hopsis reached

Peer-to-Peer Architecture StyleThe Gnutella Example

Recent Versions of Gnutella supports two types of peers Ultra peers and Leaf peersUltra peers runs in systems with fast internet connects and are responsible for request routing and responses, they are connected to a large number of other Ultra peers and leaf peers, while the leaf peers are connected to a small number of Ultra peers

Peer-to-Peer Architecture StyleThe Skype Example

• A mixed client-Server and Pee-to-Peer• Skype Peers get promoted to a supernode status based on their network connectivityAnd machine performance• Supernodes perform the Communication and routingof massages to establish a call• When a user logs in to the serverhe is connected to a supernode• If a peer becomes a supernode he unknowingly bears the cost of routing a potentially large number of calls.

Peer-to-Peer Architecture StyleThe Skype Example

Conclusions• An architectural style is a coordinated set of

architectural constraints that restricts the roles/features of architectural elements and the allowed relationships among those elements

• Choosing a style to implement a particular system depends on several factors based on stakeholders concerns and quality attributes

• Most SW systems use a mix of architecture styles