156
Carnegie Mellon University Software Engineering Institute The Role of The Role of Architecture Architecture in Understanding in Understanding Software Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

  • View
    219

  • Download
    2

Embed Size (px)

Citation preview

Page 1: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Role of ArchitectureThe Role of Architecture

in Understanding Softwarein Understanding Software

Rick KazmanHausi Müller

Jeromy Carrière

Page 2: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Rick Kazman

[email protected]/staff/rkazman

Software Architecture:Software Architecture:

What is it and How to Represent ItWhat is it and How to Represent It

Page 3: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Controlprocess

(CP)

Noisemodel

(MODN)

Reverbmodel

(MODR)

Prop lossmodel

(MODP)

A Software Architecture (?)

Page 4: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

What is Wrong with this Diagram?Many things are left unspecified:Many things are left unspecified:

What kind of components?What kind of components? What kind of connectors?What kind of connectors? What do the boxes and arrows mean?What do the boxes and arrows mean? What is the significance of the layout? What is the significance of the layout? Why is control process on a higher level?Why is control process on a higher level?

Box and arrow drawings alone are not Box and arrow drawings alone are not architectures; rather, they are a starting point. architectures; rather, they are a starting point.

Page 5: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

What’s Wrong with the Diagram?WhichWhich structure? Software is composed of structure? Software is composed of manymany

structures.structures. modulesmodules taskstasks functionsfunctions hardwarehardware classesclasses

Thus, when seeing boxes and lines, we must askThus, when seeing boxes and lines, we must ask What do the boxes represent?What do the boxes represent? What do the arrows mean?What do the arrows mean?

Page 6: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

What is Software Architecture?

The software architecture of a program or The software architecture of a program or computing system is the structure or computing system is the structure or structures of the system, which comprise structures of the system, which comprise software components, the externally visible software components, the externally visible properties of those components, and the properties of those components, and the relationships among them.relationships among them.

Page 7: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Implications of this DefinitionArchitecture is an abstraction of systems.Architecture is an abstraction of systems.

Architecture defines components and how they Architecture defines components and how they interact.interact.

Architecture suppresses purely local information; Architecture suppresses purely local information; private component details are not architectural.private component details are not architectural.

Systems have many structures (views).Systems have many structures (views). No single view can be No single view can be thethe architecture. architecture. The set of candidate views is not fixed or prescribed: The set of candidate views is not fixed or prescribed:

whatever is useful for analysis or communication.whatever is useful for analysis or communication.

Page 8: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

More ImplicationsEvery system Every system hashas an architecture. an architecture.

Every system is composed of components and Every system is composed of components and relationships among them. relationships among them.

In the simplest case, a system is composed of a single In the simplest case, a system is composed of a single component, related only to itself.component, related only to itself.

Having an architecture is different from having an Having an architecture is different from having an architecture that is known. Issues:architecture that is known. Issues: precise specification of the architectureprecise specification of the architecture architecture recovery and conformancearchitecture recovery and conformance rationale for the architecturerationale for the architecture

Page 9: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Why Is Architecture Important?

Architecture is important for (at least) three Architecture is important for (at least) three reasons.reasons. It provides a vehicle for communication among It provides a vehicle for communication among

stakeholders.stakeholders. It is the manifestation of the earliest designIt is the manifestation of the earliest design

decisions about a system.decisions about a system. It is a transferable, reusable abstraction of aIt is a transferable, reusable abstraction of a

system.system.

Page 10: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Communication Vehicle

Architecture provides a common frame of Architecture provides a common frame of reference in which competing interests may be reference in which competing interests may be exposed and negotiated. exposed and negotiated. negotiating requirements with usersnegotiating requirements with users keeping the customer informed of progress and costkeeping the customer informed of progress and cost implementing management decisions and implementing management decisions and

allocationsallocations

Page 11: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Result of Early Design Decisions -1

An architecture An architecture constrainsconstrains an implementation. an implementation. implementations must conform to architectureimplementations must conform to architecture (global) resource allocation decisions constrain (global) resource allocation decisions constrain

implementations of individual componentsimplementations of individual components system tradeoffs are manifested in the architecturesystem tradeoffs are manifested in the architecture

Page 12: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Result of Early Design Decisions -2The architecture dictates organizational structure for The architecture dictates organizational structure for

development/maintenance efforts, e.g. development/maintenance efforts, e.g. division into teamsdivision into teams units for budgeting, planningunits for budgeting, planning basis of work breakdown structurebasis of work breakdown structure organization for documentationorganization for documentation organization for CM librariesorganization for CM libraries basis of integration, test plans, testingbasis of integration, test plans, testing basis of maintenancebasis of maintenance

Once committed to, an architecture is extremely Once committed to, an architecture is extremely hard to change!hard to change!

Page 13: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Result of Early Design Decisions-3.Architecture permits/precludes the achievement of a Architecture permits/precludes the achievement of a

system’s desired quality attributes (modifiability, system’s desired quality attributes (modifiability, performance, security, etc.). performance, security, etc.).

The architecture influences qualities, but does not The architecture influences qualities, but does not guarantee them.guarantee them.

An architecture helps with evolutionary prototyping.An architecture helps with evolutionary prototyping. Architecture serves as a skeletal framework into which Architecture serves as a skeletal framework into which

components can be plugged.components can be plugged. By segregating functionality into appropriate By segregating functionality into appropriate

components, experimentation is easier.components, experimentation is easier.

Page 14: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reusable Model

An architecture forms a reusable model. It:An architecture forms a reusable model. It: provides a vocabulary of designprovides a vocabulary of design enables template-based component developmentenables template-based component development enables product linesenables product lines enables systems to be built from externally enables systems to be built from externally

developed componentsdeveloped components separates functionality from packaging and separates functionality from packaging and

interconnection mechanismsinterconnection mechanisms

Page 15: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architectural Structures - 1In a house, there are plans for rooms, electrical In a house, there are plans for rooms, electrical

wiring, plumbing, ventilation, . . .wiring, plumbing, ventilation, . . .Each of these constitutes a “view” of the house. Each of these constitutes a “view” of the house.

These views areThese views are used by different peopleused by different people used to achieve different qualities in the houseused to achieve different qualities in the house used as a description and prescriptionused as a description and prescription

So it is with software architecture.So it is with software architecture.

Page 16: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architectural Structures - 2.

Functional

Concurrency Physical

Scenarios

CodeDevelop-

ment

Similar to Kruchten’s 4+1 View Model

Page 17: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Functional ViewComponents: Components:

functions, key system abstractions, domain elementsfunctions, key system abstractions, domain elements

Connectors: Connectors: dependencies, data flowdependencies, data flow

Users: Users: domain engineers, product-line designers, end usersdomain engineers, product-line designers, end users

Reasoning: Reasoning: functionality, modifiability, product lines/reusability, functionality, modifiability, product lines/reusability,

tool support, work allocationtool support, work allocation

Page 18: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Functional View Example

Presentation

Dialogue

Application

Virtual ApplicationVirtual Toolkit

Page 19: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Code ViewComponents: Components:

