how to harvest reusable components in existing software worksho… · corrective maintenance...

73
How to Harvest Reusable Components in Existing Software Nikolai Mansurov Chief Scientist & Architect

Upload: others

Post on 24-Jul-2020

12 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

How to Harvest ReusableComponents in Existing Software

Nikolai MansurovChief Scientist & Architect

Page 2: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview� Introduction� Reuse, Architecture and MDA� Option Analysis for Reengineering (OAR)� Architecture Excavation and Refactoring� Harvesting as architectural refactoring

• First, you need to excavate your architecture, as a precise model• Harvesting requires the following steps:

� Identify/localize/collect� Isolate component� Introduce a boundary� Implement refactoring

• Particular challenges� Challenges of component identification (need to understand)� Challenges of component isolation� Challenges of soft boundaries� Reusable components and architecture erosion� Reusable components and cyclic dependencies

� Examples� Conclusions/Key points

Page 3: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Production of software is evolutionary� Production of software involves

multiple releases• …despite the fact that many textbooks

emphasize only the initial release,when the system is built

• Software production after the initialrelease has an additional constraint ofdealing with existing code

� Changes are made to software afterthe initial release in order to:• Develop new functionality• Fix bugs• Adapt to new operating environments• Improve quality

Specification Implemention

ValidationOperation

Start

Release 1

Release 2

Release 3

From Ian Sommerville, Software Engineering, 2000

Page 4: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Evolution of existing code has significant economicimpact

02468

10121416

1990 2000 2010

Numb

er o

f pro

gram

mers

(M)

EnhancementRepairNew

� More than one half of allprogrammers are alreadyworking with existing code(repair + enhancement)

� The cost of post-initialevolution has grown from40% to 90% of the totalproduction cost

� The number ofprogrammers working withexisting code grows fasterthan the number ofprogrammers developingnew software

• Larger amounts ofsoftware alreadydeveloped

• Large business valueaccumulates in existingcode over time

• Increasing cost of newdevelopment

• The useful lifespan isincreasing

• Bigger churn ofplatforms andtechnologies

• More defects

From Deursen,Klint,Verhoef,1999

Page 5: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Software production with existing code� Changes to existing code may

have different magnitude:• Traditional maintenance (repair)

� Perfective maintenance� Adaptive maintenance� Corrective maintenance� Preventive maintenance

• Major new features to existing software� Major modifications� Scaling

• Modernization (beyond maintenance)� Porting to a new platform� Migration to a new technology� Migration to COTS components� Modularization and refactoring

• Redevelopment

Functionalityaddition or

modification(65%)

Fault repair(17%)

Softwareadaptation

(18%)

From Ian Sommerville, Software Engineering, 2000

Page 6: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Changes to existing software involve reuse

From Seacord,Plakosh,Lewis, SEI, 2003

Page 7: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

The levels of reuse

None

Informalcode reuse

Black-boxcode reuse

Managedworkproduct

reuse

Architectedreuse

Domain-specificreuse-drivenOrganization

(SoftwareProduct

Line)

Benefits

Investment, experience, time

Adapted from Jacobson, et.al., 1997

Reduceddevelopment

time

Reducedmaintenance

costs

Broadercoverage

Interoperability,high reuse levels

Rapid customdevelopment

Improved time-to-market,costs, quality

Page 8: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Kinds of reuse

� “As is” reuse� “Black-box” reuse� “White box” reuse� Workproduct reuse

Page 9: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Reuse in multi-release production

From Schach,Tomer, 2001

Page 10: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Product Lines add another dimension to production

From Schach,Tomer, 2001

Page 11: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Internal and External reuse

Reuse within one organization (product line)

Reuse of common components ininteroperating systems

-commons computations,-domain objects-common protocol modules

Page 12: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Reuse and COTS components

COTS component

1modularization

2standardization

3 reuse/buy

middleware

proprietary components

proprietary components

Incrementally createdarchitecture/domain model

Page 13: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Harvesting, standardization, reuse

