Introduction to Software Engineering 13. Software Evolution.

Slides:



Advertisements
Similar presentations
© S. Demeyer, S. Ducasse, O. Nierstrasz Migration Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.
Advertisements

Towards a Practical Composition Language Oscar Nierstrasz Software Composition Group University of Bern.
Software Modeling SWE5441 Lecture 3 Eng. Mohammed Timraz
SOFTWARE MAINTENANCE 24 March 2013 William W. McMillan.
1 Object-Oriented Reengineering © S. Demeyer, S.Ducasse, O. Nierstrasz Lecture 2 Radu Marinescu Reverse Engineering.
© S. Demeyer, S. Ducasse, O. Nierstrasz Reverse Engineering.1 4. Reverse Engineering JEdit Experience What and Why Setting Direction  Most Valuable First.
Introduction to Software Engineering 7. Modeling Behaviour.
Data Model driven applications using CASE Data Models as the nucleus of software development in a Computer Aided Software Engineering environment.
Alternate Software Development Methodologies
OORPT Object-Oriented Reengineering Patterns and Techniques 7. Problem Detection Prof. O. Nierstrasz.
© S. Demeyer, S. Ducasse, O. Nierstrasz Reverse Engineering.1 2. Reverse Engineering What and Why Setting Direction  Most Valuable First First Contact.
OORPT Object-Oriented Reengineering Patterns and Techniques 4. Reverse Engineering Prof. O. Nierstrasz.
Introduction To System Analysis and Design
Object-Oriented Reengineering Patterns and Techniques Prof. O. Nierstrasz Prof. S. Ducasse T.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.1 5. Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.
The Software Composition Group Prof. O. Nierstrasz
Object-Oriented Reengineering Oscar Nierstrasz Software Composition Group University of Bern.
© S. Demeyer, S. Ducasse, O. Nierstrasz Intro.1 1. Introduction Goals Why Reengineering ?  Lehman's Laws  Object-Oriented Legacy Typical Problems  common.
OORPT Object-Oriented Reengineering Patterns and Techniques 1. Introduction Prof. O. Nierstrasz.
Introduction to Software Evolution and Maintenance
Software Evolution Managing the processes of software system change
13. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Summary, Trends, Research...  Summary: functional, logic and object-oriented.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
© S. Demeyer, S. Ducasse, O. Nierstrasz Reverse Engineering.1 3. Reverse Engineering What and Why Setting Direction  Most Valuable First First Contact.
ESE Einführung in Software Engineering X. CHAPTER Prof. O. Nierstrasz Wintersemester 2005 / 2006.
Object-Oriented Reengineering Patterns — an Overview Oscar Nierstrasz Software Composition Group
© S. Demeyer, S. Ducasse, O. Nierstrasz Migration.1 5. Testing and Migration What and Why  Reengineering Life-Cycle Tests: Your Life Insurance !  Grow.
OORPT Object-Oriented Reengineering Patterns and Techniques 10. Testing and Migration Prof. O. Nierstrasz.
12. Summary, Trends, Research. © O. Nierstrasz PS — Summary, Trends, Research Roadmap  Summary: —Trends in programming paradigms  Research:...
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
Software Reengineering 2003 년 12 월 2 일 최창익, 고광 원.
Chapter 9 – Software Evolution and Maintenance
Principles of Object Technology Module 1: Principles of Modeling.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 18 Slide 1 Software Reuse.
UML - Development Process 1 Software Development Process Using UML (2)
SWE 316: Software Design and Architecture – Dr. Khalid Aljasser Objectives Lecture 11 : Frameworks SWE 316: Software Design and Architecture  To understand.
TOPIC R Software Maintenance, Evolution, Program Comprehension, and Reverse Engineering SEG4110 Advanced Software Design and Reengineering.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 27Slide 1 Software change l Managing the processes of software system change.
Architecture-Based Runtime Software Evolution Peyman Oreizy, Nenad Medvidovic & Richard N. Taylor.
©Ian Sommerville 2000, Mejia-Alvarez 2009 Slide 1 Software Processes l Coherent sets of activities for specifying, designing, implementing and testing.
1 Object-Oriented Reengineering © S. Demeyer, S.Ducasse, O. Nierstrasz Lecture 1 Radu Marinescu Introduction to Object-Oriented Reengineering.
© S. Demeyer, S. Ducasse, O. Nierstrasz Intro.1 1. Introduction Goals Why Reengineering ?  Lehman's Laws  Object-Oriented Legacy Typical Problems  common.
Copyright 2002 Prentice-Hall, Inc. Modern Systems Analysis and Design Third Edition Jeffrey A. Hoffer Joey F. George Joseph S. Valacich Chapter 20 Object-Oriented.
Introduction To System Analysis and Design
© 2007 by Prentice Hall 1 Introduction to databases.
A Novel Approach to Architectural Recovery in Evolving Object- Oriented Systems PhD thesis Koen De Hondt December 11, 1998.
 CS 5380 Software Engineering Chapter 9 Software Evolution.
