Incremental Change of Software Taxonomy of Evolution Changes - - PowerPoint PPT Presentation
Incremental Change of Software Taxonomy of Evolution Changes - - PowerPoint PPT Presentation
Incremental Change of Software Taxonomy of Evolution Changes Incremental change (IC) adds substantial new functionality Refactoring (restructuring) preserves the functionality Replacement substitute one functionality
Taxonomy of Evolution Changes
- Incremental change (IC)
– adds substantial new functionality
- Refactoring (restructuring)
– preserves the functionality
- Replacement
– substitute one functionality by another – example: replacing buggy code
- Retracting
– deletes a functionality
Strategies for IC
- Anticipated change
– information hiding, parametrization – localize change within one class
- Many changes cannot be anticipated
– process of learning during development
- Microsoft: 70% of requirements predicted
- Ford project: 30% predicted
– examples of unexpected changes
- company mergers, introduction of Euro
Unanticipated IC
- The Software was not prepared/designed for it
- Very common situation in practice
- A substantial part of software engineering
The Mini-process of IC
- Initiation
- IC design
- IC implementation & Tests
- Release
IC Initiation
- Problem Report
– May require logs, traces
- Preventive Maintenance
– enhance reliability, comprehensibility, extensibility, etc.
- New Feature Request
– additional functionality of the product – usually initiated by the customers, marketing, management
- All change requests
– assigned a priority and placed on the queue – hot problems cause instant reprioritization
IC Design
- Concept Location
– Find where in the code the change will be done
- Study Code and Documentation
- Identify/Weigh Alternative Solutions
- Implementation strategy
– Divide large changes into several smaller ones – Each has its own implementation and testing activity
- Impact analysis
– Find all components that will be affected by the change
IC Implementation
- Refactoring 1 (pre-factoring)
– Restructure the software to localize change
- Actualization
– Implements the new code
- Incorporation
– Replaces the new code by the old
- Change propagation
– Changes all other components that must be changed
- Refactoring 2 (post-factoring)
– Improves clarity, readability
Testing
- Unit tests of the components
– Guarantee that units (classes) work
- Regression test
– Guarantee that things that did not change still work
- Integration test
– Guarantee that the whole system works again
- Tests are done both during and after
implementation
IC Release
- Release build
- Write Release Notes
- Make release available to customer
Concept location
- plays key role in IC
- concepts are present in the code
- primitive concepts have to be enriched
– Point-of-Sale: introduce credit card payment – old code: payment represented as just one number
- latent concepts have to be implemented
– Student Registration: introduce prerequisite check – old code assumption: prerequisites are satisfied
Concept location
- finds code that implements concept
- part of program comprehension
- concept location methodologies
– human knowledge – "grep" (pattern matching) – dynamic search (execution traces) – static search through dependency graph – traceability tools
Top-down search
- Depth first search done by programmer:
Start with the top class (main in C++) while (concept is not implemented here)
if (the concept is a part of the composite functionality) move to subclass which leads to the concept else backtrack
concept located
Change propagation
- Refactoring 1 (pre-factoring)
– Restructure the software to localize change
- Actualization
– Implements the new code
- Incorporation
– Replaces the new code by the old
- Change propagation
– Changes all other components that must be changed
- Refactoring 2 (post-factoring)
– Improves clarity, readability
Change propagation
– if the visited class is modified, it may no longer fit
- secondary changes must be made in interacting
(“neighboring”) classes
- secondary changes may trigger additional changes
– “ripple effect”
– Process
- Mark neighboring classes of a class that changed
- visit the marked classes one-by-one
Three possibilities for marked class visit
- Change class
– Mark all neighbors
- Do not change class but propagate
– Mark all neighbors
- Do not change class and do not propagate
– Erase the mark
Three options (class diagram)
Change class mark Do not change class but propagate
Three options (class diagram)
Do not change class and do not propagate
Example change propagation
- Point-Of-Sale application
- Old program
- keeps an inventory, receives delivery, sells
products, and supports a cash register.
- Classes designed and implemented at a minimal
level of functionality
UML class diagram
Incremental change
- complexities of sale taxes
- different products may have different sales tax,
depending on state law
- location
– “tax” in class “item”
- actualization
– new class taxCategory
Incorporation
sale register saleLineItem store item taxCategory
Change propagation
sale register saleLineItem store item taxCategory
Change propagation
sale register saleLineItem store item taxCategory
Change propagation
sale register saleLineItem store item taxCategory
Change propagation
sale register saleLineItem store item taxCategory
Change propagation
sale register saleLineItem store item taxCategory
Summary adding tax
- 1 new class was implemented
- All 5 old classes had to be visited (!)
- 3 old classes had to be changed
Example Drawlets
- Application framework Drawlets
– adds graphical display to a host application
- Drawing canvas
– lines, free-hand lines, rectangles, rounded rectangles, triangles, pentagons, polygons, ellipses, text boxes, images
Drawlets
- more than 100 classes, 35 interfaces and 40,000
lines of code – originally implemented by Kent Beck, Ward Cunningham
- later ported into Java
- “perfect API”
– http://www.rolemodelsoft.com/aboutUs/ drawlets.htm
The host application
- responsible for providing an instance of the
drawing canvas, toolbars, and tool buttons
- Class SimpleApplet is a host application
– is a part of the Drawlet library – SimpleApplet runs in any browser
SimpleApplet window
Top classes
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Concept Location :: Example
- Locating figure properties in Drawlets
Example Drawlets: Top class
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Wrong way
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Backtrack
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Right way
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Wrong way
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Backtrack
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Concept Location :: Summary
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Change Request
- implement an "owner" for each figure
– owner put that figure onto the canvas – only owner is allowed to move that figure – each session declares a session owner
- this session owner will own all new figures created
- no other owner will be allowed to manipulate them
- This change will make SimpleApplet more
versatile and useful
– support for cooperative work
Extraction
- The concepts relevant to the change
– figure owner and session owner – both are implicit
- old code assumes that there is just one owner who
- wns both sessions and figures
Location
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette LabelTool Figure
Actualization
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Incorporation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Propagation
SequenceOfFigures ShapeTool EllipseTool RectangleTool RectangularCreationTool PG_RectImageTool Locator CanvasTool AbstractFigure SimpleDrawingCanvas DrawingCanvas ToolPalette SimpleApplet ToolBar LocatorConnectionHandle PrototypeConstructionTool SelectionTool ConstructionTool StylePalette OwnerIdentity SimpleListener LabelTool Figure
Shorter change propagation
- Long change propagation is a problem
– it would be advantageous to shorten it
- opportunistic refactoring
– moves code affected by change into fewer classes
- splitting the roles
More info on the case study
- Václav Rajlich, Prashant Gosavi: Incremental