� (Porting to standard COTS middleware)� Modularization� Harvesting of reusable components� Standardization of components� Reuse/buy� Emergent architecture/domain model

Page 14: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview� Reuse, Architecture and MDA

• Reuse does not involve any translation• What can be reused as opposed to what can be translated

� reuse at low levels and at higher levels

Page 15: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

The SEI HorseShoe model

From Smith, et.al., SEI, 1999

Page 16: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Model Driven Architecture

From R.Soley, OMG, 2003

Page 17: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

What is Model Driven Architecture?

� A New Way to Specify and Build Systems• Based on modeling with UML• Supports full lifecycle: analysis, design, implementation,

deployment, maintenance, evolution & integration with latersystems

• Builds in Interoperability and Portability• Lowers initial cost and maximizes ROI

• Applies directly to the mix you face:� Programming language • Network� Operating system • Middleware

From R.Soley, OMG, 2003

Page 18: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Building an MDA Application

Start with a Platform-Independent Model(PIM) representingbusiness functionalityand behavior,undistorted bytechnology details.

Platform-Independent

Model

A Detailed Model,stating Pre- and Post-

Conditions in OCL,and Semantics inAction Language

From R.Soley, OMG, 2003

Page 19: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Generating Platform-Specific Model

Platform-Independent

Model

Map a PIM to SpecificMiddleware

Technologies via OMGStandard Mappings

MDA tool applies astandard mapping togenerate Platform-Specific Model (PSM)from the PIM. Code ispartially automatic,partially hand-written.CORBA

Model

From R.Soley, OMG, 2003

Page 20: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Mapping to Multiple Deployment Technologies

Platform-Independent

Model

CORBAModel

MDA tool applies anstandard mapping togenerate Platform-Specific Model (PSM)from the PIM. Code ispartially automatic,partially hand-written.Java/EJB

ModelXML/SOAP

ModelOtherModel

Map a PIM to ManyMiddleware

Technologies via OMGStandard Mappings

From R.Soley, OMG, 2003

Page 21: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Generating Implementations

Platform-Independent

Model

CORBAModel

MDA Tool generatesall or most of theimplementation codefor deploymenttechnology selectedby the developer.

Java/EJBModel

CORBA

XML/SOAPModel

Java/EJB XML/SOAP Other

OtherModel

Map PSM to applicationinterfaces, code, GUI

descriptors, SQLqueries, etc.

From R.Soley, OMG, 2003

Page 22: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Integrating Legacy & COTS

Platform-Independent

Model

LegacyApp

MDA Tools for reverseengineering automatediscovery of modelsfor re-integration onnew platforms.

COTSApp

Other

OtherModel

Reverse-engineerexisting application

into a model andredeploy.

From R.Soley, OMG, 2003

Page 23: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

A typical architecture for Business Reuse

Application systems

Business-specific components

Middleware components

System software components

Adapted from Jacobson, et.al., 1997

Page 24: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Reuse at different layers

platform

application

System services,infrastructure

Implementation ofdomain objects

Platform-specific implementation

presentation

application logic

business object

database

Page 25: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Complete life-cycle: initial release and post-buildevolution

Release 2

evolutionnew development

RS

D

C

value

Release 3

new developmentchallenges

evolution challenges

Release 1

Page 26: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Maintenance in a complete life-cycle

Release 1 Release 2

maintenancenew development

RS

D

C

Ability to change

Page 27: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Modernization in a complete life-cycle

Release 1 Release 2

Modernization

maintenancenew development

RS

D

C

… this includes redevelopment

Page 28: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Managed Architecture in complete life cycle

Release 1 Release 2

Architecture managementmaintenancenew development

RS

D

C

A

excavation

Page 29: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Modernization: Big-bang transformation vs Refactoring

Release 1 Release 2

transformation

maintenance

new development

RS

D

C

refactoring

Page 30: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

MDA addresses the challenges of a complete life-cycle

Release 1 Release 2modernization

