Architecture and Agility June 8, 2009 @ USC

T H E U N I V E R S I T Y O F B R I T I S H C O L U M B I A

Software Architecture and Agile Development —An Oxymoron?

Philippe Kruchten USC, June 8th 2009

Copyright © 2004-2009 by Philippe Kruchten 1

Philippe Kruchten, Ph.D., P.Eng., CSDP

Professor of Software Engineering Department of Electrical and University of British Columbia [email protected] +1 604 827-5654

Founder and president Kruchten Engineering Services Ltd [email protected] +1 604 418-2006

Cofounder and secretary of IFIP WG2.10 on Cofounder of Agile Vancouver Associate Editor of IEEE Software for architecture and design

Kruchten - 2009

Philippe Kruchten 1 Architecture and Agility June 8, 2009 @ USC

Agile & Architecture? Oil & Water?

ƒ Paradox ƒ Oxymoron ƒ Conflict ƒ Incompatibility

Kruchten - 2009

Agility

ƒ A definition • Agility is the ability to both create and respond to chhidtfititbltbiange in order to profit in a turbulent business environment. Jim Highsmith (2002) ƒ Characteristics • Iterative and incremental • SlllSmall release • Collocation • Release plan/ feature backlog • Iteration plan/task backlog Sanjiv Augustine (2004)

Kruchten - 2009

Philippe Kruchten 2 Architecture and Agility June 8, 2009 @ USC

Agile Values: the Agile Manifesto

We have come to value: ƒ Individuals and interactions over process and tools, ƒ Working software over comprehensive documents, ƒ Customer collaboration over contract negotiation, ƒ Responding to change over following a plan. That is, while there is value in the items on the right, we value the items on the left more

Source: http://www.agilemanifesto.org/

Kruchten - 2009

Software Architecture: A Definition

Software architecture encompasses the significant decisions about ƒ the organization of a software system, ƒ the selection of the structural elements and their interfaces by which the system is composed together with their behavior as specified in the collaboration among those elements, ƒ the composition of these elements into progressively larger subsystems,

Grady Booch, Philippe Kruchten, Rich Reitman, Kurt Bittner; Rational, circa 1995 (derived from Mary Shaw) Kruchten - 2009

Philippe Kruchten 3 Architecture and Agility June 8, 2009 @ USC

Software Architecture (cont.)

ƒ the architectural style that guides this organization, these elements and their interfaces, their collaborations, and their composition. Software architecture is not only concerned with structure and behavior, but also with usage, functionality, performance, resilience, reuse, comprehensibility, economic and technological constraints and tradeoffs, and aesthetics.

Kruchten - 2009

Perceived Tensions Agility- Architecture

ƒ Architecture = Big Up-Front Design ƒ Architecture = massive documentation ƒ Role of architect(s) ƒ Low perceived or visible value of architecture

Adaptation versus Anticipation

Kruchten - 2009

Philippe Kruchten 4 Architecture and Agility June 8, 2009 @ USC

Story of a failure

ƒ Large re-engineering of a complex distributed world-wide syy;stem; 2 millions LOC in C, C++, Cobol and VB ƒ Multiple sites, dozens of data repositories, hundreds of users, 24 hours operation, mission- critical ($billions) ƒ xP+Scrum, 1-week iterations, 30 then up to 50 dldevelopers ƒ Rapid progress, early success, features are demo-able ƒ Direct access to “customer”, etc. ƒ A poster project for scalable agile development Kruchten - 2009

Hitting the wall

ƒ After 4 ½ months, difficulties to keep with the 1-week iterations ƒ Refactoring takes longer than one iteration ƒ Scrap and rework ratio increases dramatically ƒ No externally visible progress anymore ƒ Iterations stretched to 3 weeks ƒ Staff turn-over increases; Project comes to a halt ƒ Lots of code, no clear architecture, no obvious way forward

Kruchten - 2009

Philippe Kruchten 5 Architecture and Agility June 8, 2009 @ USC

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Philippe Kruchten 6 Architecture and Agility June 8, 2009 @ USC

Semantics

ƒ What do we mean by “architecture”?

Kruchten - 2009

Software Architecture: A Definition