classes, objects, procedures, functionsclasses, objects, procedures, functions subsystems, layers, modulessubsystems, layers, modules

Connectors:Connectors: calls, invokescalls, invokes is-a-sub-module-ofis-a-sub-module-of

Users: Users: programmers, designers, reusersprogrammers, designers, reusers

Reasoning: Reasoning: modifiability/maintainability, portability, subsetabilitymodifiability/maintainability, portability, subsetability

Page 20: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Code View Example

WindowKit

CreateScrollBar()CreateWindow()

return new MotifWindow

return new OpenLookWindow

OpenLookWindowKit

CreateScrollBar()CreateWindow()

MotifWindowKit

CreateScrollBar()CreateWindow()

Page 21: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Development ViewComponents:Components:

files, directoriesfiles, directories

Connectors:Connectors: containscontains

Users: Users: managers, programmers, configuration managersmanagers, programmers, configuration managers

Reasoning:Reasoning: modifiability/maintainabilitymodifiability/maintainability testingtesting configuration management/version controlconfiguration management/version control

Page 22: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Development View ExampleALE3D advect material AdvectHist.c Alum_Matmodel.c AdvectVars.c Alum_Matmodel.h ... CT_ReactiveFlow.c chem ... ArheniusReaction.c object ArheniusReaction.h AngleWall.c ArheniusReactionType.h AngleWall.h ... Boundary.c generator ... BuildObjects.c parallel BuildObjects.h Comm.h BuildSlide.c CommDeplete.c ... CommElements.c implicitHydro ... CreateMatrix.cc slide FormMatrix.cc InitSlide.c ImpSlide.c InitSlide.h ... Prepass.c io ... BCInput.c thermal Chem_Input.c HeatGeneration.c Chem_Input.h HeatGeneration.h

Page 23: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Concurrency ViewComponents:Components:

processes, threadsprocesses, threads

Connectors:Connectors: synchronization, data flow, eventssynchronization, data flow, events

Users: Users: performance engineers, integrators, testersperformance engineers, integrators, testers

Reasoning: Reasoning: performance, availabilityperformance, availability

Page 24: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Concurrency View Example

Operational unit

SAS SASPASStandbydata mgt.

Standbydata mgt.

Operational unit

PAS SASSASStandbydata mgt.

Client

Server

service request

service request

response

Page 25: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Physical ViewComponents:Components:

CPUs, sensors, storageCPUs, sensors, storage

Connectors:Connectors: networks, communication devicesnetworks, communication devices

Users: Users: hardware engineers, system engineershardware engineers, system engineers

Reasoning:Reasoning: system delivery and installation, performance, system delivery and installation, performance,

availability, scalability, securityavailability, scalability, security

Page 26: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Physical View Example

HCS A

HCS B

EDARC ESIP

Dual ESIs

interface

DualLIU-Hs

DualLIU-Hs

CommonConsoles

(up to

Test andTraining

Sub-

Dual

M&CConsoles

3 LIU-Cs

CentralProcessor

3 LIU-Cs

3 LIU-Cs

Central Processor

3 LIU-Cs

LCN Backbone Ring and Bridges to Access Rings

Multiple CommonConsole

BCN

LCNDual

M&CConsoles

BCN

(one per ESI)

Systems externalto ISSS

Hostsystems

Host

210)

Access Rings

system

Page 27: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

ScenariosWhat are scenarios?What are scenarios?

use cases: sequences of responsibilitiesuse cases: sequences of responsibilities change cases: changes to the systemchange cases: changes to the system

Why use scenarios?Why use scenarios? to understand and validate the designto understand and validate the design to communicate the designto communicate the design to tie the views togetherto tie the views together to animate the designto animate the design to understand the limits of the designto understand the limits of the design

Page 28: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

What Are Views Used For?

Each view provides an engineering handle on Each view provides an engineering handle on certain quality attributes.certain quality attributes.

Views are an engineering tool to help achieve Views are an engineering tool to help achieve desired system qualities.desired system qualities.

In some systems, distinct views collapse into one. In some systems, distinct views collapse into one. (E.g., the concurrency and physical views may (E.g., the concurrency and physical views may be the same for small systems.)be the same for small systems.)

Page 29: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

What Are Views Used For?Documentation vehicle forDocumentation vehicle for

current development and future developmentcurrent development and future development managers and customersmanagers and customers

Thus, views must be Thus, views must be annotatedannotated to support to support analysis.analysis.

Scenarios aid in annotating views with Scenarios aid in annotating views with design design rationalerationale..

Page 30: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Hierarchical ViewsEvery view is potentially hierarchical, e.g.:Every view is potentially hierarchical, e.g.:

functionalfunctional: functions contain sub-functions: functions contain sub-functions developmentdevelopment: directories contain files : directories contain files codecode: modules contain sub-modules; systems contain : modules contain sub-modules; systems contain

sub-systemssub-systems concurrencyconcurrency: processes contain threads: processes contain threads physicalphysical: clusters contain computers contain : clusters contain computers contain

processorsprocessors

Because views are complex and hierarchical, they Because views are complex and hierarchical, they need to be navigable.need to be navigable.

Page 31: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

View Navigability - 1A skilled software engineer with some domain A skilled software engineer with some domain

knowledge should be able to read the knowledge should be able to read the documentation and navigate through it. documentation and navigate through it.

There should be an obvious starting point, portraying There should be an obvious starting point, portraying the system as a collection of interconnected the system as a collection of interconnected subsystems. subsystems.

Subsystems should be named, with their Subsystems should be named, with their responsibilities, functionality, and interconnections responsibilities, functionality, and interconnections identified. identified.

Page 32: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

View Navigability - 2.Pointers should direct the reader to more detailed Pointers should direct the reader to more detailed

documentation of sub-structures. documentation of sub-structures.

Tool support can and should aid in navigation.Tool support can and should aid in navigation.

At every stage, the nature of the connections At every stage, the nature of the connections among the parts should be clearly identified.among the parts should be clearly identified.

Page 33: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architectural Representation SummaryArchitectural views are related to each other in Architectural views are related to each other in

complicated ways.complicated ways.LessonLesson: Choose the views that are useful to the : Choose the views that are useful to the

system being built and to the achievement of system being built and to the achievement of qualities that are important to you.qualities that are important to you.

The architectural views should be hierarchical The architectural views should be hierarchical (where needed) and navigable.(where needed) and navigable.

The views should contain enough annotated The views should contain enough annotated information to support desired analyses.information to support desired analyses.

Page 34: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Part IISoftware Architecture

Patterns and AntiPatterns

Hausi A. MüllerHausi A. Müller

Page 35: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Architecture PatternsArchitecture Patterns

MotivationMotivation Software patternsSoftware patterns Pattern formatsPattern formats Shaw’s architecture patternsShaw’s architecture patterns Qualities of a patternQualities of a pattern

• Architecture AntiPatternsArchitecture AntiPatterns

Page 36: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Motivation Vehicle for reasoning about design or Vehicle for reasoning about design or

architecture at a higher level of abstractionarchitecture at a higher level of abstraction gain design confidencegain design confidence