1 Introduction to Software Engineering Lecture 1.
Object-Oriented Reengineering Patterns 1. Introduction.
Manag ing Software Change CIS 376 Bruce R. Maxim UM-Dearborn.
CS 772: Global Knowledge Networks V. “Juggy” Jagannathan CSEE, West Virginia University.
©Ian Sommerville 2000 Software Engineering, 6th edition. Chapter 28Slide 1 CO7206 System Reengineering 4.2 Software Reengineering Most slides are Slides.
Chapter 5: Software Re-Engineering Omar Meqdadi SE 3860 Lecture 5 Department of Computer Science and Software Engineering University of Wisconsin-Platteville.
Software Maintenance Speaker: Jerry Gao Ph.D. San Jose State University URL: Sept., 2001.
CASE (Computer-Aided Software Engineering) Tools Software that is used to support software process activities. Provides software process support by:- –
Software Engineering Prof. Dr. Bertrand Meyer Dr. Manuel Oriol Dr. Bernd Schoeller Chair of Software Engineering Lectures 22: Legacy Software.
® IBM Software Group © 2009 IBM Corporation Essentials of Modeling with the IBM Rational Software Architect, V7.5 Module 15: Traceability and Static Analysis.
©Ian Sommerville 2004Software Engineering, 7th edition. Chapter 21 Slide 1 Software evolution.
OOD OO Design. OOD-2 OO Development Requirements Use case analysis OO Analysis –Models from the domain and application OO Design –Mapping of model.
CS223: Software Engineering Lecture 32: Software Maintenance.
Chapter 18 Maintaining Information Systems
Introduction to Software Evolution and Maintenance
Software Maintenance PPT By :Dr. R. Mall.
Software Re-engineering - Theoretical and Practical Approaches
Software Maintenance Main issues: why maintenance is such an issue
Software Maintenance Main issues: why maintenance is such an issue
Software Development Process Using UML Recap
Introduction Software maintenance:
Presentation transcript:

Introduction to Software Engineering 13. Software Evolution

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 2

Literature © Oscar Nierstrasz ESE — Software Evolution 3  Demeyer, Ducasse, and Nierstrasz. Object-Oriented Reengineering Patterns, Square Bracket Associates,

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 4

What is wrong with this picture? MY NEW DESIGN WILL MEET ALL OF OUR CUSTOMERS’ CURRENT AND FUTURE NEEDS ESE — Software Evolution

© Oscar Nierstrasz ESE — Software Evolution 6 Lehman’s Laws Continuing change —A program that is used in a real-world environment must change, or become progressively less useful in that environment. Increasing complexity —As a program evolves, it becomes more complex, and extra resources are needed to preserve and simplify its structure. Lehman, Belady. Program Evolution: Processes of Software Change, London Academic Press, London, 1985

© Oscar Nierstrasz 7 The Dilemma of Legacy Software A legacy system is a piece of software that: —you have inherited, and —is valuable to you. Symptoms —Loss of knowledge —Architecture & design drift —Hard to make changes —… You can’t afford to throw it out, but it is too expensive to change ESE — Software Evolution

