Are you a developer or designer aspiring to become an architect? Do you want to learn about the architecture of open source applications? Do you want to learn software architecture through case studies and examples? If you have answered “yes” to any of these questions, this presentation is certainly for you. This presentation will introduce you to key topics in software architecture including architectural principles, constraints, non-functional requirements (NFRs), architectural styles and design patterns, viewpoints and perspectives, and architecture tools. A special feature of this workshop: it covers examples and case studies from open source applications. What’s more, you’ll also get exposed to some free or open source tools used by practicing software architects.
Contents overview:
* Introduction to SA
* Overview of design principles, patterns and architectural styles
* Realising quality requirements (NFRs)
* Case studies: Architecture of well-known open source applications
* Tools: Free or open source tools for software architects
* Must to read books on software architecture
(Presented in OSI Days workshop in Bangalore on 19th Nov 2015).
2. Why do you want to
become an
architect?
What skills are
required for an
architect?
Who is an architect?
What essential
knowledge is required
for an architect?
8. “The software architecture of a program
or computing system is the structure or
structures of the system, which comprise
software elements, the externally visible
properties of those elements, and the
relationships among them”
Source: So)ware Architecture in Prac2ce (2nd edi2on), Bass, Clements, Kazman; Addison-Wesley 2003:
9. “Architecture is a set of
principal design decisions
about a software system”
Source: R. N. Taylor, N. Medvidovic, and E. M. Dashofy. 2009. Software Architecture: Foundations, Theory, and Practice.
Wiley Publishing.
10. “The architecture of a
deployed software is
determined by those aspects
that are hardest to change”
Source: R. N. Taylor, N. Medvidovic, and E. M. Dashofy. 2009. Software Architecture: Foundations, Theory, and Practice.
Wiley Publishing.
11. Architecture represents the significant
design decisions that shape a
system, where significant is measured
by cost of change.
- Grady Booch (2006)
22. Scenario
public Locale (String language, // e.g. “en" for English
String script, // e.g., “Arab” for Arabic
String country, // e.g., “us” for United States
String variant, // e.g., “TH” for Thai
LocaleExtensions extensions) // e.g., “ca-buddhist” for Thai Buddhist Calendar
• Assume that you have a Locale class constructor that takes many “optional
constructors”
• Constraint: Only certain variants are allowed - you need to “disallow”
inappropriate combinations(e.g., invalid combination of country and variant) by
throwing IllformedLocaleException.
• Overloading constructors will result in “too many constructors”
• How will you design a solution for this?
23. Recommended Solution
Locale aLocale =
new Locale.Builder()
.setLanguage(“sr")
.setScript(“Latn")
.setRegion("RS")
.build();
• Create a Locale Builder that “builds” and returns an object step-by-step
• Validation will be performed by the individual set methods
• The build() method will return the “built” object
24. Builder pattern: Structure
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
25. Builder pattern: Discussion
❖ Creating or assembling a
complex object can be tedious
Separate the construction of a complex object from its representation so that the same
construction process can create different representations.
❖ Make the algorithm for
creating a complex object
independent of parts that
make up the object and
how they are assembled
❖ The construction process
allows different
representations for the
object that is constructed
26. Builders common for
complex classes
Calendar.Builder b = new Calendar.Builder();
Calendar calendar = b
.set(YEAR, 2003)
.set(MONTH, APRIL)
.set(DATE, 6)
.set(HOUR, 15)
.set(MINUTE, 45)
.set(SECOND, 22)
.setTimeZone(TimeZone.getDefault())
.build();
System.out.println(calendar);
28. Scenario
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
30. Scenario
❖ How will you refactor such
that:
❖ You don't have to “multiply-
out” sub-types? (i.e., avoid
“explosion of classes”)
❖ You can add or remove
responsibilities (e.g.,
scrolling)?
Next change:
smelly design
31. How about this solution?
VisualComponent
+ Draw()
TextView
+ Draw()
ScrollDecortor BorderDecorator
+ Draw()
+ ScrollTo()
- ScrollPosition
+ Draw()
+ DrawBorder()
- borderWidth
Decorator
+ Draw() component->Draw()
Decorator::Draw()
DrawBorder()
Decorator::Draw()
ScrollTo()
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
32. At runtime (object diagram)
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
33. Can you identify the pattern?
VisualComponent
+ Draw()
TextView
+ Draw()
ScrollDecortor BorderDecorator
+ Draw()
+ ScrollTo()
- ScrollPosition
+ Draw()
+ DrawBorder()
- borderWidth
Decorator
+ Draw() component->Draw()
Decorator::Draw()
DrawBorder()
Decorator::Draw()
ScrollTo()
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
34. You’re right: It’s Decorator
pattern!
Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
35. Decorator pattern:
Discussion
❖ Want to add responsibilities to
individual objects (not an
entire class)
❖ One way is to use inheritance
❖ Inflexible; static choice
❖ Hard to add and remove
responsibilities dynamically
Attach additional responsibilities to an object dynamically. Decorators
provide a flexible alternative to subclassing for extending functionality
❖ Add responsibilities through
decoration
❖ in a way transparent to the
clients
❖ Decorator forwards the requests to
the contained component to
perform additional actions
❖ Can nest recursively
❖ Can add an unlimited number
of responsibilities dynamically
36. Identify pattern used in this
code
LineNumberReader lnr =
new LineNumberReader(
new BufferedReader(
new FileReader(“./test.c")));
String str = null;
while((str = lnr.readLine()) != null)
System.out.println(lnr.getLineNumber() + ": " + str);
45. Layering style: Benefits
+ Reuse of layers
+ Support for standardization
+ Dependencies are kept local
+ Exchangeability
Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. 1996. Pattern-Oriented Software Architecture: A System of Patterns. John Wiley & Sons, Inc., NY, USA.
46. Layering style: Liabilities
- Cascades of changing behavior
- Lower efficiency
- Unnecessary work
- Difficulty in establishing the correct
granularity of layers
Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. 1996. Pattern-Oriented Software Architecture: A System of Patterns. John Wiley & Sons, Inc., NY, USA.
47. What architectural style is
this?
MRI brain image, median filter, edge detection filter
Source: http://aosabook.org/en/itk.html
53. Pipe-and-filter: Benefits
+ Flexibility by filter exchange
+ Flexibility by recombination
+ Reuse of filter components
+ Rapid prototyping of pipelines
Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. 1996. Pattern-Oriented Software Architecture: A System of Patterns. John Wiley & Sons, Inc., NY, USA.
54. Pipe-and-filter: Liabilities
- Sharing state information is expensive or
inflexible
- Efficiency gain by parallel processing is
often an illusion
- Data transformation overhead
- Difficult to handle errors
Frank Buschmann, Regine Meunier, Hans Rohnert, Peter Sommerlad, and Michael Stal. 1996. Pattern-Oriented Software Architecture: A System of Patterns. John Wiley & Sons, Inc., NY, USA.
62. Strategies and tactics
A tactic is a design decision that
influences the control of a quality
attribute response
A collection of tactics is known as “strategies”
Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
63. Example: Security tactics
Security
Resisting
Attacks
Detecting
Attacks
Recovering
From attack
! Authenticate users
! Authorize users
! Maintain data
confidentiality
! Maintain integrity
! Limit exposure
! Limit access
Restoration Identification
Stimulus:
Attack Response:
System
detects,
resists, or
recovers from
attacks
See “Availability“ Audit Trail
Intrusion
Detection
Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
64. Exercise: Tactics for
achieving qualities
Availability
The property of software that it there and ready to carry out
its task when you need it to be
Testability
The ease with which software can be made to demonstrate
its faults through (typically execution-based) testing
Security
Measure of the system’s ability to protect data and
information from unauthorised access while still providing
access to people and systems that are authorized
Performance The software’s ability to meet timing requirements
Modifiability
The ease with which the software can be modified (with
minimal risk and cost)
Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.
77. Agenda
• Introduction to SA
• Design principles,
patterns and architectural
styles
• Realizing Quality
Requirements (NFRs)
• Case Studies: OSS
Projects
• FOSS Tools for Architects
78. Reference architectures
Source: Alessandro Bassi, Martin Bauer, Martin Fiedler, Thorsten Kramp, Rob Van Kranenburg, Sebastian Lange, and Stefan Meissner. 2013.
Enabling Things to Talk: Designing IoT Solutions with the IoT Architectural Reference Model. Springer
114. Examples from
Open Source
architectures
• Architecture descriptions
from well-known open
source software from key
contributors
• You can get insights on
the architecture from
practical illustrations
http://www.aosabook.org/en/index.html
115. Practical book on SA
• Useful to get an overview of
software architecture
• Especially useful if you are a
programmer
• Complete presentation
available here.
116. Good first
book on SA
• Shares practical
experiences in
architecting enterprise IT
systems
• If you want to learn about
enterprise architecture,
read this
117. SEI’s book on
SA
• Good coverage of
Attribute Driven Design,
Architecture Trade-off
Analysis Method, Quality
Attributes, etc
• If you want an in-depth
understanding, read this
118. In-depth treatment on SA
• Covers a wide range of
topics in detail (stypes,
modelling, visualisation,
analysis, etc)
• Perhaps the most
comprehensive/in-depth
discussion on important
SA topics
• Slides available online
here
119. THE book on design
patterns
• One of the earliest and
best books on design
patterns
• Presents a catalog of 23
design patterns
• Classified as creational,
structural, and
behavioral patterns
120. THE book on architectural
patterns
• One of the earliest and
best books on
architectural patterns
• Presents a catalog of
architectural patterns with
detailed discussion
• Referred to as POSA
book
• First book in the series
of books on patterns/
styles
121. Anti-patterns in
development,
architecture, …
• A practical book that
covers anti-patterns in
software architectures as
well as projects
• Important to know anti-
patterns so that we can
avoid them
122. Architectural
refactoring is
tough!
• The focus is on refactoring
techniques, tools, and
processes in the large-
scale (i.e., architectural
level)
• Covers architectural
smells as well
123. Getting a
systems
perspective
• Emphasises on working with
stakeholders, and using
viewpoints and perspectives
• Read this if you are looking
for gaining an in-depth
understanding of working
with stakeholders and using
viewpoints and perspectives
124. An early take
on SA
• Provides a good overview
of architectural patterns
• If you are interested in
architectural styles, tools,
languages and notations,
etc, read this