Mining design patterns in legacy systemsMining design patterns in legacy systems identify product linesidentify product lines

Software architectureSoftware architecture dissemination of good design, design reusedissemination of good design, design reuse

Engineering HandbooksEngineering Handbooks contain a wealth of experiencecontain a wealth of experience

Page 37: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Software Patterns Programming patterns or idioms [Coplien95]Programming patterns or idioms [Coplien95]

Programming language specificProgramming language specific Design patterns [GoF95]Design patterns [GoF95]

Class and object levelClass and object level Creational, structural, behavioralCreational, structural, behavioral

Architectural patterns [Shaw95]Architectural patterns [Shaw95] Subsystem levelSubsystem level

Pattern languages [Coplien95, Vlissides96]Pattern languages [Coplien95, Vlissides96] All levelsAll levels

Reflective patterns [Buschmann95]Reflective patterns [Buschmann95] MetaprogrammingMetaprogramming

Page 38: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Software Patterns ... Analysis patterns [Fowler97]Analysis patterns [Fowler97] AntiPatterns [Brown98]AntiPatterns [Brown98] FrameworksFrameworks STL (C++ Template Library)STL (C++ Template Library) Algorithms and data structuresAlgorithms and data structures Conceptual patternsConceptual patterns Generative patternsGenerative patterns Organizational patternsOrganizational patterns

Page 39: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Pattern Definitions A pattern is a named nugget of insight that conveys A pattern is a named nugget of insight that conveys

the essence of a proven solution to a recurring the essence of a proven solution to a recurring problem within a certain context amidst competing problem within a certain context amidst competing concernsconcerns

A pattern is the abstraction from a concrete form A pattern is the abstraction from a concrete form which keeps recurring in specific non-arbitrary which keeps recurring in specific non-arbitrary contexts.contexts.

Page 40: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Pattern Definitions ... Description of communicating objects and classes Description of communicating objects and classes

that are customized to solve a general design in a that are customized to solve a general design in a particular context [GoF95].particular context [GoF95].

Design patterns capture the static and dynamic Design patterns capture the static and dynamic structures of solutions that occur repeatedly when structures of solutions that occur repeatedly when producing applications in a particular context producing applications in a particular context [Coplien95].[Coplien95].

Page 41: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Historical Perspective19791979

Alexander’s Timeless Way of BuildingAlexander’s Timeless Way of Building

19871987 OOPSLA workshop by Beck & WardOOPSLA workshop by Beck & Ward

19941994 First PLoP (Pattern Languages on Programming) First PLoP (Pattern Languages on Programming)

conferenceconference

19951995 GoF (Gamma, Helm, Johnson, Vlissides)GoF (Gamma, Helm, Johnson, Vlissides) Design Patterns; Elements of Reusable Object-Oriented Design Patterns; Elements of Reusable Object-Oriented

SoftwareSoftware

Page 42: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

A Good PatternIt solves a problemIt solves a problem

Patterns capture solutions, not just abstract principles Patterns capture solutions, not just abstract principles or strategiesor strategies

It is a proven conceptIt is a proven concept Patterns capture solutions with a track record, not Patterns capture solutions with a track record, not

theories or speculationtheories or speculation

The solution isn’t obviousThe solution isn’t obvious The best patterns generate a solution indirectly; The best patterns generate a solution indirectly;

normal for many design problemsnormal for many design problems

Page 43: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

A Good Pattern ...It describes a relationshipIt describes a relationship

Patterns describe more than black boxes: system Patterns describe more than black boxes: system structures and mechanismsstructures and mechanisms

The pattern has a significant human componentThe pattern has a significant human component The best patterns explicitly appeal to aesthetics The best patterns explicitly appeal to aesthetics

and utilityand utility

Page 44: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Pattern Formats Alexandrian form (canonical form)Alexandrian form (canonical form) GoF format [GoF95]GoF format [GoF95] Shaw’s format [Shaw94]Shaw’s format [Shaw94] Essential components of a pattern formatEssential components of a pattern format

Name, problem, context, forcesName, problem, context, forces Solution, examples, context,Solution, examples, context, Rationale, related patterns, known usesRationale, related patterns, known uses

Page 45: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...NameName

meaningful phrasemeaningful phrase

ProblemProblem a statement of the problem which describes its a statement of the problem which describes its

intent: the goals and objectives it wants to reach intent: the goals and objectives it wants to reach within the given context and forceswithin the given context and forces

Page 46: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...ContextContext

preconditions under which the problem and its preconditions under which the problem and its solutions seem to occursolutions seem to occur

the pattern’s applicabilitythe pattern’s applicability may change over timemay change over time

ForcesForces relevant forces and constraints and their interactions relevant forces and constraints and their interactions

and conflictsand conflicts motivational scenario for the patternmotivational scenario for the pattern

Page 47: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...SolutionSolution

Static and dynamic relationships describing how Static and dynamic relationships describing how to realize the patternto realize the pattern

instructions on how to construct the work instructions on how to construct the work productsproducts

pictures, diagrams, prose which highlight the pictures, diagrams, prose which highlight the pattern’s structure, participants, and pattern’s structure, participants, and collaborationscollaborations

Page 48: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...ExamplesExamples

one or more sample applications to illustrate one or more sample applications to illustrate a specific contexta specific context how the pattern is appliedhow the pattern is applied

Resulting contextResulting context the state or configuration after the pattern has been the state or configuration after the pattern has been

appliedapplied consequences (good and bad) of applying the consequences (good and bad) of applying the

patternpattern

Page 49: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...RationaleRationale

justification of the steps or rules in the patternjustification of the steps or rules in the pattern how and why it resolves the forces to achieve the how and why it resolves the forces to achieve the

desired goals, principles, and philosophiesdesired goals, principles, and philosophies how are the forces orchestrated to achieve how are the forces orchestrated to achieve

harmonyharmony how does the pattern actually workhow does the pattern actually work

Page 50: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Canonical Pattern Format ...Related patternsRelated patterns

the static and dynamic relationships between this the static and dynamic relationships between this pattern and other patternspattern and other patterns

Known usesKnown uses to demonstrate that this is a proven solution to a to demonstrate that this is a proven solution to a

recurring problemrecurring problem

Page 51: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Shaw’s Architecture Pattern FormatProblemProblem

What in the application requirements leads the designers to What in the application requirements leads the designers to select this pattern?select this pattern?

ContextContext What aspects of the setting constrain the designer in the use What aspects of the setting constrain the designer in the use

of this pattern?of this pattern?

SolutionSolution The system model captured by the pattern, together with the The system model captured by the pattern, together with the

components, connectors, and control structure that make up components, connectors, and control structure that make up the pattern.the pattern.

Page 52: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Shaw’s Format ...DiagramDiagram

A figure showing a typical pattern, annotated to show A figure showing a typical pattern, annotated to show the components and connectorsthe components and connectors

Significant variantsSignificant variants For some patterns, major variants of the basic pattern For some patterns, major variants of the basic pattern

are noted.are noted.

ExamplesExamples References to examples or more extensive overviews References to examples or more extensive overviews

