131
Ganesh Samarthyam [email protected] www.designsmells.com Software Architecture: Principles, Patterns, and Practices

Software Architecture: Principles, Patterns and Practices

Embed Size (px)

Citation preview

Page 1: Software Architecture: Principles, Patterns and Practices

Ganesh Samarthyam [email protected]

www.designsmells.com

Software Architecture: Principles, Patterns, and Practices

Page 2: Software Architecture: Principles, Patterns and Practices

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?

Page 3: Software Architecture: Principles, Patterns and Practices

Generalist

Specialist

Source: Software Architecture for Developers, Simon Brown, LeanPub, 2014

Page 4: Software Architecture: Principles, Patterns and Practices

Agenda• Introduction to SA

• Design principles, patterns and architectural styles

• Realizing Quality Requirements (NFRs)

• Case Studies: OSS Projects

• FOSS Tools for Architects

Page 5: Software Architecture: Principles, Patterns and Practices

What is software architecture?

Page 6: Software Architecture: Principles, Patterns and Practices
Page 7: Software Architecture: Principles, Patterns and Practices

All#architecture#is#design#but#not#all#

design#is#architecture#

Design

Architecture

Page 8: Software Architecture: Principles, Patterns and Practices

“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)wareArchitectureinPrac2ce(2ndedi2on),Bass,Clements,Kazman;Addison-Wesley2003:

Page 9: Software Architecture: Principles, Patterns and Practices

“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.

Page 10: Software Architecture: Principles, Patterns and Practices

“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.

Page 11: Software Architecture: Principles, Patterns and Practices

Architecture represents the significant design decisions that shape a

system, where significant is measured by cost of change.

- Grady Booch (2006)

Page 12: Software Architecture: Principles, Patterns and Practices

NFRs

Constraints

TechnologyCross-cutting concerns

Others (e.g.: overall

structure)

Dimensions of ADs

Page 13: Software Architecture: Principles, Patterns and Practices

Cross-cutting concerns

Error/Exception handling

ConcurrencyPersistence

Event handling

Interaction and presentation

Source: SWEBOK v3

Page 14: Software Architecture: Principles, Patterns and Practices
Page 15: Software Architecture: Principles, Patterns and Practices

Architecture?**

Network*architecture*

Solu2on*architecture*

Applica2on*architecture*

Pla6orm*architecture*

…*

Data*architecture*

Hardware*architecture*

Web*architecture**

Page 16: Software Architecture: Principles, Patterns and Practices
Page 17: Software Architecture: Principles, Patterns and Practices

Source: Software Architecture for Developers, Simon Brown, LeanPub, 2014

Page 18: Software Architecture: Principles, Patterns and Practices
Page 19: Software Architecture: Principles, Patterns and Practices

CHAOS!'

Vision' Order'

Source: Software Architecture for Developers, Simon Brown, LeanPub, 2014

Page 20: Software Architecture: Principles, Patterns and Practices

Agenda• Introduction to SA

• Design principles, patterns and architectural styles

• Realizing Quality Requirements (NFRs)

• Case Studies: OSS Projects

• FOSS Tools for Architects

Page 21: Software Architecture: Principles, Patterns and Practices

Patterns inside Taj Mahal

Page 22: Software Architecture: Principles, Patterns and Practices

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?

Page 23: Software Architecture: Principles, Patterns and Practices

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

Page 24: Software Architecture: Principles, Patterns and Practices

Builder pattern: Structure

Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994

Page 25: Software Architecture: Principles, Patterns and Practices

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

Page 26: Software Architecture: Principles, Patterns and Practices

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);

Page 27: Software Architecture: Principles, Patterns and Practices

ScenarioInitial design

TextView

+ Draw()

BorderedTextView

+ Draw()+ DrawBorder()

Page 28: Software Architecture: Principles, Patterns and Practices

Scenario

Source: “Design Patterns: Elements of Reusable Object-Oriented Software”, Erich Gamma, Richard Helm, Ralph Johnson and John Vlissides, Addison-Wesley,1994

