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 workshop is certainly for you. This workshop 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.
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?
3. What is software
architecture?
How to evolve an
architecture?
What is the software
architecture
development process?
What factors influences
software architecture?
6. “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:
7. “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.
8. “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.
9. Architecture represents the significant
design decisions that shape a
system, where significant is measured
by cost of change.
- Grady Booch (2006)
21. 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.
22. 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.
24. $ cat limerick.txt
There was a young lady of Niger
Who smiled as she rode on a tiger.
They returned from the ride
With the lady inside
And a smile on the face of the tiger.
25. $ cat limerick.txt | tr -cs "[:alpha:]" "n" | awk '{print
length(), $0}' | sort | uniq
1 a
2 as
2 of
2 on
3 And
3 Who
3 she
3 the
3 was
4 They
4 With
4 face
4 from
4 lady
4 ride
4 rode
5 Niger
5 There
5 smile
5 tiger
5 young
6 inside
6 smiled
8 returned
26. List<String> lines
= Files.readAllLines(Paths.get("./limerick.txt"), Charset.defaultCharset());
Map<Integer, List<String>> wordGroups
= lines.stream()
.map(line -> line.replaceAll("W", "n").split("n"))
.flatMap(Arrays::stream)
.sorted()
.distinct()
.collect(Collectors.groupingBy(String::length));
wordGroups.forEach( (count, words) -> {
words.forEach(word -> System.out.printf("%d %s %n", count, word));
});
1 a
2 as
2 of
2 on
3 And
3 Who
3 she
3 the
3 was
4 They
4 With
4 face
4 from
4 lady
4 ride
4 rode
5 Niger
5 There
5 smile
5 tiger
5 young
6 inside
6 smiled
8 returned
28. 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.
29. 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.
45. Amazon’s rules for teams
• All teams will henceforth expose their data and functionality
through service interfaces.
• Teams must communicate with each other through these
interfaces.
• There will be no other form of inter-service/team communication
allowed: no direct linking, no direct reads of another team’s
datastore, no shared memory model, no backdoors whatsoever.
• The only communication allowed is via service interface calls
over the network.
• It doesn’t matter what technology they [other services] use.
• All service interfaces, without exception, must be designed from
the ground up to be externalizable.
• That is to say, the team must plan and design to be able to
expose the interface to developers in the outside world.
46. Service = a team can DURS
(Deploy, Update, Replace, Scale)
Microservices = Damn U R Sexy
51. A process for architecting
using scenarios
Source: http://msdn.microsoft.com/en-us/library/ee658084.aspx
52. 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.
53. 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.
54. 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.
68. 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
94. “Cities grow, cities evolve, cities
have parts that simply die while other
parts flourish; each city has to be
renewed in order to meet the needs of its
populace… Software-intensive systems
are like that. They grow, they evolve,
sometimes they wither away, and
sometimes they flourish…”
Grady Booch in the foreword for “Refactoring for Software Design Smells: Managing Technical Debt”, Girish Suryanarayana, Ganesh Samarthyam, Tushar Sharma, Morgan Kaufmann/Elsevier, 2014.
102. Michael
Feathers
S
Single Responsibility
Principle
Every object should have a single responsibility and
that should be encapsulated by the class
O Open Closed Principle
Software should be open for extension, but closed for
modification
L
Liskov’s Substitution
Principle
Any subclass should always be usable instead of its
parent class
I
Interface Segregation
Principle
Many client specific interfaces are better than one
general purpose interface
D
Dependency Inversion
Principle
Abstractions should not depend upon details. Details
should depend upon abstractions
113. "This is a good book about ‘Design Smells’ – actually
a great book – nicely organized - clearly written with
plenty of examples and a fair sprinkling of
anecdotes."
- Will Tracz (Principal Research Scientist & Fellow,
Lockheed Martin)
(review in ACM SIGSOFT Software Engineering
Notes)
114. Believe in your ideas:
how small or “insignificant” it may
appear to be!
115. "The critical design tool for software development
is a mind well educated in design principles"
- Craig Larman
117. Example of ISP violation
// using java.util.Date
Date today = new Date();
System.out.println(today);
$ java DateUse
Wed Dec 02 17:17:08 IST 2015
Why should we get the
time and timezone details if
I only want a date (e.g.,
date of birth)? Can I get rid
of these parts? No!
119. Example of a fix (java.time)
// using java.time.LocalDate
LocalDate today = LocalDate.now();
System.out.println(today);
$ java DateUse
2015-12-02
I can use (and hence
depend upon) only date
related functionality (not
time, zone, etc)
120. Example of a fix (java.time)
You can use only date,
time, or even timezone,
and combine them as
needed (in java.time)!
LocalDate today = LocalDate.now();
System.out.println(today);
LocalTime now = LocalTime.now();
System.out.println(now);
LocalDateTime todayAndNow = LocalDateTime.now();
System.out.println(todayAndNow);
ZonedDateTime todayAndNowInTokyo =
ZonedDateTime.now(ZoneId.of("Asia/Tokyo"));
System.out.println(todayAndNowInTokyo);
2015-12-02
17:37:22.647
2015-12-02T17:37:22.648
2015-12-02T21:07:22.649+09:00[Asia/Tokyo]
125. How to separate:
a) code generation logic
from node types?
b) how to support different
target types?
class Plus extends Expr {
private Expr left, right;
public Plus(Expr arg1, Expr arg2) {
left = arg1;
right = arg2;
}
public void genCode() {
left.genCode();
right.genCode();
if(t == Target.JVM) {
System.out.println("iadd");
}
else { // DOTNET
System.out.println("add");
}
}
}
126. class Plus extends Expr {
private Expr left, right;
public Plus(Expr arg1, Expr arg2) {
left = arg1;
right = arg2;
}
public Expr getLeft() {
return left;
}
public Expr getRight() {
return right;
}
public void accept(Visitor v) {
v.visit(this);
}
}
class DOTNETVisitor extends Visitor {
public void visit(Constant arg) {
System.out.println("ldarg " + arg.getVal());
}
public void visit(Plus plus) {
genCode(plus.getLeft());
genCode(plus.getRight());
System.out.println("add");
}
public void visit(Sub sub) {
genCode(sub.getLeft());
genCode(sub.getRight());
System.out.println("sub");
}
public void genCode(Expr expr) {
expr.accept(this);
}
}
127. Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994
128. ❖ Many distinct and unrelated
operations need to be
performed on objects in an
object structure, and you want
to avoid “polluting” their
classes with these operations
Represent an operation to be performed on the elements of an object structure.
Visitor lets you define a new operation without changing the classes of the
elements on which it operations
❖ Create two class
hierarchies:
❖ One for the elements
being operated on
❖ One for the visitors that
define operations on the
elements
134. Modularize JDK & JRE
Hide platform internal details such as sun.misc
Provide a module system for Java developers
Reference: http://paulbakker.io/java/java-9-modularity/
143. Steve Jobs is viewed as an excellent
speaker, business person, and leader. But
not much as an architect.
He is an excellent architect.
Why?
144.
145. In the movie Steve Jobs, he gives an example of
a music composer. The composer directs the
people and focuses on the orchestra.
That is the case with a software architect as well.
147. 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
148. Practical book on SA
• Useful to get an overview of
software architecture
• Especially useful if you are a
programmer
• Complete presentation
available here.
149. Good first
book on SA
• Shares practical
experiences in
architecting enterprise IT
systems
• If you want to learn about
enterprise architecture,
read this
150. 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
151. 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
152. 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
153. 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
154. 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
155. 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
156. 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
157. 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