of systems that apply this pattern.of systems that apply this pattern.

Page 53: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Shaw’s Architecture PatternsPipelinePipeline

Defined series of independent computationsDefined series of independent computations Mapping data streams into data streamsMapping data streams into data streams

Data abstractionData abstraction Protection of related bodies of informationProtection of related bodies of information Localized state maintenance (info hiding)Localized state maintenance (info hiding)

Communicating processesCommunicating processes Collection of distinct, independent processesCollection of distinct, independent processes Message passingMessage passing Simple messages, broadcastSimple messages, broadcast

Page 54: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Shaw’s Architecture Patterns ...Implicit invocationImplicit invocation

Loosely coupled collection of componentsLoosely coupled collection of components Independent reactive processesIndependent reactive processes Without knowing the recipients (registered procs)Without knowing the recipients (registered procs)

RepositoryRepository Maintaining a complex body of informationMaintaining a complex body of information Centralized data, richly structuredCentralized data, richly structured BlackboardBlackboard

InterpreterInterpreter Extensibility, end-user programming, portabilityExtensibility, end-user programming, portability Virtual machine (e.g., Java)Virtual machine (e.g., Java)

Page 55: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Shaw’s Architecture Patterns ...Main program and subroutinesMain program and subroutines

Hierarchy of procedure definitionsHierarchy of procedure definitions Forward call treeForward call tree ModularityModularity

Layered architectureLayered architecture Distinct layers of servicesDistinct layers of services Hierarchy of transparent or opaque layersHierarchy of transparent or opaque layers

Page 56: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Qualities of a PatternEncapsulation and abstractionEncapsulation and abstraction

encapsulates a well-defined and its solution in a encapsulates a well-defined and its solution in a particular domainparticular domain

provides crisp, clear boundaries to crystallize the provides crisp, clear boundaries to crystallize the problem and solution spacesproblem and solution spaces

serves as an abstraction which embodies domain serves as an abstraction which embodies domain knowledge and experienceknowledge and experience

may occur at different levels of abstractionmay occur at different levels of abstraction

Page 57: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Qualities of a Pattern ...Openness and variabilityOpenness and variability

is open for extension and parameterization by is open for extension and parameterization by other patternsother patterns

is able to solve larger problems in concert with is able to solve larger problems in concert with other patternsother patterns

can be realized by a variety of implementations can be realized by a variety of implementations (variants)(variants)

Page 58: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Qualities of a Pattern ...Generativity and composabilityGenerativity and composability

applying a pattern once provides a context for applying a pattern once provides a context for further applicationsfurther applications

patterns are easier to apply in another context patterns are easier to apply in another context than C++ codethan C++ code

can evolve into Golden Hammer AntiPatterncan evolve into Golden Hammer AntiPattern

Page 59: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Qualities of a Pattern ...EquilibriumEquilibrium

realizes a balance among its forces and realizes a balance among its forces and constraintsconstraints

realizes an invariant, heuristics, or a policy which realizes an invariant, heuristics, or a policy which minimize conflict within the solution spaceminimize conflict within the solution space

an invariant characterizes the problem solving an invariant characterizes the problem solving philosophyphilosophy

Page 60: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• PatternsPatterns

• AntiPatternsAntiPatterns MotivationMotivation Pattern and AntiPattern relationPattern and AntiPattern relation AntiPattern and program comprehensionAntiPattern and program comprehension AntiPattern formatAntiPattern format Selected software Architecture AntiPatternsSelected software Architecture AntiPatterns SummarySummary

Page 61: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reference Brown, Malveau, McCormick III, MowbrayBrown, Malveau, McCormick III, Mowbray

AntiPatterns: Refactoring Software, Architectures, AntiPatterns: Refactoring Software, Architectures, and Projects in Crisisand Projects in CrisisJohn Wiley & Sons, 1998John Wiley & Sons, 1998

Page 62: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Origins of AntiPatterns The majority of published works in software The majority of published works in software

sciences have focused on positive and constructive sciences have focused on positive and constructive solutionssolutions

AntiPatterns are derived by looking at the negative AntiPatterns are derived by looking at the negative solutionssolutions

DefDef. An AntiPattern describes a commonly . An AntiPattern describes a commonly occurring solution to a problem that generates occurring solution to a problem that generates decidedly negative consequences.decidedly negative consequences.

Page 63: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Origins of AntiPatternsA manager or developerA manager or developer

does not know any betterdoes not know any better does not have sufficient knowledge or experience does not have sufficient knowledge or experience

solving a particular problemsolving a particular problem applied a perfectly good design pattern in the applied a perfectly good design pattern in the

wrong contextwrong context

Page 64: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Essence of an AntiPattern Two solutions instead of a problem and a solutionTwo solutions instead of a problem and a solution

Problematic solution which generates negative Problematic solution which generates negative consequencesconsequences

Refactored solution, a method to resolve and reengineer Refactored solution, a method to resolve and reengineer the AntiPatternthe AntiPattern

A pattern in an inappropriate contextA pattern in an inappropriate context

Page 65: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Pattern & AntiPattern Relation Design patterns often evolve into an AntiPatternDesign patterns often evolve into an AntiPattern Procedural programming was a great design pattern Procedural programming was a great design pattern

in the 60’s and 70’sin the 60’s and 70’s Today it is an AntiPatternToday it is an AntiPattern Object-oriented programming is today a practiced Object-oriented programming is today a practiced

pattern ...pattern ...

Page 66: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Pattern & AntiPattern Relation

BenefitsBenefits

RelatedRelatedSolutionsSolutionsConsequencesConsequences

Context & ForcesContext & Forces

ProblemProblem

SolutionSolution

RefactoredRefactoredSolutionSolution

SymptomsSymptomsConsequencesConsequences

AntiPatternAntiPatternSolutionSolution

Context & CausesContext & Causes

BenefitsBenefitsRelatedRelatedSolutionsSolutions

ConsequencesConsequences

[AP99][AP99]

Page 67: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPatterns & Comprehension AntiPatterns are particularly prevalent during long-AntiPatterns are particularly prevalent during long-

term software maintenance and evolutionterm software maintenance and evolution A software reengineer needs to assess the presence A software reengineer needs to assess the presence

or absence of AntiPatterns in a legacy system to be or absence of AntiPatterns in a legacy system to be able to implement the best reengineering strategyable to implement the best reengineering strategy

Page 68: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPatterns and Reengineering ...PremisePremise

Recognition of AntiPatterns will make you a better Recognition of AntiPatterns will make you a better software engineersoftware engineer

Refactoring AntiPatterns present in a legacy Refactoring AntiPatterns present in a legacy system’s project will result in a better, more system’s project will result in a better, more successful, less risky software reengineering successful, less risky software reengineering projectproject

Page 69: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

State of Affairs Five out of six software projects are considered Five out of six software projects are considered

unsuccessfulunsuccessful One third of all software projects are canceledOne third of all software projects are canceled For delivered systems the actual budget and time is For delivered systems the actual budget and time is

double than expecteddouble than expected Silver bullets ...Silver bullets ...