Page 29: Software Architecture: Principles, Patterns and Practices

Supporting new requirements

Revised design with new requirements

TextView

+ Draw()

BorderedTextView

+ Draw()+ DrawBorder()

ScrollableTextView ScrollableBorderedTextView

- borderWidth

+ Draw()+ ScrollTo()

- ScrollPosition

+ Draw()+ ScrollTo()+ DrawBorder()

- ScrollPosition- borderWidth

Page 30: Software Architecture: Principles, Patterns and Practices

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

Page 31: Software Architecture: Principles, Patterns and Practices

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

Page 32: Software Architecture: Principles, Patterns and Practices

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

Page 33: Software Architecture: Principles, Patterns and Practices

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

Page 34: Software Architecture: Principles, Patterns and Practices

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

Page 35: Software Architecture: Principles, Patterns and Practices

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

Page 36: Software Architecture: Principles, Patterns and Practices

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);

Page 37: Software Architecture: Principles, Patterns and Practices

SOLID principles•  There&should&never&be&more&than&one&reason&for&a&class&to&change&&

Single'Responsibility'Principle'(SRP)'

•  So6ware&en88es&(classes,&modules,&func8ons,&etc.)&should&be&open&for&extension,&but&closed&for&modifica8on&

Open'Closed'Principle'(OCP)'

•  Pointers&or&references&to&base&classes&must&be&able&to&use&objects&of&derived&classes&without&knowing&it&

Liskov’s'Subs<tu<on'Principle'(LSP)'

• Many&clientFspecific&interfaces&are&beGer&than&one&generalFpurpose&interface&

Interface'Segrega<on'Principle'(ISP)'

•  Depend&on&abstrac8ons,&not&on&concre8ons&Dependency'Inversion'Principle'(DIP)&

Page 38: Software Architecture: Principles, Patterns and Practices

Design principles behind patterns

Design'principles'behind'pa0erns'

Program'to'an'interface,'not'to'an'implementa7on''

Favor'object'composi7on''

over'inheritance'

Encapsulate'what'varies'

Page 39: Software Architecture: Principles, Patterns and Practices

Principles and enabling techniques

Source: Refactoring for Software Design Smells: Managing Technical Debt, Girish Suryanarayana, Ganesh Samarthyam, Tushar Sharma, Morgan Kaufmann/Elsevier, 2014

Page 40: Software Architecture: Principles, Patterns and Practices

Architecture/design determines qualities

Understandability Changeability Extensibility

Reusability Testability Reliability

Arch/Design

impactsimpacts

impacts

Page 41: Software Architecture: Principles, Patterns and Practices

“Applying design principles is the key to creating high-quality software!”

Architectural principles: Axis, symmetry, rhythm, datum, hierarchy, transformation

Page 42: Software Architecture: Principles, Patterns and Practices

Dravidian styleRenaissance style

Mughal style

Post-modern style

Page 43: Software Architecture: Principles, Patterns and Practices

What architectural style is this?

Image source: http://ashokbasnet.com.np/wp-content/uploads/2011/03/wx_thumb-5B1-5D.jpg

Page 44: Software Architecture: Principles, Patterns and Practices

Example: Abstracting for portability using layering

•  Helps'abstract'pla-orm0specific'details'abstrac4ng'hardware'specific'aspects''

Hardware'Abstrac4on'Layer'(HAL)'

•  Abstracts'OS'specific'func4onality'and'provides'a'generic'interface'to'underlying'OS'

Opera4ng'System'

Abstrac4on'Layer'(OSAL)'

•  Hides'database'specific'aspects'by'providing'a'generic'interface''

Database'Abstrac4on'Layer'(DAL)'

Page 45: Software Architecture: Principles, Patterns and Practices

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.

Page 46: Software Architecture: Principles, Patterns and Practices

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.

Page 47: Software Architecture: Principles, Patterns and Practices

What architectural style is this?

MRI brain image, median filter, edge detection filter