© Oscar Nierstrasz 8 OO Legacy  Object-oriented legacy systems are successful OO systems whose architecture and design no longer respond to changing requirements ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.9 Common Symptoms Lack of Knowledge  obsolete or no documentation  departure of the original developers or users  disappearance of inside knowledge about the system  limited understanding of entire system  missing tests Lack of Knowledge  obsolete or no documentation  departure of the original developers or users  disappearance of inside knowledge about the system  limited understanding of entire system  missing tests Process symptoms  too long to turn things over to production  need for constant bug fixes  maintenance dependencies  difficulties separating products  simple changes take too long Process symptoms  too long to turn things over to production  need for constant bug fixes  maintenance dependencies  difficulties separating products  simple changes take too long Code symptoms duplicated code code smells  big build times Code symptoms duplicated code code smells  big build times ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.10 Common Problems Architectural Problems  insufficient documentation = non-existent or out-of-date  improper layering = too few or too many layers  lack of modularity = strong coupling  duplicated code = copy, paste & edit code  duplicated functionality = similar functionality by separate teams Architectural Problems  insufficient documentation = non-existent or out-of-date  improper layering = too few or too many layers  lack of modularity = strong coupling  duplicated code = copy, paste & edit code  duplicated functionality = similar functionality by separate teams Refactoring opportunities  misuse of inheritance = code reuse vs polymorphism  missing inheritance = duplication, case-statements  misplaced operations = operations outside classes  violation of encapsulation = type-casting; C++ "friends"  class abuse = classes as namespaces Refactoring opportunities  misuse of inheritance = code reuse vs polymorphism  missing inheritance = duplication, case-statements  misplaced operations = operations outside classes  violation of encapsulation = type-casting; C++ "friends"  class abuse = classes as namespaces ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.11 Continuous Development 17.4% Corrective (fixing reported errors) 18.2% Adaptive (new platforms or OS) 60.3% Perfective (new functionality) The bulk of the maintenance cost is due to new functionality  even with better requirements, it is hard to predict new functions The bulk of the maintenance cost is due to new functionality  even with better requirements, it is hard to predict new functions data from [Lien78a] 4.1% Other ESE — Software Evolution

© Oscar Nierstrasz 12 cost time cost time The cost of change x 200 We need to reduce the cost of change over time … — cf., XP Explained ESE — Software Evolution

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 13

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.14 Some Terminology “Forward Engineering is the traditional process of moving from high- level abstractions and logical, implementation-independent designs to the physical implementation of a system.” “Reverse Engineering is the process of analyzing a subject system to identify the system’s components and their interrelationships and create representations of the system in another form or at a higher level of abstraction.” “Reengineering... is the examination and alteration of a subject system to reconstitute it in a new form and the subsequent implementation of the new form.” — Chikofsky and Cross [in Arnold, 1993] ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.15 Goals of Reverse Engineering  Cope with complexity —need techniques to understand large, complex systems  Generate alternative views —automatically generate different ways to view systems  Recover lost information —extract what changes have been made and why  Detect side effects —help understand ramifications of changes  Synthesize higher abstractions —identify latent abstractions in software  Facilitate reuse —detect candidate reusable artifacts and components — Chikofsky and Cross [in Arnold, 1993] ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.16 Reverse Engineering Techniques  Redocumentation —pretty printers —diagram generators —cross-reference listing generators  Design recovery —software metrics —browsers, visualization tools —static analyzers —dynamic (trace) analyzers ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.17 Goals of Reengineering  Unbundling —split a monolithic system into parts that can be separately marketed  Performance —“first do it, then do it right, then do it fast” — experience shows this is the right sequence!  Port to other Platform —the architecture must distinguish the platform dependent modules  Design extraction —to improve maintainability, portability, etc.  Exploitation of New Technology —i.e., new language features, standards, libraries, etc. ESE — Software Evolution

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.18 Reengineering Techniques  Restructuring —automatic conversion from unstructured to structured code —source code translation — Chikofsky and Cross  Data reengineering —integrating and centralizing multiple databases —unifying multiple, inconsistent representations —upgrading data models — Sommerville, ch 32  Refactoring —renaming/moving methods/classes etc. ESE — Software Evolution

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 19

© Stéphane Ducasse, Serge Demeyer, Oscar Nierstrasz 1.20 The Reengineering Life-Cycle Requirements Designs Code (0) requirement analysis (1) model capture (2) problem detection (3) problem resolution (4) program transformation people centric lightweight ESE — Software Evolution