Page 70: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Old Silver Bullets Structured programmingStructured programming Top-down designTop-down design Open systemsOpen systems Client/server architecturesClient/server architectures Quality code generation from models Quality code generation from models Object orientationObject orientation GUI buildersGUI builders FrameworksFrameworks

Page 71: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

New Silver Bullets Component technologiesComponent technologies Distributed objectsDistributed objects Business objectsBusiness objects PatternsPatterns Software reuseSoftware reuse Scripting languagesScripting languages Software agentsSoftware agents Network-centric computingNetwork-centric computing Web interfaceWeb interface

Page 72: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPattern Structure Description of the general formDescription of the general form Symptoms on how to recognize the general formSymptoms on how to recognize the general form Causes that led to the general formCauses that led to the general form Consequences of the general formConsequences of the general form Refactored solution on how to change the Refactored solution on how to change the

AntiPattern into a healthier situationAntiPattern into a healthier situation

Page 73: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPatterns A method for efficiently mapping a general, A method for efficiently mapping a general,

problematic situation to a specific class of solutionsproblematic situation to a specific class of solutions Provide real-world experience in recognizing Provide real-world experience in recognizing

recurring problems in the software industry and recurring problems in the software industry and provide a detailed remedy for the most common provide a detailed remedy for the most common predicamentspredicaments

Provide a common vocabularyProvide a common vocabularyfor identifying problems andfor identifying problems anddiscussing solutionsdiscussing solutions

Page 74: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPattern Categories Development AntiPatternsDevelopment AntiPatterns

Situations encountered by programmersSituations encountered by programmers

Architectural AntiPatternsArchitectural AntiPatterns Common problems in system structureCommon problems in system structure

Managerial AntiPatternsManagerial AntiPatterns Affect people in all software rolesAffect people in all software roles

AntiPatterns apply to software construction as well AntiPatterns apply to software construction as well as software evolutionas software evolution

Page 75: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

AntiPattern FormatRoot causesRoot causes

provide fundamental context for the AntiPatternprovide fundamental context for the AntiPattern

Primal forcesPrimal forces are the key motivators for decision makingare the key motivators for decision making

Software design-level modelSoftware design-level model define architectural scales; each pattern has a most define architectural scales; each pattern has a most

applicable scaleapplicable scale

Page 76: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Root CausesHasteHaste

hasty decisions compromise qualityhasty decisions compromise quality code that appears to work is acceptablecode that appears to work is acceptable testing is ignoredtesting is ignored

ApathyApathy lack of partitioninglack of partitioning ignoring the separation of concerns (e.g., stable vs. ignoring the separation of concerns (e.g., stable vs.

replaceable design)replaceable design)

Page 77: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Root Causes ...Narrow-mindednessNarrow-mindedness

refusal of known or accepted solutionsrefusal of known or accepted solutions reluctance to use metadatareluctance to use metadata

SlothSloth poor decision based on an easy answerpoor decision based on an easy answer frequent interface changesfrequent interface changes lack of configuration controllack of configuration control reliance on generating stubs and skeletonsreliance on generating stubs and skeletons

Page 78: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Root Causes ...AvariceAvarice

architectural avarice—modeling of excessive architectural avarice—modeling of excessive detailsdetails

excessive complexity due to insufficient abstractionexcessive complexity due to insufficient abstraction overly complex systems are difficult to develop, overly complex systems are difficult to develop,

integrate, test, maintain, extendintegrate, test, maintain, extend

Page 79: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Root Causes ...IgnoranceIgnorance

failing to seek understandingfailing to seek understanding antonym of analysis paralysisantonym of analysis paralysis focussing on code interfaces rather than system focussing on code interfaces rather than system

interfacesinterfaces no layeringno layering no wrapping to isolate detailsno wrapping to isolate details

Page 80: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Root Causes ...PridePride

not-invented-here syndromenot-invented-here syndrome unnecessary invention of new designsunnecessary invention of new designs reinventing the wheelreinventing the wheel rewrite from scratchrewrite from scratch ignoring requirementsignoring requirements ignoring COTS, freeware, existing legacy systemignoring COTS, freeware, existing legacy system

Page 81: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Forces Forces or concerns that exist within a decision-Forces or concerns that exist within a decision-

making processmaking process Forces that are addressed lead to benefitsForces that are addressed lead to benefits Forces that remain unresolved lead to Forces that remain unresolved lead to

consequencesconsequences For any given software problem there are a number For any given software problem there are a number

of forces that can influence a given solutionof forces that can influence a given solution

Page 82: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Forces ...Vertical forcesVertical forces

Domain specificDomain specific Unique to a particular situationUnique to a particular situation Ignored in AntiPatternsIgnored in AntiPatterns

Horizontal forcesHorizontal forces Applicable across multiple domainsApplicable across multiple domains Influence design and reengineering choice across Influence design and reengineering choice across

several software modules and componentsseveral software modules and components Choices made elsewhere may impact local choicesChoices made elsewhere may impact local choices

Page 83: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Primal Forces ... Horizontal forces are called primal forcesHorizontal forces are called primal forces Present in nearly all design or reengineering Present in nearly all design or reengineering

situationssituations Keep architecture and development on track or Keep architecture and development on track or

synchronizedsynchronized A fundamental value system for software architectsA fundamental value system for software architects

Page 84: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Primal Forces ...Management of functionalityManagement of functionality

Meeting the requirementsMeeting the requirements

Management of performanceManagement of performance Meeting required speed and operationMeeting required speed and operation

Management of complexityManagement of complexity Defining abstractionsDefining abstractions

Management of changeManagement of change Controlling the evolution of the softwareControlling the evolution of the software

Page 85: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Primal Forces ...Management of IT resourcesManagement of IT resources

People and IT artifactsPeople and IT artifacts

Management of technologyManagement of technology Controlling technology evolutionControlling technology evolution

Page 86: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architecture AntiPatterns The BlobThe Blob Cut-and-Paste ProgrammingCut-and-Paste Programming Stovepipe EnterpriseStovepipe Enterprise Design By CommitteeDesign By Committee Swiss Army KnifeSwiss Army Knife Reinvent the WheelReinvent the Wheel

Page 87: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The BlobProblemProblem

Procedural style design leads to one object with a Procedural style design leads to one object with a lion’s share of the responsibilitieslion’s share of the responsibilities

Most other objects only hold dataMost other objects only hold data This is the class that is really the heart of our This is the class that is really the heart of our

architecturearchitecture One class monopolizes the processing and the One class monopolizes the processing and the

others encapsulate dataothers encapsulate data

Page 88: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Blob ...CausesCauses

Lack of an object-oriented architectureLack of an object-oriented architecture Lack of architecture enforcementLack of architecture enforcement Procedural design expert are chief architectsProcedural design expert are chief architects Wrapping a legacy system resultsWrapping a legacy system results

in a Blob … acceptablein a Blob … acceptable

Page 89: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Blob ...SolutionSolution