maintenance=continued developmentnew development

M

C

…by addressing program comprehension challenge…

…and modernization challenges…

Page 31: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Managed Architecture can kick-start MDA

Release 1 Release 2

refactoring

maintenancenew development

RS

D

C

A

excavation

MDA !!!

M

C

C

Page 32: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Mega life-cycle: Software Product Lines

Release 2

SPL evolutionnew development

RS

D

C

single product value

Release 3

SPL evolution challenges

Release 1

SPL value

Page 33: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Software Product Lines are architecture-centric

new development

RS

D

C

Release 1

core assets

applications

SPL launched

architecture

SPL evolution

Page 34: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

SPL require tight architecture management

Page 35: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Architecture Capability Maturity� Single aspect of SEI-CMM – refers to the capability of an organization to

manage architecture in the complete life-cycle� Level 1: Initial architecture� Level 2: Repeatable architecture

• Some packaging rules, some use of libraries, some code reuse� Level 3: Defined architecture

• Components and their interfaces are formally defined and maintainedtogether with the rest of the code,

• modelling tools like Rational Rose are used• middleware or component environment is used,

� Level 4: Managed architecture• Visualization of existing software is available, feedback between the “as

designed” architecture and the “as built” architecture is available, metrics ofexisting architecture are used, architecture integrity is enforced

� Level 5: Optimizing architecture• On-going architecture improvement is part of the overall development

process

Page 36: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview� Decision-making process related to reuse

� Option Analysis for Reuse• Overview of OAR• OAR tasks• Example artifacts

� OAR is a systematic, architecture-centric, decision-making method formining existing components. OAR is used for modernization orredevelopment of existing system.

� OAR is developed in SEI, by Dennis Smith, Liam O’Brien, et.al.

Page 37: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview of OAR

From Smith, et.al., SEI, 1999

Page 38: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

OAR: Establish Mining context

� What:• Interview stakeholders• Study existing product line or new system requirements• Study existing software assets• Understand expectations for mining legacy components

� This establishes• A baseline set of goals• Expectations• Component needs

� This uncovers the program and technical drivers formaking decisions

Adapted from Smith, et.al., SEI, 1999

Page 39: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

OAR: Inventory Components

� What:• Identify product line needs• Evaluate legacy components according to screening criteria• This results in an inventory of candidate components

� Tasks:• Identify characteristics of component needs• Identify components satisfying criteria

� Create component table of the legacy components with details of thesecharacteristics

� Screen components that do not satisfy the required characteristics• Match components to product line needs• Update the Inventory with more details on candidate components• Elicit mining issues and concerns• Review OAR schedule

Adapted from Smith, et.al., SEI, 1999

Page 40: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

OAR: Analyze Candidate Components

� What:• Analyze the set of legacy components for the types of changes that

are required to mine� Tasks:

• Select desirable components� Determine desirability criteria� Screen out components that do not satisfy desirability criteria

• Identify “As Is” and “Black-Box” (wrapped) components• Identify “White-box” components (need to be modified)• Determine required changes

� Types of changes each component needs, cost and effort involved, thelevel of difficulty and risk, and the comparative cost and effort ofdeveloping components from scratch

• Elicit mining options• Review OAR schedule

Adapted from Smith, et.al., SEI, 1999

Page 41: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

OAR: Plan Mining Options� What:

• Develop alternatives to mining based on schedule, cost, effort, risk and resourceconsiderations

• Screen candidate components one more time• Analyze the impact of different component aggregations

� Tasks:• Select favorable components

� Determine criteria, such as cost or effort� Screen out components that do not satisfy criteria

• Perform component trade-offs� Identify one component or combination per product line need

• Form component options� Develop criteria for aggregation� Aggregate components

• Determine comparative cost and effort• Analyze difficulty and risk• Elicit mining options• Update OAR schedule

Adapted from Smith, et.al., SEI, 1999

Page 42: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

OAR: Select Mining Option

� What:• Select the best mining option or combination of options by balancing