Software architecture encompasses the significant decisions about ƒ the organization of a software system, ƒ the selection of the structural elements and their interfaces by which the system is composed together with their behavior as specified in the collaboration among those elements, ƒ the composition of these elements into progressively larger subsystems,

Grady Booch, Philippe Kruchten, Rich Reitman, Kurt Bittner; Rational, circa 1995 (derived from Mary Shaw) Kruchten - 2009

Philippe Kruchten 7 Architecture and Agility June 8, 2009 @ USC

Software Architecture (cont.)

ƒ the architectural style that guides this organization, these elements and their interfaces, their collaborations, and their composition. Software architecture is not only concerned with structure and behavior, but also with usage, functionality, performance, resilience, reuse, comprehensibility, economic and technological constraints and tradeoffs, and aesthetics.

Kruchten - 2009

Architecture = design decisions

Software Software Architecture design Decisions “Design” decisions Architectural decisions “Requirements constraints” Req me n u ts ire Code etc.

A choice that is binding in the final product

Kruchten - 2009

Philippe Kruchten 8 Architecture and Agility June 8, 2009 @ USC

Architecture = Design? Not

“Do not dilute the meaning of the term architecture by applying it to everything in sight.” Mary Shaw

Kruchten - 2009

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Philippe Kruchten 9 Architecture and Agility June 8, 2009 @ USC

Scope

ƒ How much architecture stuff do you really need?

ƒ It depends…

ƒ It depypends on your context

Kruchten - 2009

Environment ’ Context ’ Practice

ƒ Environment Conditions (organization)

Drive/constrain

ƒ Context Attributes (software project)

Drive

ƒ Practices (actual process)

Kruchten - 2009

Philippe Kruchten 10 Architecture and Agility June 8, 2009 @ USC

Context attributes affecting practices

1. Size Size Age of Criticality 2. Criticality System 3. Age of system

4. Rate of change Rate of Business Context 5. Business model change model 6. Stable architecture Stable 7. Team distribution Governance Architecture 8. Governance Team Distribution

Kruchten - 2009

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Philippe Kruchten 11 Architecture and Agility June 8, 2009 @ USC

Lifecycle

ƒ When does architectural activities take place? ƒ The evil of “BUFD” = Big Up-Front Design

ƒ “Defer decisions to the last responsible moment”

ƒ Refactor!

Kruchten - 2009

Architectural Effort During the Lifecycle

Inception Elaboration Construction Transition

time

Majority of architectural design activities

Kruchten - 2009

Philippe Kruchten 12 Architecture and Agility June 8, 2009 @ USC

Little dedicated architectural effort

Inception Construction Transition

time

Minimal pure Ideal realm of agile Architectural practices Activities

Kruchten - 2009

Iterations and Phases

Inception Elaboration Construction Transition

PliiPreliminary AhittArchitect. AhittArchitect. DlDevel. DlDevel. DlDevel. TitiTransition TitiTransition Iteration Iteration Iteration Iteration Iteration Iteration Iteration Iteration

Internal Releases with Releases with main fhittfocus on architecture fftfocus on features

An architectural iteration focuses in putting in place major architectural elements, resulting in a baseline architectural prototype at the end of elaboration.

Kruchten - 2009

Philippe Kruchten 13 Architecture and Agility June 8, 2009 @ USC

Team Structure over Time (Very Large)

Inception Elaboration Construction and Transition

Management team Management team

Architecture team

Architecture Feature team 1 team Initial team Feature team 2

Prototyping team Infrastructure Feature team 3 team A Infrastructure team B

Kruchten - 2009 integration team

Teams using agile development practices

Inception Elaboration Construction and Transition

Management team Management team

Architecture team

Architecture Feature team 1 team Initial team Feature team 2

Prototyping team Infrastructure Feature team 3 team A Infrastructure team B

Kruchten - 2009 integration team

Philippe Kruchten 14 Architecture and Agility June 8, 2009 @ USC

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Inflation?

Kruchten - 2009

Philippe Kruchten 15 Architecture and Agility June 8, 2009 @ USC

Role – Agile Architect

ƒ A. Johnston defines the agile architect, but it does not seems to be any different from a software archit ec t be fore ag ile me tho ds came in. ƒ Combination of • Visionary - Shaper • Designer – making choices • Communicator – between multiple parties • Troubleshooter • Herald – window of the project • Janitor – cleaning up behind the PM and the developers