Distribute responsibilities more uniformlyDistribute responsibilities more uniformly Isolate the effect of changesIsolate the effect of changes Identify or categorize attributes and operationsIdentify or categorize attributes and operations Find “natural homes” for the identified classesFind “natural homes” for the identified classes Remove outliersRemove outliers

Page 90: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Cut-and-Paste ProgrammingProblemProblem

Software clonesSoftware clones ““Hey, I thought you fixed that bug already, so why Hey, I thought you fixed that bug already, so why

is it doing this again?”is it doing this again?” ““Wow, you guys work fast. Over 400KLOC in Wow, you guys work fast. Over 400KLOC in

three weeks is amazing!”three weeks is amazing!” Degenerate form of reuseDegenerate form of reuse Very common in COBOLVery common in COBOL

Page 91: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Cut-and-Paste Programming ...SolutionSolution

Clone detectionClone detection Parameterize typesParameterize types Introduce an additional level of indirectionIntroduce an additional level of indirection Exploit polymorphismExploit polymorphism Dynamic schemasDynamic schemas

Page 92: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Stovepipe EnterpriseProblemProblem

Stovepipe System is characterized by a software Stovepipe System is characterized by a software structure that inhibits changestructure that inhibits change

Must be constantly repairedMust be constantly repaired Brittle, monolithic system architectures (usually Brittle, monolithic system architectures (usually

undocumented)undocumented) Inability of systems to interoperateInability of systems to interoperate

Page 93: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Stovepipe Enterprise ...SolutionSolution

Coordination of technologies at several levelsCoordination of technologies at several levels Identify common standards and migration direction Identify common standards and migration direction

with a standard reference modelwith a standard reference model Usage conventions across systemsUsage conventions across systems Detailed interoperability conventions across Detailed interoperability conventions across

systemssystems Product lines (SEI)Product lines (SEI)

Page 94: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by CommitteeProblemProblem

Gold Plating, Standards Disease, Make Everybody Gold Plating, Standards Disease, Make Everybody Happy, Political PartyHappy, Political Party

Project team are egalitarian; everyone has equal Project team are egalitarian; everyone has equal say; decisions are democraticsay; decisions are democratic

The majority rule leads to diffusion of abstraction The majority rule leads to diffusion of abstraction and excess complexityand excess complexity

““A camel is a horse designed by a committee.”A camel is a horse designed by a committee.”

Page 95: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by Committee ...SymptomsSymptoms

Design documentation is voluminousDesign documentation is voluminous The requirements do not converge and are unstableThe requirements do not converge and are unstable Design meetings are slow, concentrate on details, Design meetings are slow, concentrate on details,

and avoid big picture discussionsand avoid big picture discussions Decisions are only made in meetingsDecisions are only made in meetings No prioritization of design featuresNo prioritization of design features

Page 96: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by Committee ...CausesCauses

No designated project architectNo designated project architect Ineffective meeting facilitationIneffective meeting facilitation The suggestions of all committee members are The suggestions of all committee members are

incorporated to keep everybody happyincorporated to keep everybody happy No separation of concernsNo separation of concerns

Page 97: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by Committee ...Refactored solutionRefactored solution

Reform the meeting processReform the meeting process Why are we here?Why are we here? What outcomes do we want?What outcomes do we want? Assign explicit rolesAssign explicit roles

Owner, facilitator, architect, developer, tester, domain Owner, facilitator, architect, developer, tester, domain expertexpert

““My specialty is being right when other people are being My specialty is being right when other people are being wrong.” — George Bernard Shawwrong.” — George Bernard Shaw

Page 98: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by Committee ...Employ Spitwads meeting processEmploy Spitwads meeting process

Ask question—How can we improve performance?Ask question—How can we improve performance? Write down answer silentlyWrite down answer silently Toss spitwads à la Michael JordanToss spitwads à la Michael Jordan Redistribute, read, and record spitwadsRedistribute, read, and record spitwads Reach common understandingReach common understanding Eliminate duplicatesEliminate duplicates Prioritize by votingPrioritize by voting Discuss highest priority selectionsDiscuss highest priority selections

Page 99: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Design by Committee …SQL exampleSQL example

SQL89—115 pagesSQL89—115 pages SQL92—580 pagesSQL92—580 pages SQL3—still not complete; may never be fully SQL3—still not complete; may never be fully

implemented; a dumping ground for advanced implemented; a dumping ground for advanced database featuresdatabase features

Better solutionsBetter solutions Open Database Connectivity (ODBC)Open Database Connectivity (ODBC) Java Database Connectivity (JDBC)Java Database Connectivity (JDBC)

Page 100: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reinvent the WheelProblemProblem

Our problem is uniqueOur problem is unique Developers have minimal knowledge of each other’s Developers have minimal knowledge of each other’s

codecode Building systems from the ground up even though Building systems from the ground up even though

related legacy systems existrelated legacy systems exist The existence of legacy systems is the norm rather The existence of legacy systems is the norm rather

than the exceptionthan the exception Lack of program families or product linesLack of program families or product lines

Page 101: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reinvent the Wheel ...SymptomsSymptoms

Closed system architectures—no provision of Closed system architectures—no provision of reuse, interoperability, or change managementreuse, interoperability, or change management

Replication of COTS componentsReplication of COTS components Inability to deliver desired features on time and Inability to deliver desired features on time and

within budgetwithin budget Corporate knowledge is not leveragedCorporate knowledge is not leveraged

Page 102: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reinvent the Wheel ...CausesCauses

No communication and technology transfer among No communication and technology transfer among software development projectssoftware development projects

Corporate knowledge is not leverageCorporate knowledge is not leverage No explicit architecture processNo explicit architecture process Lack of enterprise managementLack of enterprise management

Page 103: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Swiss Army Knife or Kitchen Sink

ProblemProblem Excessively complex class interfaceExcessively complex class interface Designer attempts to provide for all possible uses Designer attempts to provide for all possible uses

of the classof the class Complicated interfaceComplicated interface Many overloaded namesMany overloaded names Excessive regression test suitesExcessive regression test suites Several Swiss Army Knifes in a single designSeveral Swiss Army Knifes in a single design

Page 104: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Swiss Army Knife ...Refactored solutionRefactored solution

Provide guidelines for using complicated standards Provide guidelines for using complicated standards or interfacesor interfaces

Provide a template for exception handlingProvide a template for exception handling Contract interfacesContract interfaces

Page 105: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Summary During program comprehension and evolution one During program comprehension and evolution one

should be particularly aware of the potential should be particularly aware of the potential presence of AntiPatternspresence of AntiPatterns

Awareness of AntiPatterns is critical for Awareness of AntiPatterns is critical for reengineering projectsreengineering projects

Consider AntiPatterns next time you sign on to a Consider AntiPatterns next time you sign on to a new projectnew project

Invest in reading the AntiPatterns bookInvest in reading the AntiPatterns book

Page 106: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Part IIISoftware Architecture

Reconstruction

S. Jeromy CarrièreS. Jeromy Carrière

Page 107: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 108: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Another Definition of Architecture

A set of A set of design decisionsdesign decisions

Typically documented as a set of Typically documented as a set of viewsviews

Realized in an implementation via Realized in an implementation via mappingsmappings

