L05- Software Architectures

advertisement
Software Architecture
CS 4311
Architecture
• Design at the highest level
• Example: bridge architectures
Arch
Beam
Suspension
Cable-stayed
Architecture
Why do civil
• Design at the
highest level
engineers
talk about
• Example: bridge
bridge architectures
architectures?
Arch
Beam
Suspension
Cable-stayed
What is architecture?
• Dictionary definitions:
– archangel, archenemy, archduke,
archbishop
– matriarch, patriarch, monarch
• Arch as prefix or suffix:
– main, chief, principal, most important,
highest, fundamental, basic, extreme
or most characteristic, ruler, leader
Architecture
• The art and science of designing and
erecting buildings
• Fundamental underlying design of buildings
• Style and method of design and
construction of buildings
• Buildings and other structures
What is software architecture?
• Framework
• Mechanism
• Way
• Shape
• Form
• Means
• Organization
• Arrangement
• The Big Picture !
Software Architecture
the structure or structures of the system
– software components
– externally visible properties of those
components
– the relationships between them
• the set of principle design decisions made
about a software system.
What design decision?
•
•
•
•
•
•
System structure
Functional behavior
Interaction
Nonfunctional properties
Implementation
System goals, Stakeholders, Nontechnical
considerations
Independent Components
• Broadcasts
• Client-server
• Event driven
– Components register for an event. System invokes all
registered components when event happens.
– Example: Java AWT
– Dynamic, responsibility with event handler, not event
generator.
– Can be hard to test/debug.
Virtual Machines
• Interpreters:
– Program to be executed
– Interpreter: simulate instructions in program
– State: State of program, state of interpreter
• Examples:
– JVM
– Command language processors
Repositories
• Central Data store + operations {store,
retrieve, update}
• Traditional: transactions trigger processing
• Blackboard: Central store controls
processing
– Processes write to central store (knowledge
sources)
– Processes respond to changes in the store
Layered Architecture
• Layers are hierarchical
• Each layer provides services to the outer layer
which is a client to the inner layer
• Layers can have access to adjacent layers (direct
access only)
• The design includes how each pair of layers
interact (protocols)
• Layered architectures are often used for interactive
information services
Example
Layered security architecture
Cryptography
File interface
Key management
User
Advantages and Drawbacks
+ Each layer can be seen as a higher level of
abstraction
+ A change on one layer affects only layers
interacting with the changed layer
+ Clearly favors reuse
- Layers are not always obvious when looking at the
requirements
- Performance may suffer from the extra
coordination among the layers
Layered Architectures in Interactive Information Systems
Browsers
Presentation
Web Server
App Server
Db Server
Application
Control and
Coordination
Domain
Services and
Information
Legacy
Database
Services
Windows and
Widgets
Characteristic Object Roles
Presentation
Interfacers
Coordinators,
and
(application)
controllers
Information
holders,
service
providers,
Structures,
coordinators,
and domain
controllers
Events
Messages
Application
Services
Results
Domain
Services
Messages
Interfacers
Results
Results
Technical
Services
Locating Objects in Layers
• Once we have agreed on a layered architecture, we
need to identify objects (classes) in layers
• One approach is to use Class-ResponsibilityCollaboration
-objects collaborates mostly within their layers
-client objects will tend to be in an outer layer
(requests go inside)
-information goes outside
Process Control
• Process maintains setpoint
• Control based on
– input variables (feedforward)
– Output variables (feedback)
• Examples:
– Thermostat controlled heater
– “smart” stock trader
Architecture Elements
•
•
•
•
Components
Connectors
Configuration Topologies
Models
Components
• Elements that encapsulate processing and
data in a system’s architecture are referred to
as software components.
• An architectural entity that
– encapsulates a subset of the system’s functionality
and/or data,
– restricts access to that subset via an explicitly
defined interface, and
– had explicitly defined dependencies on its required
execution context.
Connector
• Elements that are tasked with
effecting and regulating
interactions among components.
• Application independent.
Configuration Topology
• A set of specific associations
between the components and
connectors of a software system’s
architecture.
Models
• An artifact that captures some or all of the
design decisions that comprise a system’s
architecture.
• Architectural modeling is the reification and
documentation of those design decisions.
• Different models:
– structural vs. behavioral
– static vs. dynamic
– scope
Architectural Styles
• 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 with that context, and
– elicit beneficial qualities in each resulting system.
• Not about: specific systems, components,
interaction mechanisms, or configurations.
An Architectural Style Example
• Physically separate the software components used to request services
from the components that provide the services, to allow for proper
distribution and scaling up, both in the number of service providers
and service requesters.
• Make the service providers unaware of the requesters’ identity to allow
the providers to service transparently many, possibly changing
requestors.
• Insulate the requesters from one another to allow for their
independent addition, removal, and modification. Make the requesters
dependent only on the service providers.
• Allow for multiple service providers to emerge dynamically to offload the existing providers should the demand for services increase
above a given threshold.
Architectural Styles
Remarks:
• Each style has its own advantages and drawbacks
• An application may require several architectural
views
• Choosing the right views is a key factor in
having a good design
Advantages of Architectural Styles
Each combination of styles emphasizes one or more of the
quality attributes below:
• Usability
• Availability
• Security
• Performance
• Maintainability
• Flexibility
• Portability
Example Software Architectures
•
•
•
•
•
Batch Sequential
Blackboard
Client Server
Database-centric
Distributed
Computing
• Event driven
• Interpreter
• Monolithic
application
•
•
•
•
•
•
•
•
•
Peer-to-peer
Pipe and Filter
Plug-in
Service-oriented
Search-oriented
Space-based
Shared nothing
Three-tier model
Rule evaluation
Assignment:
• Base Groups
• Each teams has until next class to prepare a 3
minute description of the provided architecture
• You will present next class
–
–
–
–
–
What is it
What problem does it solve
How does it solve the problem
Who are the actors
How do they relate to each other
• You will need to be efficient to cover the
architecture in 3 minutes
• Send Aditi 2 or 3 powerpoint slides by 5pm
Wednesday
– INCLUDE YOUR SOURCES
Example Software Architectures
•
•
•
•
•
•
•
•
Team 1 Blackboard
Team 2 Interpreter
Team 3 Plug-in
Team 4 Search-oriented
Team 5 Space-based
Team 6 Shared nothing
Team 7 Publisher-subscriber
Team 8 Rule evaluation
Batch Sequential Architecture
• A series of dedicated and independent
components that transforms data in a
sequential manner (Each component
needs to finish its task before the next
one can start).
Batch Sequential Architecture
• Solve complex task
– Divide complex tasks into several easier tasks.
• Modifiability/Maintainability
– Easy to change/fix the behavior of a component.
• Reusability
– By only changing the components that interact with
the environment the system can work on different
structures.
• Flexibility
– Additional components are easy to integrate.
Batch Sequential Architecture
• Actors
– The actors consist of the independent components
(programs) that run in sequence to achieve the
ultimate desired output of the system.
– Each components is responsible for a particular
task and supplies the next component with the
intermediate data once it has completed its task.
• How do they relate to each other?
– They are related to each other by the data that they
each transform.
Batch Sequential Architecture
*Example: Compiler
*Software Design Methodology, By Hong Zhu © 2005
Client-Server Architecture
• Application context:
– Clients request services from a server
– Centralization of computation and data at the
server
– Separation of user interface tasks from
computation and data management and storage
• For examples:
– Websites, etc.
Client Server Architecture
Example:
Database-Centric Architecture
• Critical databases applications always need
a global transaction monitor.
– can significantly reduce performance and
scalability.
• Architecture solves data management and
processing of it.
• Computes all the data to a single place, in
this case the database.
Actors and their roles
DBMS
SERVER 1
Client
1
Client
2
Client
3
SERVER 2
Client
4
Client
5
Client
6
Benefits:
Reduces amount of code, development time, network traffic,
complexity of applications.
Distributed Computing Architecture
• Also known as grid computing.
• Makes use of the hardware on several computers.
• Primarily used to solve those problems that require
exceptionally heavy computation.
• SETI@Home was the first project that demonstrated
the feasibility of distributed computing to solve
these problems.
– Indeed, this was one of the primary goals of
SETI@Home.
– The specific problem SETI@Home is used for is to
detect intelligent life outside of Earth.
Distributed Computing Architecture
• The software written for SETI@Home requires 2
components:
– Central server software manages the
distribution of data across personal computers
and the collection of analyzed data.
– Personal computer software performs analysis
and monitors processor usage, ensuring that
analysis is done only when the processor is not
otherwise needed.
Event Driven Architecture
• Components in the system react to certain events.
– For example
• State changes
• I/O events
• Creates responsiveness in a changing environment
• Actors
– Agents: components in a system that generate events
– Sinks: event consumers
• Responsibility of applying action as soon as event is present
• May act as a filter to another component
• May provide an action based the given event
Event Driven Architecture
• Characteristics
– Facilitates responsiveness
– Works great in un-normalized unpredictable
environments
• Event flow
– Sensing of fact
– Technical representation in the form of an event
– Reaction(s) to set event
• Example
– Email application displays a message stating that a
new e-mail has been received
Event Driven Architecture
Agent
event
event
transformation
Sink 1
action
Sink 2
action
Sink 3
action
Sink
n-1
Sink n
action
Monolithic Architecture
• Single-Tier Architecture
• Concept of having user interface and application
of data access in one single program.
• Only application is accountable for computations
• Simplest software configuration
– No modularity
– Not a typical Software Engineering Concept
Why Monolithic Architecture?
• Low Cost
– Less Complex
– No need to develop external computational or
processing modules
• Simple and Quick design
– Single independent application
• No need for future expansion of software
– Not easily maintained
Peer-to-Peer Architecture
• A type of architecture in which each class
has equivalent capabilities and
responsibilities
• A class can collaborate with any other class
and vice versa
• Every class has access to the resources
needed
• Every class gives access to all its resources
• No Super-classes
Peer-to-Peer Architecture
• Advantages:
• Decentralized computing with flow of control
and resources distributed among peers
• Highly robust in the face of failure
• Scalable in terms of access to resources and
computing power
• Cautions:
• When information retrieval is time critical
• Security
Pipe and Filter
• This is an architecture composed of filters and
pipes:
– A filter is a program that reads a stream and writes a
stream
– A pipe is middle where that directs the output stream of
one program to the input stream of another
Input
Data
Transformed
Data
Transformed
Data
Filter
Filter
Filter
Pipe and Filter
• This is an architecture composed of filters and
pipes:
– A filter is a program that reads a stream and writes a
stream
– A pipe is middle where that directs the output stream of
one program to the input stream of another
• Useful when you have common stream processing
programs that can be reused
• The cost is that a lot of I/O processing is
duplicated (e.g., parsing the data)
Example Pipe and Filter
• Example: Unix shell scripts
ccl1 fred.txt | ccp0 | ccp1 | ccp2 > fred.o
• | is the pipe operator
– Read from the standard output of program to
left
– Write to standard input of program to right
Pipe and Filter
• Components are isolated
–
–
–
–
Easy to understand and reuse filters
Evolution is easy: replace filter
Allows concurrent execution
May be easy to analyze (analyze each filter for
throughput, accuracy)
– Batch or stream, not interactive
– Replication of effort (reading, writing, parsing)
Service-Oriented Architecture (SOA)
• Problem
– Client needs access to multiple features
however the client shouldn’t know how those
features are implemented
• SOA:
– Provides access to multiple components or
functions
– Client doesn‘t know what components or how
functionality is implemented
SOA
• Solve the Problem
– Provides an interface that hides the components and
gives the client a single access point.
• Actors
– Client
– Components
Three-Tier Architecture
• client-server architecture
• Three different tier
– Presentation
• Input/ output
– Business
• Data processing
– Data Access
• Read/Write
Three-Tier Advantages
• Highly cohesive and lowly coupled
• Allows change in modules with out effect
on the other tiers
• Encapsulates tasks
Download