Kruchten - 2009

Two styles of software/system architects

ƒ Maker and Keeper of Big ƒ Mentor, Troubleshooter, decisions and Prototyper • Bring in technological • Implements and try changes architecture • External collaboration • Intense internal • More requirements-facing collaboration • Gatekeeper • More code-facing • Fowler: Architectus • Fowler: Architectus aryzus reloadus

Only big new projects need both or separate people

Kruchten - 2009

Philippe Kruchten 16 Architecture and Agility June 8, 2009 @ USC

Team Structure over Time (Very Large)

Inception Elaboration Construction and Transition

Management team Management team

Architecture team

Architecture Feature team 1 team Initial team Feature team 2

Prototyping team Infrastructure Feature team 3 team A Infrastructure team B

Kruchten - 2009 integration team

A. Reloadus and A. Aryzus ecological niches

Inception Elaboration Construction and Transition

Management team Management team

A. Reloadus Architecture team

Architecture Feature team 1 team Initial team Feature team 2

Prototyping team Infrastructure Feature team 3 team A Infrastructure team B A. Aryzus Kruchten - 2009 integration team

Philippe Kruchten 17 Architecture and Agility June 8, 2009 @ USC

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Implementation Logical View Architectural description View

Use Case View

ƒ Metaphor Process Deployment View View ƒ Prototype ƒ Software architecture document ƒ Use of UML? ƒ UML-based tools? ƒ Code?

Kruchten - 2009

Philippe Kruchten 18 Architecture and Agility June 8, 2009 @ USC

It will depend on context (not agile issue)

1. Size Size Age of Criticality 2. Criticality System 3. Age of system

4. Rate of change Rate of Business Context 5. Business model change model 6. Stable architecture Stable 7. Team distribution Governance Architecture 8. Governance Team Distribution

Kruchten - 2009

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Philippe Kruchten 19 Architecture and Agility June 8, 2009 @ USC

Architectural design methods

ƒ Many agile developers do not know (much) about architectural design ƒ Agile methods have no explicit guidance for architecture • Metaphor in XP • Technical activities in scrum ƒ Relate this to Semantics and Scope issue

ƒ May have to get above the code level

Kruchten - 2009

Issues

1. Semantics 2. Scope 3. Lifecycle 4. Role 5. Description 6. Methods 7. Value & cost

Kruchten - 2009

Philippe Kruchten 20 Architecture and Agility June 8, 2009 @ USC

Value and cost

ƒ Architecture has no (or little) externally visible “customer value” ƒ Iteration planning (backlog) is driven by “customer value” ƒ Ergo: architectural activities are not given attention

ƒ “Last responsible moment!” & Refactor!

Kruchten - 2009

Value and cost

ƒ Cost of development is not identical to value ƒ Trying to assess value and cost in monetary terms is hard and often leads to vain arguments

ƒ Use points (“utils”)

Kruchten - 2009

Philippe Kruchten 21 Architecture and Agility June 8, 2009 @ USC

Planning

ƒ From requirements derive: • Architectural requirements • Functional requirements ƒ Establish • Dependencies •Cost ƒ Plan interleaving: • Functional increments • Architectural increments

Kruchten - 2009

Weaving functional and architectural bits

Kruchten - 2009

Philippe Kruchten 22 Architecture and Agility June 8, 2009 @ USC

Benefits

ƒ Gradual emergence of architecture ƒ Validation of architecture with actual functionality ƒ Early enough to support development

ƒ Not just BUFD ƒ No YAGNI effect

Kruchten - 2009

Iterations and Phases

Inception Elaboration Construction Transition

PliiPreliminary AhittArchitect. AhittArchitect. DlDevel. DlDevel. DlDevel. TitiTransition TitiTransition Iteration Iteration Iteration Iteration Iteration Iteration Iteration Iteration

Internal Releases with Releases with main fhittfocus on architecture fftfocus on features

An architectural iteration focuses in putting in place major architectural elements, resulting in a baseline architectural prototype at the end of elaboration.

Kruchten - 2009

Philippe Kruchten 23 Architecture and Agility June 8, 2009 @ USC

Agility as a Culture

Culture Beliefs, Norms Rituals Jargon