Mappings are almost invariably Mappings are almost invariably informalinformal(i.e. not explicitly recorded in any (i.e. not explicitly recorded in any implementation artifact)implementation artifact)

The implementation is the The implementation is the consequenceconsequence of the of the application of the mappingsapplication of the mappings

Page 109: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Example: Layers

Question: What is a layer?Question: What is a layer?

Answers: Answers: At worst a delusion. At worst a delusion. At best a convention.At best a convention. Nothing that exists in what we actually build (e.g. Nothing that exists in what we actually build (e.g.

no “layer” construct in a programming language).no “layer” construct in a programming language). Nothing that is enforceable.Nothing that is enforceable.

Page 110: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

And Yet . . .

Architectures use these abstractions regularly.Architectures use these abstractions regularly.

Architects think and plan and analyze in terms of Architects think and plan and analyze in terms of these abstractions.these abstractions.

So,So,

we should we should supportsupport these abstractions and connect these abstractions and connect them to what we them to what we dodo build. build.

Page 111: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

So What Is Architecture Reconstruction?A process in which cultural hypotheses are generated A process in which cultural hypotheses are generated

and tested and tested anthropological anthropological

These hypotheses are ideally the inverse of the These hypotheses are ideally the inverse of the mappings developed during designmappings developed during design

The reconstructor must add information during the The reconstructor must add information during the reconstruction processreconstruction process This depends on the reconstructor’s available This depends on the reconstructor’s available

information and biasinformation and bias

Page 112: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 113: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

But Why Reconstruct?

We frequently need to reason architecturally We frequently need to reason architecturally about about existingexisting systems. systems.

We need to be able to:We need to be able to: analyze architecturesanalyze architectures (re)document architectures(re)document architectures identify architectural dependenciesidentify architectural dependencies

Page 114: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architectural Conformance - I

Question: If my architecture was designed with a Question: If my architecture was designed with a particular property in mind, does the property particular property in mind, does the property hold for my target system?hold for my target system?

(Probable) Answer: Who knows? (Probable) Answer: Who knows?

Page 115: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Architectural Conformance - II

The architecture of the implemented system must The architecture of the implemented system must conformconform to the architectural design. to the architectural design.

Otherwise, architectural drift and erosion are Otherwise, architectural drift and erosion are inevitable.inevitable.

But conformance (by hand) is a dreary task. But conformance (by hand) is a dreary task.

Page 116: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 117: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Tools for Software Architecture ReconstructionGroups working on tools/toolsets:Groups working on tools/toolsets:

University of Victoria (Hausi Müller)University of Victoria (Hausi Müller) Software Engineering InstituteSoftware Engineering Institute MITRE (Penny Chase)MITRE (Penny Chase) University of Waterloo (CSER project)University of Waterloo (CSER project) Philips (René Krikhaar)Philips (René Krikhaar)

Page 118: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Tools for Software Architecture Reconstruction

ExtractionExtraction

Repository

Manipulation

Presentation

Page 119: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Dali: A Software Architecture Reconstruction Workbench (SEI)

SQL Repository

View Fusion

Presentation

Manipulation

Analysis

Instrument

Lexical

Parsing

.

.

.

Extraction

Profiling

Page 120: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Software Bookshelf/PBS (Holt et al)

Fact Files

Manipulation

Presentation

Layout

Parsing

.

.

.

Extraction

Page 121: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 122: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Extracting Information

Most approaches are opportunistic. In common Most approaches are opportunistic. In common use are:use are: parsers (SNiFF+, cfx, CIA, rigiparse, EDG)parsers (SNiFF+, cfx, CIA, rigiparse, EDG) CBMS systems (Reasoning SDK)CBMS systems (Reasoning SDK) lexical analyzers (LSME)lexical analyzers (LSME) profilers (gprof)profilers (gprof) code instrumentationcode instrumentation ad hoc (grep, perl)ad hoc (grep, perl)

Page 123: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Extracting Information - 2

Source code analysis is insufficient:Source code analysis is insufficient: late bindinglate binding system topology informationsystem topology information

This information is available only in artifacts This information is available only in artifacts other thanother than source models. source models.

Page 124: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Repositories

Use of attributed relational models (E/R/A) is Use of attributed relational models (E/R/A) is almost universal:almost universal: simplesimple flexibleflexible sufficiently expressivesufficiently expressive well supported by existing toolswell supported by existing tools

Page 125: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Example Repository Contents (Dali)

Some relations relevant to software architecture:Some relations relevant to software architecture: function function callscalls function function file file containscontains function function class class has_subclasshas_subclass class class class class has_friendhas_friend class class process process communicates_withcommunicates_with process process process process writeswrites file file . . .. . .

Page 126: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

A Repository Schema (Bowman)

S oftw areO b jec t

S ou rce F ileT yp e

E lem en t

in h erits in h erits

D a taE lem en t

Fu n c tion a lE lem en t

in h erits in h eritstyp eR ef

S ou rceA rtifac t

in h erits

fu n c tion R ef

d efin ed In

d a taR ef

d ec la red In

lex ica lR ef

$ E N T IT Y

in h erits

D erivedA rtifac t

in h erits

S u b system

in h erits

con ta in s

con ta in s

$ R E LA T IO N

$ R E LA T IO N

Page 127: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

A Schema for Procedural Languages (Bowman)

SourceFile

usesfile

Data Type

de fines

Procedure Data

de finesde fines

usestype

usesda ta

de fines de fines

usesp rocedure

uses type

Page 128: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Dali’s Repository

Dali uses an SQL database with a philosophy of Dali uses an SQL database with a philosophy of openness and lightweight tool integration via text openness and lightweight tool integration via text formats (RSF - Rigi Standard Format). formats (RSF - Rigi Standard Format).

The database and tools are ignorant of each other.The database and tools are ignorant of each other.

The tools extract, modify, manipulate, and store The tools extract, modify, manipulate, and store architectural artifacts in the database.architectural artifacts in the database.

Integration is controlled via Rigi’s RCL and scripts.Integration is controlled via Rigi’s RCL and scripts.

Page 129: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

PBS’ Repository

PBS uses a file-based approach to storing PBS uses a file-based approach to storing “facts”:“facts”: TA (Tuple-Attribute) format - based on RSFTA (Tuple-Attribute) format - based on RSF

This approach improves “exchangeability” but This approach improves “exchangeability” but potentially involves more run-time potentially involves more run-time overhead.overhead.

Integration is accomplished via scripts.Integration is accomplished via scripts.

Page 130: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Philip’s Repository

Based on the concepts of:Based on the concepts of: InfoPacks: information extracted from a systemInfoPacks: information extracted from a system ArchiSpects: representation of an architectural ArchiSpects: representation of an architectural

structure or analysisstructure or analysis

Both include a description of the steps to Both include a description of the steps to construct the model.construct the model.

Integration is achieved via a variety of scriptsIntegration is achieved via a variety of scriptsand tools.and tools.

Page 131: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Information Interchange

It’s important to be able to exchange facts and It’s important to be able to exchange facts and models.models.

