Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... •...
Transcript of Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... •...
![Page 1: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/1.jpg)
Patterns of Software Architecture
Software Engineering Alessio Gambi - Saarland University
Based on the work of Cesare Pautasso, Christoph Dorn, and their students
![Page 2: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/2.jpg)
Software Architecture
A software system’s architecture is the set of principal design decisions made
about the system. N. Taylor et al.
Abstraction Communication
Visualization and Representation Quality Attributes
![Page 3: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/3.jpg)
Every system has a software architecture
What designers want
![Page 4: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/4.jpg)
Modeling• System-to-be
Boundary/Internal Model
Quality attributes
Development
• Problem Domain model
• Environment System Context
Stakeholders
• Components Computation
State
• ConnectorsInteraction
C. C. C. F.
• Views & Viewpoints Kruchten 4+1
![Page 5: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/5.jpg)
Design
• Architectural Styles
• Architectural Patterns
• Building Blocks - Software Connectors
![Page 6: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/6.jpg)
Architectural Styles
Named collections of architectural decisions that are applicable in a development context.
They constrain architectural design decisions, are specific to the system within that context, and elicit beneficial qualities in each resulting system
![Page 7: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/7.jpg)
Monolithic• Lack of structure
• No Constraints
• Poor Maintainability
• Possibly Good Performance
Mainframe COBOL programs ∙ powerpoint ∙ many games
![Page 8: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/8.jpg)
Layered• Communications 1 layer up/down
• Information hiding, no circular deps
• Possibly bad performance
• Good evolvability
Network protocol stacks ∙ Web applications ∙ Virtual Machines
![Page 9: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/9.jpg)
Component Based• Encapsulation
• Information hiding
• Components compatibility problem
• Good reuse, independent development
CORBA ∙ Enterprise JavaBean ∙ OSGi
![Page 10: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/10.jpg)
Service Oriented• Components might be outside control
• Standard connectors, precise interfaces
• Interface compatibility problem
• Loose coupling, reuse
Web Services (WS-*) ∙ Cloud Computing
![Page 11: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/11.jpg)
Plugin• Explicit extension points
• Static/Dynamic composition
• Low security (3rd party code)
• Extensibility and customizability
Eclipse ∙ Photoshop ∙ Browsers’ extensions
![Page 12: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/12.jpg)
Pipe & Filter• Clean separation: filter process, pipe
transport
• Heterogeneity and distribution
• Only batch processing, serializable data
• Composability, Reuse
UNIX shell ∙ Compiler ∙ Graphics Rendering
![Page 13: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/13.jpg)
Black Board• Collective problem solving via shared data
• Asynchronous components interactions
• Requires common data format
• Loose coupling, implicit data flow
Database ∙ Tuple space ∙ Expert systems (AI)
![Page 14: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/14.jpg)
Event Driven• Produce/React to events
• Asynchronous signals/messages
• Difficult guarantee performance
• Loose coupling, scalable
Sensor Monitoring ∙ Complex Event Processing
![Page 15: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/15.jpg)
Publish/Subscribe• Event driven + opposite roles
• Subscription to queues or topics
• Limited scalability
• Loose coupling
Twitter ∙ RSS Feeds ∙ Email
![Page 16: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/16.jpg)
Client/Server• Many clients, active, close to users
• One server, passive, close to data
• Single point of failure, scalability
• Security, scalability
Web Browser/server ∙ Databases ∙ File Servers ∙ Git/SVN
![Page 17: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/17.jpg)
Peer to Peer• Both server and client at the same time
• Dynamic join/leave
• Difficult administration, data recovery
• Scalability, dependability/robustness
File Sharing ∙ Skype (mixed style) ∙ Distributed Hash Tables
![Page 18: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/18.jpg)
Data Centric• Persistence layer
• Black board like
• Single point of failure
• (Eventual) Consistency (BASE/ACID)
Relational DB ∙ Key-Value Stores
![Page 19: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/19.jpg)
Rule Based• Rules dynamically triggered
• Layered
• Possibly hard to understand and maintain
• Evolvability
Business Rule Engines ∙ Expert Systems ∙ Prolog
![Page 20: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/20.jpg)
Mobile Code• Code migrates (weak)
• Code+execution state migrate (strong)
• Security
• Fault tolerance, performance
JavaScript ∙ Flash ∙ Java Applets ∙ Mobile Agents ∙ Viruses
![Page 21: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/21.jpg)
REST• Hybrid style
• Stateless interactions/Stateful resources
• Loose coupling, scalability, interoperability
World Wide Web ∙ RESTFul Web APIs
![Page 22: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/22.jpg)
An architectural pattern is a set of architectural design decisions that are applicable to a recurring design problem, and parameterized to account for
different software development contexts in which that problem appears.
Architectural Patterns
Layered - Component - Events - Composition
![Page 23: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/23.jpg)
Layered Patterns• State-Logic-Display
separate elements with different rate of change
• Model-View-Controller support many interaction and display modes for the same content
• Presenter-View keep a consistent look and feel across a complex UI
![Page 24: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/24.jpg)
State-Logic-Display
cluster elements that change at the same rate
![Page 25: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/25.jpg)
Model-View-Controllerseparate content (model) from presentation (output) and
interaction (input)
![Page 26: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/26.jpg)
Presenter-View
extract the content from the model to be presented from the rendering into screens/web pages
![Page 27: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/27.jpg)
Component Patterns• Interoperability
enable communication between different platforms
• Directory facilitate location transparency (direct control)
• Dependency Injection facilitate location transparency (inversion of control)
![Page 28: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/28.jpg)
Interoperabilitymap to a standardized intermediate representation and
communication style
![Page 29: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/29.jpg)
Directoryuse a directory service to find service endpoints based on
abstract descriptions
![Page 30: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/30.jpg)
Dependency Injectionuse a container which updates components with
bindings to their dependencies
![Page 31: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/31.jpg)
Notification Patterns• Event Monitor
inform clients about events happening at the service
• Observer promptly inform clients about state changes of a service
• Publish/Subscribe decouple clients from services generating events
• Messaging Bridge connect multiple messaging systems
• Half Synch/Half Async interconnect synchronous and asynchronous components
![Page 32: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/32.jpg)
Event Monitorpoll and compare state snapshots
![Page 33: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/33.jpg)
Observerdetect changes and generate events at the service
![Page 34: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/34.jpg)
Publish/Subscribefactor out event propagation and subscription management
into a separate service
![Page 35: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/35.jpg)
Messaging Bridgelink multiple messaging systems to make messages
exchanged on one also available on the others
![Page 36: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/36.jpg)
Half-Sync/Half-AsyncAdd a layer hiding asynchronous interactions behind a
synchronous interface
![Page 37: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/37.jpg)
Composition Patterns• Scatter/Gather
send the same message to multiple recipients which will/may reply
• Canary Call avoid crashing all recipients of a poisoned request
• Master/Slave speed up the execution of long running computations
• Load Balancing speed up and scale up the execution of requests of many clients
• Orchestration improve the reuse of existing applications
![Page 38: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/38.jpg)
Scatter/Gathercombine the notification of the request with
aggregation of replies
![Page 39: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/39.jpg)
Canary Calluse an heuristic to evaluate the request
![Page 40: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/40.jpg)
Master/Slavesplit a large job into smaller independent
partitions which can be processed in parallel
![Page 41: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/41.jpg)
Load Balancingdeploy many replicated instances of the server
on multiple machines
![Page 42: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/42.jpg)
Composition/Orchestrationbuild systems out of the composition of existing ones
![Page 43: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/43.jpg)
Software Connectors
Software connectors are first-class entities, have identity, and describe all system interactions. Software connectors are application independent and orthogonal to software components.
generic building blocks
![Page 44: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/44.jpg)
Remote Procedure Call
• Call
Often used within the client/server architectural style and event-oriented systems as call-backs
![Page 45: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/45.jpg)
Stream
• Send
• Receive
Fits the pipe & filter architectural style
![Page 46: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/46.jpg)
Shared Database
• Create
• Read
• Update
• Delete
![Page 47: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/47.jpg)
Disruptor
• Next
• Publish
• WaitFor
• Get
![Page 48: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/48.jpg)
Message Bus
• Publish
• Subscribe
• Notify
Fits the Service Oriented style
![Page 49: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/49.jpg)
File Transfer
• Write
• Copy
• Watch
• Read
![Page 50: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/50.jpg)
• Load
• Unload
• Call
• Read/Write
Linkage
![Page 51: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/51.jpg)
Tuple Space
Fits the Blackboard style and the Master/Worker pattern
• In
• Out
• Rd
![Page 52: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/52.jpg)
• Get
• Put
• Post
• Delete
Web
Fits the REST architectural style
![Page 53: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/53.jpg)
Case Study
![Page 54: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/54.jpg)
MediaWiki• General purpose PHP-based system for Wikis
• The core of WikiMedia project (Wikipedia)
• Long-living project (~14 years)
• In September 2014 all Wikimedia projects served ~23.2 billions of pages
![Page 55: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/55.jpg)
Main Scenarios
• A user requests an article during normal operation and gets the rendered article HTML page.
• An editor saves an edited article during normal operation and the article is saved.
![Page 56: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/56.jpg)
Web Browser
Front End App Server Back End
![Page 57: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/57.jpg)
Performance Tactics• Control Resource Demand
- Increase the resource efficiency (caching) - Prioritize events (deferred article updates) - Reduce overhead (precompile PHP and HTML)
• Manage Resources - Introduce concurrency (Distributed database) - Schedule resources (Load balancer) - Multiple copies of data and computations
![Page 58: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/58.jpg)
Caching + Load Balancing
FrontEnd(Apache)
![Page 59: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/59.jpg)
Caching + Load Balancing
Squid(Caching) Apache
![Page 60: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/60.jpg)
Caching + Load Balancing
Squid ApacheLoadBalancer(Squid) LoadBalancer
![Page 61: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/61.jpg)
Caching + Load Balancing
Squid ApacheLoadBalancer(Squid) LoadBalancer
Squid ApacheLoadBalancer LoadBalancer
Squid
Squid
Apache
Apache
![Page 62: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/62.jpg)
Distribution + Replication
Database
![Page 63: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/63.jpg)
Distribution + Replication
DB Slave
Load Balancer
ReadsWrites
DB Master
![Page 64: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/64.jpg)
Distribution + Replication
DB Slave
Load Balancer(Master)
ReadsWrites
DB Master(Shard)
Partition Logic(Sharding, Relication
![Page 65: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/65.jpg)
![Page 66: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/66.jpg)
Backend
ParserArticleEdit
ReadsWrites
ArticleViewSubmit Logic
UI Page
Skinning Localization
Static Resources
![Page 67: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/67.jpg)
Backend
ParserArticleEdit
ReadsWrites
ArticleViewSubmit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache Cache
CacheCache
![Page 68: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/68.jpg)
Backend
Parser
ArticleEdit
Reads
Writes
ArticleView
Submit Logic
UI Page
Skinning Localization
ParserCache
Static Resources
Loader
CachedCached
Cached
Job Runner
Writes
Job Queue
HTML File Cache
Precompile/Recompile
Regenerate/Invalidate
![Page 69: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/69.jpg)
Security/Availability Tactics• Prevent Attacks
• Challenge Tokens (CSRF) • Validation (User) and Sanitization (SQL Injection, XSS)
• Resist Attacks • Maintain multiple copies of computations. • Maintain multiple copies of data
• Recover from Attacks • DB Versioning (Recovery from data loss)
![Page 70: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/70.jpg)
Backend
ParserArticleEdit
ReadsWrites
ArticleViewSubmit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache Cache
CacheCache
![Page 71: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/71.jpg)
Backend
ParserArticleEdit
ReadsWrites
ArticleView
Submit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache Cache
CacheCache
Sanitizer Pipeline
User Access
![Page 72: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/72.jpg)
Extensibility
Backend
ParserArticleEdit
ReadsWrites
ArticleView
Submit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache
CacheSanitizer
Cache
Cache
![Page 73: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/73.jpg)
Extensibility
Backend
ParserArticleEdit
ReadsWrites
ArticleView
Submit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache
CacheSanitizer
Cache
Cache
Hook EngineRegister Callback
Notify
Notify
NotifyNotify
Notify
External Module
![Page 74: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/74.jpg)
Configurability/Customizability
ParserArticleEdit
ReadsWrites
ArticleView
Submit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache
CacheSanitizer
Cache
Cache
![Page 75: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/75.jpg)
Global Variables and Configurations
ParserArticleEdit
ReadsWrites
ArticleView
Submit Logic
UI Page
Skinning Localization
Static Resources
Loader
Cache
CacheSanitizer
Cache
Cache
Configurability/Customizability
![Page 76: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/76.jpg)
Architectural Styles“Looking at the source code, it becomes evident that MediaWiki’s development process did not focus on strictly following textbook
architectural styles and patterns.”
• Layered - FrontEnd/Network, Application, Backend/Database - Multi-level caching
• Blackboard - Global variables
![Page 77: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/77.jpg)
Architectural Patterns• Presenter view (skinning)
• Publish/Subscribe (hooks)
• Master/Slave (database)
• Load balancer (network,database)
• Event monitor (cache invalidation)
![Page 78: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/78.jpg)
Cheat Sheets
![Page 79: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/79.jpg)
Architectural Styles
![Page 80: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/80.jpg)
![Page 81: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/81.jpg)
![Page 82: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/82.jpg)
Availability Tactics
Detect Faults Prevent Faults
Ping / Echo Removal fromService
MonitorTransactions
PredictiveModel
Recover from Faults
Heartbeat
Preparationand Repair
Reintroduction
ActiveRedundancy
PassiveRedundancy
SpareEscalatingRestart
ExceptionHandling
Shadow
Non-StopForwarding
StateResynchronization
ExceptionPrevention
Fault
FaultMaskedorRepairMade
Timestamp
SanityChecking
ConditionMonitoring
Voting
ExceptionDetection
Self-Test
Rollback
SoftwareUpgrade
Retry
Ignore FaultyBehavior
Degradation
Reconfiguration
IncreaseCompetence Set
![Page 83: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/83.jpg)
Modifiability Tactics
Increase Cohesion
Reduce Coupling
Split ModuleEncapsulate
Use an Intermediary
Change Requests
Changes Made and Deployed
Reduce Size of a Module
Increase Semantic Coherence
Restrict Dependencies
Refactor
Abstract Common Services
Defer Binding
![Page 84: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/84.jpg)
Testability Tactics
Control and Observe System State
Limit Complexity
Specialized Interfaces
Limit Structural Complexity
Limit Non-determinism
TestsExecuted
Faults Detected
Record/Playback
Localize State Storage
Sandbox
Executable Assertions
Abstract Data Sources
![Page 85: Patterns Of Software Architecture - uni-saarland.de · Patterns of Software Architecture ... • Dependency Injection facilitate location transparency ... Architectural Styles](https://reader030.fdocuments.us/reader030/viewer/2022021511/5b14c4497f8b9a201a8bc7f9/html5/thumbnails/85.jpg)
Usability Tactics
Support User Initiative
Support System Initiative
Cancel
Maintain User Model
Maintain System Model
User Request
User Given Appropriate Feedback and Assistance
Undo
Pause/Resume
Aggregate
Maintain Task Model