Values Behaviours Reflect beliefs Reflect values

Manifesto!

Kruchten - 2009 R. Thomsett 2007

Agility and Architecture as Cultures

CultureCulture Beliefs,Beliefs, Norms Norms Rituals Jargon

ValuesValues BehavioursBhBehav iours ReflectReflect beliefs beliefs ReflectReflect values values

Kruchten - 2009 R. Thomsett 2007

Philippe Kruchten 24 Architecture and Agility June 8, 2009 @ USC

Stages

ƒ Ethnocentrism • Denial • Defense

ƒ Ethnorelativism • Acceptance • Integration

Kruchten - 2009

Learn from the “other” culture

ƒ Agilists • Exploit architecture to scale up • Exploit architecture to partition the work • Exploit architecture to communicate •… ƒ Architects • Exploit iterations to experiment • Exploit functionality to assess architecture • Exploit growing system to prune (KISS), keep it lean •…

Kruchten - 2009

Philippe Kruchten 25 Architecture and Agility June 8, 2009 @ USC

Recommendations

ƒ Understand your context 1. Semantics • How much architecture? 2. Scope 3. Lifecycle ƒ Define architecture 4. Role • Meaning 5. Description • Boundaries 6. Methods • Responsibility 7. Value & cost • Tactics (methods) • Representation

Kruchten - 2009

Recommendations

ƒ No ivory tower • Architect is one of us • “Architecture owner” (Product owner) • Make architecture visible, at all time ƒ Build early an evolutionary architectural prototype • Constantly watch for architecturally significant requirements • Use iterations to evolve, refine • Understand when to freeze this architecture (architectural stability) ƒ Weave functional aspects with architectural (technical) aspects (“zipper”)

Kruchten - 2009

Philippe Kruchten 26 Architecture and Agility June 8, 2009 @ USC

Evolutionary Design

“In order to work, evolutionary design needs a force that drives it to converge. This force can only come from people – somebody on the team has to have the determination to ensure that the design quality stays high.”

Martin Fowler 2002

Kruchten - 2009

The first matrix I designed was quite naturally perfect…. Kruchten - 2009

Philippe Kruchten 27 Architecture and Agility June 8, 2009 @ USC

… a triumph equaled only by its monumental failure.

… I have since come to understand that the answer eluded me because it required a lesser mind, or perhaps a mind less bound by the parameters of perfection.

Kruchten - 2009

Questions?

Kruchten - 2009

Philippe Kruchten 28 Architecture and Agility June 8, 2009 @ USC

References

ƒ Ambler, S. W. (2006). Scaling Agile Development Via Architecture [Electronic Version]. Agile Journal, from http://www.agilejournal.com/content/view/146/ ƒ Clements, P., Ivers, J., Little, R., Nord, R., & Stafford, J. (2003). Documenting Software Architectures in an Agile World (Report CMU/SEI-2003-TN-023). Pittsburgh: Software Engineering Institute. ƒ Fowler, M. (2004) Is design dead? At http://martinfowler.com/articles/designDead.html ƒ Johnston, A., The Agile Architect, http://www.agilearchitect.org/ ƒ Kruchten, P. (1995). The 4+1 of Architecture. IEEE Software, 12(6), 45- 50. ƒ Kruchten, P. (1999). The Software Architect, and the Software Architecture Team. In P. Donohue (Ed.), Software Architecture (pp. 565-583). Boston: Kluwer Academic Publishers. ƒ Kruchten, P. (2003). The Rational : An Introduction (3rd ed.). Boston: Addison-Wesley. ƒ Kruchten, P. ()(2004). Scaling down pjprojects to meet the A gile sweet s pot. The Rational Edge. http://www-106.ibm.com/developerworks/ rational/library/content/RationalEdge/aug04/5558.html ƒ Mills, J. A. (1985). A Pragmatic View of the System Architect. Comm. ACM, 28(7), 708-717. ƒ Nord, R. L., & Tomayko, J. E. (2006). Software Architecture-Centric Methods and Agile Development. IEEE Software, 23(2), 47-53. ƒ Parsons, R. (2008). Architecture and Agile Methodologies—How to Get Along. Tutorial At WICSA 2008, Vancouver, BC.

Kruchten - 2009

Philippe Kruchten 29