© Oscar Nierstrasz 21 Reengineering Patterns In software engineering, a design pattern is a general solution to a common problem in software design. A design pattern isn't a finished design that can be transformed directly into code; it is a description or template for how to solve a problem that can be used in many different situations.software engineeringsoftware designcode In software engineering, a design pattern is a general solution to a common problem in software design. A design pattern isn't a finished design that can be transformed directly into code; it is a description or template for how to solve a problem that can be used in many different situations.software engineeringsoftware designcode Reverse engineering patterns encode expertise and trade-offs in extracting design from source code, running systems and people. —Even if design documents exist, they are typically out of sync with reality. Reengineering patterns encode expertise and trade-offs in transforming legacy code to resolve problems that have emerged. —These problems are typically not apparent in original design but are due to architectural drift as requirements evolve ESE — Software Evolution

© Oscar Nierstrasz 22 A Map of Reengineering Patterns Tests: Your Life Insurance Detailed Model Capture Initial Understanding First Contact Setting Direction Migration Strategies Detecting Duplicated Code Redistribute Responsibilities Transform Conditionals to Polymorphism ESE — Software Evolution

© Oscar Nierstrasz 23 Setting Direction Agree on Maxims Appoint a Navigator Speak to the Round Table Fix Problems, Not Symptoms If It Ain't Broke Don't Fix It Keep it Simple Set direction Maintain direction Coordinate direction Where to start What not to do What to do How to do it Principles & Guidelines for Software project management especially relevant for reengineering projects Most Valuable First ESE — Software Evolution

© Oscar Nierstrasz 24 Most Valuable First Problem: Which problems should you focus on first? Solution: Work on aspects that are most valuable to your customer  Maximize commitment, early results; build confidence  Difficulties and hints: —Which stakeholder do you listen to? —What measurable goal to aim for? —Consult change logs for high activity —Play the Planning Game —Wrap, refactor or rewrite? — Fix Problems, not Symptoms Vs. Fix the Buggiest First? ESE — Software Evolution

© Oscar Nierstrasz 25 First Contact System experts Chat with the Maintainers Interview during Demo Talk with developers Talk with end users Software System Read All the Code in One Hour Do a Mock Installation Read itCompile it Skim the Documentation Talk about it Verify what you hear Read about it Feasibility assessment (one week time) ESE — Software Evolution

© Oscar Nierstrasz 26 Initial Understanding Top down Speculate about Design Recover design Analyze the Persistent Data Study the Exceptional Entities Read it Compile it Bottom up understand  Obtain a higher-level model understand  Obtain a higher-level model ESE — Software Evolution

© Oscar Nierstrasz 27 Pattern: Study the Exceptional Entities Problem —How can you quickly gain insight into complex software? Solution —Measure software entities and study the anomalous ones Steps —Use simple metrics —Visualize metrics to get an overview —Browse the code to get insight into the anomalies ESE — Software Evolution

© Oscar Nierstrasz 28 System Complexity View Nodes = Classes Edges = Inheritance Relationships Width = Number of Attributes Height = Number of Methods Color = Number of Lines of Code System Complexity View Color Metric Position Metrics Width Metric Height Metric ESE — Software Evolution

© Oscar Nierstrasz 29 Detailed Model Capture Tie Code and Questions Refactor to Understand Keep track of your understanding Expose design Step through the Execution Look for the Contracts Learn from the Past Expose collaborations Expose contracts Expose evolution Write Tests to Understand Write Tests to Understand Expose the design & make sure it remains exposed Use Your Tools Look for Key Methods Look for Constructor Calls Look for Template/Hook Methods Look for Super Calls Use Your Tools Look for Key Methods Look for Constructor Calls Look for Template/Hook Methods Look for Super Calls ESE — Software Evolution

© Oscar Nierstrasz 30 Tests: Your Life Insurance Write Tests to Enable Evolution Grow Your Test Base Incrementally Managing tests Use a Testing Framework Test the Interface, Not the Implementation Record Business Rules as Tests Designing tests Write Tests to Understand Test Fuzzy features Test Old Bugs Retest Persistent Problems Test Fuzzy features Test Old Bugs Retest Persistent Problems Regression Test after Every Change Migration Strategies ESE — Software Evolution