Source: http://aosabook.org/en/itk.html

Page 48: Software Architecture: Principles, Patterns and Practices

Compiler Example

Source: http://aosabook.org/en/llvm.html

Page 49: Software Architecture: Principles, Patterns and Practices

Compiler Example

Source: http://aosabook.org/en/llvm.html

Page 50: Software Architecture: Principles, Patterns and Practices

Compiler Example

Source: http://aosabook.org/en/llvm.html

Page 51: Software Architecture: Principles, Patterns and Practices

Real-world pipes-and-filters

sediment pre-carbon ultra-filter post-

carbonFiltered water

Page 52: Software Architecture: Principles, Patterns and Practices

Pipe-and-filter style

Page 53: Software Architecture: Principles, Patterns and Practices

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.

Page 54: Software Architecture: Principles, Patterns and Practices

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.

Page 55: Software Architecture: Principles, Patterns and Practices

Three-tier pattern

Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc.

• Common pattern used in business applications • Variant is two-tier

pattern - also known as Client-Server pattern

Page 56: Software Architecture: Principles, Patterns and Practices

Model-View-Controller (MVC) pattern

Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc.

• Common pattern used in GUI designs • Separates information (model), user interaction

(controller), and presentation (view)

Page 57: Software Architecture: Principles, Patterns and Practices

Sense-Compute-Control pattern

Software Architecture: Foundations, Theory, and Practice; Richard N. Taylor, Nenad Medvidovic, and Eric M. Dashofy; © 2008 John Wiley & Sons, Inc.

• Common pattern used in control applications • Example: Embedded software for automobiles,

aircrafts, etc.

Page 58: Software Architecture: Principles, Patterns and Practices

More styles/patterns to explore

• Blackboard style

• Microkernel style

• Broker style

• Peer-to-peer style

• …

Page 59: Software Architecture: Principles, Patterns and Practices

Agenda• Introduction to SA

• Design principles, patterns and architectural styles

• Realizing Quality Requirements (NFRs)

• Case Studies: OSS Projects

• FOSS Tools for Architects

Page 60: Software Architecture: Principles, Patterns and Practices

A process for architecting using scenarios

Source: http://msdn.microsoft.com/en-us/library/ee658084.aspx

Page 61: Software Architecture: Principles, Patterns and Practices

Deep-dive: Architecting using scenarios

Page 62: Software Architecture: Principles, Patterns and Practices

Strategies and tacticsA 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.

Page 63: Software Architecture: Principles, Patterns and Practices

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.

Page 64: Software Architecture: Principles, Patterns and Practices

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

SecurityMeasure 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.

Page 65: Software Architecture: Principles, Patterns and Practices

Tactics for availabilityUse$fault$detec,on$tac,cs$such$as$

ping/echo,$heartbeat,$,me$stamping,$sanity$checking,$

condi,on$monitoring,$and$self:test$

Use$fault$recovery$tac,cs$such$as$rollback$(to$a$previous$known$

good$state),$providing$“spares”$for$redundancy,$retry$the$opera,on,$ignoring$faulty$behavior,$and$

degrade$(gracefully$reduce$system$func,onality)$

Use$fault$preven,on$tac,cs$such$as$removal$from$service$

(temporarily$remove$the$faulty$component),$use$transac,onal$seman,cs$(ACID$proper,es),$

prevent$system$excep,ons$from$occurring.$

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 66: Software Architecture: Principles, Patterns and Practices

Tactics for modifiabilityReduce&size&of&the&module,&for&example&by&spli7ng&module&(to&reduce&the&average&cost&of&future&

changes)&

Increase&seman>c&cohesion&of&the&module&(by&ensuring&that&the&a&responsibili>es&serving&the&same&purpose&are&placed&in&the&same&

module)&

Reduce&coupling&through&encapsula>on&(by&providing&explicit&interfaces&and&hiding&internal&details),&

introducing&intermediate&dependencies&(e.g.,&introduce&

dynamic&lookup&of&services&with&SOA&using&directory&as&an&intermediary)&&&

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 67: Software Architecture: Principles, Patterns and Practices

