Incremental Change of Software
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 register store item sale saleLineItem taxCategory
Change propagation register store item sale saleLineItem taxCategory
Change propagation register store item sale saleLineItem taxCategory
Change propagation register store item sale saleLineItem taxCategory
Change propagation register store item sale saleLineItem taxCategory
Change propagation register store item sale saleLineItem 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 LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Concept Location :: Example • Locating figure properties in Drawlets
Example Drawlets: Top class LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Wrong way LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Backtrack LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Right way LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Wrong way LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Backtrack LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Concept Location :: Summary LocatorConnectionHandle AbstractFigure Locator Figure StylePalette SequenceOfFigures SimpleApplet DrawingCanvas CanvasTool SimpleDrawingCanvas ToolBar SelectionTool ConstructionTool ToolPalette LabelTool PrototypeConstructionTool ShapeTool RectangleTool EllipseTool RectangularCreationTool PG_RectImageTool
Recommend
More recommend