program and technical considerations• Prepare report

� Tasks:• Choose best option

� Determine drivers for selecting among options� Select an option or a combination of them

• Verify option• Identify component needs satisfied

� Complete the final list of component needs satisfied and not satisfied throughoptions selected

• Present findings• Produce summary

Adapted from Smith, et.al., SEI, 1999

Page 43: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Example of Component Table

From Smith, et.al., SEI, 1999

Page 44: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Example of Component Table

From Smith, et.al., SEI, 1999

Page 45: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Example of Component Table

From Smith, et.al., SEI, 1999

Page 46: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Example of Options Table

From Smith, et.al., SEI, 1999

Page 47: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview� Architecture Excavation and Refactoring

Page 48: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

before

after

Excavated high-level architecture

Page 49: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Klocwork Architecture Excavation MethodologyKlocwork Architecture Excavation Methodology

� Focus:• Containers, interfaces, dependencies on top of entities and relationships

� Container Models• Are scalable and precise; can be used for both abstraction and refactoring• Not UML, because of scalability, the need to evolve with the code, and

specific “existing code” understanding concerns, like links to the code,navigation, etc.

• Transition to UML is straightforward� Strategy

• Top-down• As deep as necessary, as shallow as possible• incremental

� Operations:• Aggregation of entities into bigger containers• Refactoring (moving entities between containers)

Page 50: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Container models� Represent “containers” and relations between “containers”:

• each “container” has dependencies on other “containers”• each “container” provides an API to other “containers”

� This model is scalable:• aggregation of “containers” is another “container”• The aggregation depends on everything that individual parts depended on• The aggregation provides the union of APIs, provided by individual parts

� Model can be refactored• subcontainers can be moved from one container to another, model shows how

dependencies and APIs change� This model is precise

• With respect to the contents of aggregations• With respect to APIs

� This model is meaningful and useful• Leaf “containers” can be procedures, variables, files, etc.• Leaf relations (APIs) are e.g. procedure-calls-procedure, etc.

� Model can be preserved and automatically updated as changes are madeto software

• Leaf containers and their relations are automatically extracted from source; themodel stores only the hierarchy of containers; relations are recalculated on-the-fly

Page 51: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Package Diagram

ArchitecturalPackage A

ArchitecturalPackage B

Dependenciesbetween packages

Dependenciesbetween a package

and environment

100 15 3number of relations

Container modelsContainer models

ArchitecturalPackage B1

ArchitecturalPackage B3

ArchitecturalPackage B2

ArchitecturalPackage B4Architectural

Package A

25 15

50

25

3ArchitecturalPackage C

aggregation of

Page 52: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview� Harvesting as architectural refactoring

• First, you need to excavate your architecture, as a precise model• Reuse requires the following steps:

� Identify/localize/collect� Isolate component� Introduce a boundary� Implement refactoring

• Particular challenges� Challenges of component identification (need to understand)� Challenges of component isolation� Challenges of soft boundaries� Reusable components and architecture erosion� Reusable components and cyclic dependencies

Page 53: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Overview�Examples of Isolating Components via

Refactoring

Page 54: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 55: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 56: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 57: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 58: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 59: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 60: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 61: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 62: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 63: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 64: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 65: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 66: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 67: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 68: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 69: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 70: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 71: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 72: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications
Page 73: How to Harvest Reusable Components in Existing Software Worksho… · Corrective maintenance Preventive maintenance • Major new features to existing software Major modifications

Conclusions/Key points

� Reuse activities add another dimension to multi-release softwareproduction• Reuse for maintenance (cloning)• Reuse for modernization• Reuse for redevelopment• Reuse for product line (across products)

� Reuse is an architecture-centric activity� Suitable Architecture Models are required to manage reuse� Harvesting is an architecture refactoring

• First, you need to excavate your architecture, as a precise model• Harvesting requires the following steps:

� Identify/localize/collect� Isolate component� Introduce a boundary� Implement refactoring