Architectural Styles Flashcards
(22 cards)
ARCHITECTURAL STYLES
- An architectural style is a named collection of architectural design decisions that -are applicable in a given development 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
PARTS OF A STYLE
- A set of component types with a given role/functionality
- A topology of relations (usually runtime relations)
- A set of connector types that handle communication, coordination, or collaboration
- A set of semantic constraints -I.e., what may components/connectors do or not do?
Traditional, language-influenced styles
- Main program and subroutines
- Object-oriented
Layered styles
- Virtual machines
- Client-server
Data-flow styles
- Batch sequential
- Pipes and filters
Shared memory styles
- Blackboard
- Rule based
Interpreter Styles
- Interpreter
- Mobile code
Implicit invocation Styles
- Event-based
- Publish-subscribe
Styles classification
- Communication: Service-oriented architecture (SOA), Message Bus
- Deployment: Client/Server, N-tier, 3-tier
- Domain: Domain Driven Design
- Structure: Componend-Based, Object-Oriented, Layered-Architecture
Blackboard Style
- Useful for problems for which no deterministic solution strategies are known
- several specialized subsystems assemble their knowledge to build a possibly partial or approximate solution
- Example: speech recognition, submarine detection, inference of 3D molecule structure
- All components have access to a shared data store (the blackboard)
- Components produce new data objects that are added to the blackboard
- Components look for particular kinds of data on the blackboard
- Find these by pattern matching
Blackboard Style (2)
- Processes have to agree on the structure of the shared data space
- Adding new applications is easy
- Extending the structure of the data space is easy
- Modifying the structure of the data space is hard
- Possible need for synchronization, access control
Pipes and Filters
Components (Filters)
- read streams of data on input producing streams of data on output
- local incremental transformation to input stream
- output usually begins before input is consumed
Connectors (Pipes)
- conduits for streams e.g. first-in-first-out buffer
- transmit outputs from one filter to input of other
Invariants
- filters must be independent, no shared state
- filters don’t know upstream or downstream filter identity
- correctness of output from network must not depend on order in which individual filters provide their incremental processing
Common specialisations
- pipelines: linear sequence of filters
- bounded and typed pipes …
- Common Example: lex/yacc -based compiler (scan, parse, generate code, ..)
Pipes and Filters Strengths
- Overall behaviour is a simple composition of behaviour of individual filters.
- Reuse - any two filters can be connected if they agree on that data format that is transmitted.
- Ease of maintenance - filters can be added or replaced.
- Prototyping e.g. Unix shell scripts are famously powerful and flexible.
- Architecture supports formal analysis - throughput and deadlock detection
- Potential for parallelism - filters implemented as separate tasks, consuming and producing data incrementally.
PIPES AND FILTERS WEAKNESSES
- Can degenerate to ‘batch processing’ - filter processes all of its data before passing on (rather than incrementally)
- Sharing global data is expensive or limiting
- Can be difficult to design incremental filters
- Not appropriate for interactive applications
- Synchronization of streams will constrain architecture.
- Error handling e.g. filter has consumed three quarters of its input and produced half its output and some intermediate filter crashes!
- Implementation may force lowest common denominator on data transmission e.g. Unix scripts everything is ASCII.
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” of object internals
- System decomposition into sets of interacting agents
- Disadvantages
- Objects must know identities of servers
- Side effects in object method invocations
Implicit Invocation
- 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
Implicit Invocation Advantages
- Reuse: any component can be introduced by registering it for appropriate events
- Evolution: components may be replaced without affecting other interfaces
Implicit Invocation Disadvantages
- Control: no way to know what will happen after event is announced
- Data: may lead to performance problems
- Correctness: meaning of procedure is context dependent
Publish-Subscribe
Subscribers register/deregister to receive specific messages or specific content. Publishers broadcast messages to subscribers either synchronously or asynchronously.
Publish-Subscribe (2)
- 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: Highly efficient one-way dissemination of information with very low-coupling of components
Event-Based Style
- Independent components asynchronously emit and receive events communicated over message buses
- Components: Independent, concurrent event generators and/or consumers
- Connectors: Message buses (at least one)
- Data Elements: Events/messages – data sent as a first-class entity over the Message bus
- Topology: Components communicate with the Message buses, not directly to each other.
- Variants: Component communication with the Message bus may either be push or pull based.
- Highly scalable, easy to evolve, effective for highly distributed applications.
Variations
-
Enterprise Service Bus (ESB).
- uses services for communication between the bus and components attached to the bus.
- provides services that transform messages from one format to another, allowing clients that use incompatible message formats to communicate with each other
-
Internet Service Bus (ISB).
- applications hosted in the cloud instead of on an enterprise network.
- uses Uniform Resource Identifiers (URIs) and policies to control the routing of logic through applications and services in the cloud.