Tactics for performanceControl'resource'demand'through'requiring'smaller'demand'on'resources'to'service'the'events;'for'instance,'reducing'the'sampling'

frequency'(for'capturing'environmental'data),'limi;ng'event'response'(by'queuing'the'events),'

priori;zing'events'(by'ranking'the'events'according'to'their'importance'and'processing'

them),'reducing'overheads'(by'consuming'lesser'resources),'bound'execu;on';mes,'and'increase'

resource'efficiency.'

Manage'the'resources'more'effec;vely'by'increasing'resources,'introducing'concurrency,'maintaining'mul;ple'copies'of'computa;on,'

bounding'queue'sizes,'and'scheduling'resources.''

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 68: Software Architecture: Principles, Patterns and Practices

Tactics for securityDetect%a'acks%by%looking%for%known%pa'erns%of%intrusion,%detec8ng%service%denial,%

verifying%message%integrity%before%using%them,%detec8ng%message%delay%(to%detect%man=

in=the=middle%a'acks).%

Resist%a'acks%by%iden8fying,%authen8ca8ng,%and%authorizing%actors%(note:%actors%are%sources%of%external%input%to%the%system),%limi8ng%access%to%resources,%and%limi8ng%exposure%of%the%system.%

React%to%a'acks%when%an%a'ack%is%underway%by%revoking%access,%

lock%computer,%or%inform%relevant%actors.%%

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 69: Software Architecture: Principles, Patterns and Practices

Tactics for testabilityControl'and'observe'system'state'by'

providing'specializing'interfaces,'record/playback'faults,'localize'state'storage'(instead'of'distribu;ng'the'state),'

abstract'input'data'sources,'sandbox'(by'isola;ng'the'system'from'the'real'world),'and'introduce'executable'asser;ons'(to'check'if'the'program'is'in'a'faulty'state)'

Limit'complexity'(by'reducing'cyclic'dependencies,'limi;ng'dependencies'to'

external'components,'etc;'in'OO'systems,'limit'depth'of'inheritance'tree,'reduce'dynamic'calls;'and'having'high'

cohesion,'low'coupling'and'separa;on'of'concerns);'also'limit'nonCdeterminism.'

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 70: Software Architecture: Principles, Patterns and Practices

Quantifying NFRs

Page 71: Software Architecture: Principles, Patterns and Practices

Metrics for availability

Time%or%interval%in%which%system%can%be%in%

degraded%mode%

Propor7on%or%rate%of%a%certain%class%of%faults%

that%the%system%prevents,%or%handles%

without%failing%

Average%7me%taken%to%detect%a%fault%

Average%7me%taken%to%repair%a%fault%

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 72: Software Architecture: Principles, Patterns and Practices

Metrics for modifiabilityCost%in%terms%of%the%

average%calendar%3me%taken%to%make,%test,%

and%deploy%a%modifica3on%

Cost%in%terms%of%the%number%of%new%defects%introduced%for%making,%tes3ng,%and%deploying%

a%modifica3on%

Cost%in%terms%of%the%number%of%new%defects%introduced%for%making,%tes3ng,%and%deploying%

a%modifica3on%Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 73: Software Architecture: Principles, Patterns and Practices

Metrics for performanceThe$%me$taken$to$process$the$arriving$events$(i.e.,$latency$or$

a$deadline)$

The$number$of$events$that$can$be$processed$within$a$par%cular$%me$

interval$(i.e.,$throughput)$

The$number$of$events$that$cannot$be$processed$by$the$

system$(i.e.,$the$miss$rate)$

The$varia%on$in$%me$taken$to$process$the$arriving$events$(i.e.,$

ji?er)$

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 74: Software Architecture: Principles, Patterns and Practices

Metrics for securityHow$much$of$a$system$is$compromised$when$a$par4cular$component$

or$data$value$is$compromised$

How$much$4me$passed$before$an$a8ack$was$

detected$$