© Oscar Nierstrasz 31 Migration Migrate Systems Incrementally Conserve Familiarity How Use Profiler before Optimizing Build Confidence Involve the Users How Why Prototype the Target Solution Always Have a Running Version Regression Test after Every Change Present the Right Interface Distinguish Public from Published Interfaces Deprecate Obsolete Interfaces Make a Bridge to the New Town How Tests, your Life-Insurance Tests, your Life-Insurance Where to ESE — Software Evolution

© Oscar Nierstrasz 32 Detecting Duplicated Code Compare Code Mechanically Visualize Code as Dotplots Redistribute Responsibilities Transform Conditionals to Polymorphism Detect Understand ESE — Software Evolution

© Oscar Nierstrasz 33 Pattern: Visualize Code as Dotplots Problem —How can you effectively identify significant duplication in a complex software system? Solution —Visualize the code as a dotplot, where dots represent duplication. Steps —Normalize the source files —Compare files line-by-line —Visualize and interpret the dotplots ESE — Software Evolution

© Oscar Nierstrasz 34 Clone detection by string-matching Solid diagonals indicate significant duplication between or within source files. ESE — Software Evolution

© Oscar Nierstrasz 35 Dotplot Visualization Sample Dot Configurations: ESE — Software Evolution

© Oscar Nierstrasz 36 Redistribute Responsibilities Eliminate Navigation Code Data containers Monster client of data containers Split Up God Class Move Behaviour Close to Data Chains of data containers ESE — Software Evolution

© Oscar Nierstrasz 37 High-level refactorings High-level refactorings make use of many low- level refactorings ESE — Software Evolution

© Oscar Nierstrasz 38 Transform Self Type Checks Test provider type Test self type Test external attribute Transform Client Type Checks Transform Conditionals into Registration Test null values Introduce Null Object Factor Out Strategy Factor Out State Test object state Transform Conditionals to Polymorphism ESE — Software Evolution

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 39

Moose — an extensible platform for software and data analysis ESE — Software Evolution Import/export format for models Data parsing support …more FAMIX meta-models family

Smalltalk Navigation Metrics Querying Grouping Smalltalk Java C++ COBOL … CDIF XMI External Parser CodeCrawler ConAnVan... Hapax Extensible meta model Model repository Explicit metamodels enable change The Story of Moose: an Agile Reengineering Environment. Nierstrasz, Ducasse, Gîrba. ESEC/FSE 2005 ESE — Software Evolution

Moose visualizations ESE — Software Evolution

Programming visualizations with CodeCrawler ESE — Software Evolution

Scripting visualizations with Mondrian Mondrian: An Agile Visualization Framework. Meyer, Gîrba, Lungu. SoftVis 2006 ESE — Software Evolution

Data navigation through generic or dedicated browsers ESE — Software Evolution

Scripting browsers with Glamour ESE — Software Evolution

Scripting browsers with Glamour ESE — Software Evolution

Moose — a platform for collaborative research ESE — Software Evolution

Roadmap  Lehman’s Laws of Software Evolution  Forward and Reverse Engineering  Reengineering Patterns  The Moose software analysis platform © Oscar Nierstrasz ESE — Software Evolution 49

Conclusion  Valuable software inevitably changes  Reverse and reengineering are necessary activities throughout the lifecycle of a software system  Simple techniques go a long way © Oscar Nierstrasz ESE — Software Evolution 50

What you should know!  What is Lehman’s Laws of Continuing Change?  Why do software systems become more complex over time?  Why is duplicated code considered to be a bad code smell?  How can you reduce the cost of software maintenance?  What is meant by “reverse engineering”?  How can studying exceptional entities help you to understand a software system? © Oscar Nierstrasz ESE — Software Evolution 51

Can you answer the following questions?  Is a legacy software system a good thing or a bad thing to have?  How can you ensure that documentation stays in sync with implementation?  When should you start a reengineering project?  What are the dangers of trying to fix the buggiest code first? © Oscar Nierstrasz ESE — Software Evolution 52

License © Oscar Nierstrasz ESE — Software Evolution Attribution-ShareAlike 3.0 Unported You are free: to Share — to copy, distribute and transmit the work to Remix — to adapt the work Under the following conditions: Attribution. You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). Share Alike. If you alter, transform, or build upon this work, you may distribute the resulting work only under the same, similar or a compatible license. For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. Any of the above conditions can be waived if you get permission from the copyright holder. Nothing in this license impairs or restricts the author's moral rights. 53