We need two things to do this properly:We need two things to do this properly: an agreed-upon syntax, including a schemaan agreed-upon syntax, including a schema an agreed-upon semantic model for describing the an agreed-upon semantic model for describing the

facts and their manipulationsfacts and their manipulations

Page 132: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 133: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Manipulation - Motivation

Architectural elements are not explicitly Architectural elements are not explicitly represented in source code.represented in source code. ““user interface”, “repository”, “cache”, etc. are user interface”, “repository”, “cache”, etc. are

usually tangled collections of objectsusually tangled collections of objects architectural constructs are realized by architectural constructs are realized by manymany

mechanisms in an implementationmechanisms in an implementation

Therefore, we need to “reconstruct” architectural Therefore, we need to “reconstruct” architectural elements.elements.

Page 134: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Manipulation in Dali: View Fusion

Motivation:Motivation: Extractors will frequently produce incomplete and Extractors will frequently produce incomplete and

partially overlapping datapartially overlapping data

A complete view of a system requires views to be A complete view of a system requires views to be fused:fused: different views provide complementary different views provide complementary

informationinformation one view can improve anotherone view can improve another

Page 135: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Manipulation in Dali: Aggregation

Primary mechanism for manipulation is the Primary mechanism for manipulation is the application of patterns for aggregation, application of patterns for aggregation, constructed using SQL.constructed using SQL.

Examples:Examples: aggregate local variables with functionsaggregate local variables with functions aggregate members with classesaggregate members with classes compose architecture-level elementscompose architecture-level elements

Page 136: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Manipulation in PBS

Manipulation of facts in PBS is performed using Manipulation of facts in PBS is performed using GrokGrok Grok is a relational calculator based on Tarski Grok is a relational calculator based on Tarski

relational algebra (with extensions)relational algebra (with extensions) ““abstraction” is the key transformation of the abstraction” is the key transformation of the

modelmodel input for abstraction comes from containment input for abstraction comes from containment

hierarchies specified by the reconstructorhierarchies specified by the reconstructor

Page 137: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Manipulation in Philips’ Toolset

Manipulation of models is performed via the Manipulation of models is performed via the Relational Partition Algebra (RPA)Relational Partition Algebra (RPA) RPA is also based on Tarski algebraRPA is also based on Tarski algebra Computation is carried out using a variety of Computation is carried out using a variety of

implementations of RPAimplementations of RPA ArchiSpects specify the creation of abstracted ArchiSpects specify the creation of abstracted

viewsviews

Page 138: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 139: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Presentation

The end goal of architecture reconstruction is The end goal of architecture reconstruction is generation of architectural views that:generation of architectural views that: improve understanding of the systemimprove understanding of the system provide (improved) documentationprovide (improved) documentation improve maintainabilityimprove maintainability facilitate analysisfacilitate analysis

Page 140: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Presentation in Dali

Presentation in Dali is done using RigiPresentation in Dali is done using Rigi

Rigi provides useful graph editing functionality:Rigi provides useful graph editing functionality: layoutlayout direct manipulationdirect manipulation hierarchical navigationhierarchical navigation extensibilityextensibility

Examples coming up...Examples coming up...

Page 141: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Presentation in Bookshelf/PBS

The “software landscape” presentation approach:The “software landscape” presentation approach: hierarchicalhierarchical PBS is Web-based (Java)PBS is Web-based (Java) incorporates architectural visualizations within a incorporates architectural visualizations within a

framework of documentationframework of documentation

Page 142: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

PBS: Example

Page 143: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• Examples Examples

Page 144: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Reconstruction Methodologies

A predictable, repeatable method is important A predictable, repeatable method is important for management of reconstruction activitiesfor management of reconstruction activities

Because the process is primarily one of Because the process is primarily one of hypothesis formulation and test, we need hypothesis formulation and test, we need structured methods for information collectionstructured methods for information collection

Methods are universally semiautomatic Methods are universally semiautomatic (shouldn’t be a surprise!)(shouldn’t be a surprise!)

Page 145: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

A Reconstruction Method Sketch (SEI)

Identifyarchitecturalcomponents

Developinformation

model

Populateinformation

model

Developarchitectural

rules

Applyarchitectural

rules

Extractinformation

Developrepresenta-

tion template

Mapmodels totemplate

Evaluate

Page 146: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Hybrid Approach (Tzerpos & Holt)

Hybrid: Combine extracted information with Hybrid: Combine extracted information with information collected from developers.information collected from developers.

Iterative steps at multiple levels of granularity:Iterative steps at multiple levels of granularity: Choose domain modelChoose domain model Extract facts from source codeExtract facts from source code Cluster into subsystemsCluster into subsystems Refine clustering using “live” informationRefine clustering using “live” information Refine layout using “live” informationRefine layout using “live” information

Page 147: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Architecture Reconstruction Method (Guo)Pattern- and style-oriented approach to Pattern- and style-oriented approach to

reconstructionreconstruction

Four primary phases:Four primary phases: Developing a concrete pattern recognition planDeveloping a concrete pattern recognition plan Extracting a source modelExtracting a source model Detecting and evaluating pattern instancesDetecting and evaluating pattern instances Reconstructing and analyzing the architectureReconstructing and analyzing the architecture

Page 148: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Outline• Introduction and PhilosophyIntroduction and Philosophy• MotivationMotivation• Software Architecture Reconstruction ToolsSoftware Architecture Reconstruction Tools

Extraction and StorageExtraction and Storage ManipulationManipulation PresentationPresentation

• Reconstruction MethodologiesReconstruction Methodologies• ExamplesExamples

Page 149: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Example: VANISH (using Dali)

Dialogue

FunctionalCore Adapter

LogicalInteraction

FunctionalCore

Presentation

As-designed Architecture

Page 150: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Extract Information

“White noise”:a typical extracted model.

Page 151: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Apply Generic Patterns

Aggregatefunctions andlocal variables;classes andmembers; classesand files.

Page 152: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Apply Application-Specific Patterns

Identify the layers

from the Arch model.

Page 153: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

The Final ProductAs designed: As implemented:

Dialogue

FunctionalCore Adapter

LogicalInteraction

FunctionalCore

Presentation

Dialogue

FunctionalCore Adapter

LogicalInteraction

FunctionalCore

Presentation

Page 154: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Analysis - 1Architectural conformance via RMTool Architectural conformance via RMTool (Murphy)(Murphy)

Page 155: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Analysis - 2

If we believe in pattern-based simplicity . . .If we believe in pattern-based simplicity . . .

. . . we should be able to measure this in an . . . we should be able to measure this in an architecture.architecture.

IAPR is an analysis tool to do this.IAPR is an analysis tool to do this.

Approach pattern matching as sub-graph Approach pattern matching as sub-graph isomorphism: a search task (NP-hard).isomorphism: a search task (NP-hard).

Page 156: Carnegie Mellon University Software Engineering Institute The Role of Architecture in Understanding Software Rick Kazman Hausi Müller Jeromy Carrière

Carnegie Mellon University

Software Engineering Institute

Coloring an Architecture (Kazman & Burth)