How$many$a8acks$were$successfully$

resisted$$

How$long$does$it$take$to$recover$from$a$successful$a8ack$

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 75: Software Architecture: Principles, Patterns and Practices

Metrics for testabilityAverage'calendar',me'for'finding'a'fault'(for'a'par,cular'class/kind'of'

faults)'

The'average'calendar',me'required'to'test'a'given'percentage'of'statements'(i.e.,'state'

space'coverage)'

The'length'of'the'longest'test'chain'

(which'is'a'measure'of'the'difficulty'of'

performing'the'tests)'

The',me'required'to'prepare'the'test'environment''

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 76: Software Architecture: Principles, Patterns and Practices

Metrics for usabilityAverage'amount'of'.me'required'for'compe.ng'a'task'

The'ra.o'of'successful'to'total'

number'of'opera.ons'performed'

The'average'number'of'errors'made'by'a'user'for'compe.ng'a'

task'

Source: Len Bass, Paul Clements, and Rick Kazman. 2003. Software Architecture in Practice (2 ed.). Addison-Wesley Longman Publishing Co., Inc., Boston, MA, USA.

Page 77: Software Architecture: Principles, Patterns and Practices

Agenda• Introduction to SA

• Design principles, patterns and architectural styles

• Realizing Quality Requirements (NFRs)

• Case Studies: OSS Projects

• FOSS Tools for Architects

Page 78: Software Architecture: Principles, Patterns and Practices

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

Page 79: Software Architecture: Principles, Patterns and Practices

Use reference architectures when relevant ones are

available (don’t reinvent the wheel)

Page 80: Software Architecture: Principles, Patterns and Practices

Glasgow Haskell Compiler

Source: http://aosabook.org/en/ghc.html

Page 81: Software Architecture: Principles, Patterns and Practices

OpenSAR (Automotive Open Software Architecture)

Page 82: Software Architecture: Principles, Patterns and Practices

Pony-Build

Source: http://aosabook.org/en/integration.html

Page 83: Software Architecture: Principles, Patterns and Practices

It is hard to recognise architecture styles

from block diagrams

Page 84: Software Architecture: Principles, Patterns and Practices

GNU Debugger

Source: http://aosabook.org/en/gdb.html

Page 85: Software Architecture: Principles, Patterns and Practices

Nginx

Source: http://aosabook.org/en/nginx.html

Page 86: Software Architecture: Principles, Patterns and Practices

Dynamic Language Runtime

Source: http://aosabook.org/en/ironlang.html

Page 87: Software Architecture: Principles, Patterns and Practices

Asterix

Source: http://aosabook.org/en/asterisk.html

Page 88: Software Architecture: Principles, Patterns and Practices

Both informal diagrams (e.g. block diagrams) and semi-formal diagrams (e.g., UML)

are used in practice

Page 89: Software Architecture: Principles, Patterns and Practices

FreeRTOS Layers

Source: http://aosabook.org/en/freertos.html

Page 90: Software Architecture: Principles, Patterns and Practices

GPSD

Image source: http://aosabook.org/en/gpsd.html

Page 91: Software Architecture: Principles, Patterns and Practices

Open MPI

Image source: http://aosabook.org/en/openmpi.html

Page 92: Software Architecture: Principles, Patterns and Practices

Layering continues to be the most widely

used architecture style

Page 93: Software Architecture: Principles, Patterns and Practices

Image Hosting System

Source: http://aosabook.org/en/distsys.html

Page 94: Software Architecture: Principles, Patterns and Practices

Image Hosting System

Source: http://aosabook.org/en/distsys.html

Split reads and writes

Page 95: Software Architecture: Principles, Patterns and Practices

Image Hosting System

Source: http://aosabook.org/en/distsys.html

with redundancy

Page 96: Software Architecture: Principles, Patterns and Practices

Image Hosting System

Source: http://aosabook.org/en/distsys.html

with partitioning

Page 97: Software Architecture: Principles, Patterns and Practices

Start with the “simplest possible thing that works”

and evolve the architecture

Page 98: Software Architecture: Principles, Patterns and Practices

Linux: Intended Architecture

Page 99: Software Architecture: Principles, Patterns and Practices

Linux: Extracted Architecture

Page 100: Software Architecture: Principles, Patterns and Practices

As-IS architecture is almost always different than intended

architecture Solution: architecture oversight

Page 101: Software Architecture: Principles, Patterns and Practices

Dependencies in OpenJDK

Page 102: Software Architecture: Principles, Patterns and Practices

Refactoring cycles

Remove one of the dependencies

Change dependency direction Move one of the dependencies

Page 103: Software Architecture: Principles, Patterns and Practices

Continual refactoring is the best weapon to deal with architecture degradation

Page 104: Software Architecture: Principles, Patterns and Practices

Agenda• Introduction to SA

• Design principles, patterns and architectural styles

• Realizing Quality Requirements (NFRs)

• Case Studies: OSS Projects

• FOSS Tools for Architects

Page 105: Software Architecture: Principles, Patterns and Practices

InFusion/InCode

Page 106: Software Architecture: Principles, Patterns and Practices

PMD CPD

Page 107: Software Architecture: Principles, Patterns and Practices

ArchiMate

Source: http://www.archimatetool.com/img/archi_out.png

Page 108: Software Architecture: Principles, Patterns and Practices

ArchMate

Source: http://pubs.opengroup.org/architecture/archimate-doc/ts_archimate/chap9.html

Page 109: Software Architecture: Principles, Patterns and Practices

CodeCity

Code Cityhttp://www.inf.usi.ch/phd/wettel/codecity.html

Page 110: Software Architecture: Principles, Patterns and Practices

SonarQube

Sonarqubehttp://www.sonarqube.org

Page 111: Software Architecture: Principles, Patterns and Practices

ArgoUML

Source: http://a.fsdn.com/con/app/proj/argouml/screenshots/52103.jpg

Page 112: Software Architecture: Principles, Patterns and Practices

Nitric

Page 113: Software Architecture: Principles, Patterns and Practices

So, what’s next?

Page 114: Software Architecture: Principles, Patterns and Practices

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

Page 115: Software Architecture: Principles, Patterns and Practices

Practical book on SA

• Useful to get an overview of software architecture

• Especially useful if you are a programmer

• Complete presentation available here.

Page 116: Software Architecture: Principles, Patterns and Practices

Good first book on SA

• Shares practical experiences in architecting enterprise IT systems

• If you want to learn about enterprise architecture, read this

Page 117: Software Architecture: Principles, Patterns and Practices

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

Page 118: Software Architecture: Principles, Patterns and Practices

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

Page 119: Software Architecture: Principles, Patterns and Practices

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

Page 120: Software Architecture: Principles, Patterns and Practices

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

Page 121: Software Architecture: Principles, Patterns and Practices

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

Page 122: Software Architecture: Principles, Patterns and Practices

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

Page 123: Software Architecture: Principles, Patterns and Practices

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

Page 124: Software Architecture: Principles, Patterns and Practices

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

Page 125: Software Architecture: Principles, Patterns and Practices

Tips/techniques

perspective on SA

• Provides a collection of advices from working architects

• If you are already an architect and want to know best practices, read this

Page 126: Software Architecture: Principles, Patterns and Practices

And don’t forget ours!Forewords by

Grady Booch and Dr. Stephane Ducasse

Page 127: Software Architecture: Principles, Patterns and Practices

What were your key takeaways?

Page 128: Software Architecture: Principles, Patterns and Practices

Image credits• http://upload.wikimedia.org/wikipedia/commons/c/c8/Taj_Mahal_in_March_2004.jpg

• http://i.msdn.microsoft.com/dynimg/IC148840.jpg

• http://upload.wikimedia.org/wikipedia/commons/2/2d/StPetersDomePD.jpg

• http://upload.wikimedia.org/wikipedia/commons/thumb/a/ae/Wells_Fargo_Center_from_Foshay.jpg/800px-Wells_Fargo_Center_from_Foshay.jpg

• http://files.hostgator.co.in/hostgator236040/image/architecture_design_blueprint_1280x800_2984.jpg

• http://www.aosabook.org/images/itk/ExampleImageProcessingPipeline.png

• http://upload.wikimedia.org/wikipedia/commons/e/e0/Madurai_Meenakshi_temple_gopuram.jpg

• http://upload.wikimedia.org/wikipedia/commons/thumb/7/77/Blue_Mosque_Courtyard_Dusk_Wikimedia_Commons.jpg/1920px-Blue_Mosque_Courtyard_Dusk_Wikimedia_Commons.jpg

• http://sse.tongji.edu.cn/yingshen/course/SA/img/essentialSA.png

• http://www-fp.pearsonhighered.com/assets/hip/images/bigcovers/0321815734.jpg

• http://www.softwarearchitecturebook.com/wp-content/uploads/2009/05/saftp.jpg

• http://img5a.flixcart.com/image/book/8/9/2/haefel-400x400-imadt2ra9mghcshk.jpeg

• http://ecx.images-amazon.com/images/I/81su7OSd8JL._SL1471_.jpg

Page 129: Software Architecture: Principles, Patterns and Practices

Image credits• http://www.viewpsd.com/wp-content/uploads/2013/04/accept-button.jpg

• http://www.viewpsd.com/wp-content/uploads/2013/04/delete-button.jpg

• http://forloveofwater.co.za/wp-content/uploads/2012/03/icon5.png

• http://media-cdn.tripadvisor.com/media/photo-s/03/ca/ef/b4/taj-mahal.jpg

• http://greengopost.com/wp-content/uploads/2013/03/taj-mahal-architecture-features-2-426x320.jpg

• http://photo.rebeccaweeks.com/wp-content/uploads/2012/03/DSC_0987-795x527.jpg

• http://upload.wikimedia.org/wikipedia/commons/4/48/TajPaintedGeometry.JPG

• http://vgrgic.files.wordpress.com/2014/03/architecture_book.png?w=646

• http://ecx.images-amazon.com/images/I/81gtKoapHFL.jpg

• http://d.gr-assets.com/books/1348907122l/85039.jpg

Page 130: Software Architecture: Principles, Patterns and Practices

Image credits❖ http://en.wikipedia.org/wiki/Fear_of_missing_out❖ http://lesliejanemoran.blogspot.in/2010_05_01_archive.html❖ http://javra.eu/wp-content/uploads/2013/07/angry_laptop2.jpg

❖ https://www.youtube.com/watch?v=5R8XHrfJkeg❖ http://womenworld.org/image/052013/31/113745161.jpg❖ http://www.fantom-xp.com/wallpapers/33/I'm_not_sure.jpg❖ https://www.flickr.com/photos/31457017@N00/453784086

❖ https://www.gradtouch.com/uploads/images/question3.jpg❖ http://gurujohn.files.wordpress.com/2008/06/bookcover0001.jpg ❖ http://upload.wikimedia.org/wikipedia/commons/d/d5/Martin_Fowler_-_Swipe_Conference_2012.jpg

❖ http://www.codeproject.com/KB/architecture/csdespat_2/dpcs_br.gif ❖ http://upload.wikimedia.org/wikipedia/commons/thumb/2/28/Bertrand_Meyer_IMG_2481.jpg/440px-

Bertrand_Meyer_IMG_2481.jpg ❖ http://takeji-soft.up.n.seesaa.net/takeji-soft/image/GOF-OOPLSA-94-Color-75.jpg?d=a0 ❖ https://developer.apple.com/library/ios/documentation/cocoa/Conceptual/OOP_ObjC/Art/watchcalls_35.gif

❖ http://www.pluspack.com/files/billeder/Newsletter/25/takeaway_bag.png ❖ http://cdn1.tnwcdn.com/wp-content/blogs.dir/1/files/2013/03/design.jpg