Michele Lanza Software Visualization. 2 Software Visualization - Outline  Introduction  Software Visualization in a Reengineering Context  Static Code.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Object-Oriented Software Development CS 3331 Fall 2009.
Alternative Approach to Systems Analysis Structured analysis
Software Modeling SWE5441 Lecture 3 Eng. Mohammed Timraz
Introduction to Databases
Requirements Engineering n Elicit requirements from customer  Information and control needs, product function and behavior, overall product performance,
© S. Demeyer, S. Ducasse, O. Nierstrasz Reverse Engineering.1 2. Reverse Engineering What and Why Setting Direction  Most Valuable First First Contact.
The Experience Factory May 2004 Leonardo Vaccaro.
Program Comprehension & Software Evolution - [Lightweight] Principles and [real] Practice Michele Lanza Faculty of Informatics University of Lugano Switzerland.
Object-Oriented Analysis and Design
Managing Data Resources
Requirements Specification
File Systems and Databases
OORPT Object-Oriented Reengineering Patterns and Techniques 5. Software Visualization Prof. O. Nierstrasz.
1 Objectives To introduces the concept of software Design. To introduce the concept of Object- Oriented Design (OOD). To Define various aspects about object.
© S. Demeyer, S. Ducasse, O. Nierstrasz Visualization.1 5. Software Visualization Introduction  SV in a Reengineering Context Static Code Visualization.
Chapter 9 Database Design
Improving UML Class Diagrams using Design Patterns Semantics Shahar Maoz Work in Progress.
Creating Architectural Descriptions. Outline Standardizing architectural descriptions: The IEEE has published, “Recommended Practice for Architectural.
These courseware materials are to be used in conjunction with Software Engineering: A Practitioner’s Approach, 6/e and are provided with permission by.
OORPT Object-Oriented Reengineering Patterns and Techniques X. CHAPTER Prof. O. Nierstrasz.
Modified from Sommerville’s originalsSoftware Engineering, 7th edition. Chapter 8 Slide 1 System models.
© Copyright Eliyahu Brutman Programming Techniques Course.
© S. Demeyer, S. Ducasse, O. Nierstrasz Visualization.1 3. Software Visualization Introduction SV in a Reengineering Context Static Code Visualization.
An Introduction to Software Visualization Dr. Jonathan I. Maletic Software DevelopMent Laboratory Department of Computer Science Kent State University.
9 1 Chapter 9 Database Design Database Systems: Design, Implementation, and Management, Seventh Edition, Rob and Coronel.
Introduction to Software Design Chapter 1. Chapter 1: Introduction to Software Design2 Chapter Objectives To become familiar with the software challenge.
Object Oriented Analysis and Design Using the UML
Software Reengineering 2003 년 12 월 2 일 최창익, 고광 원.
The Re-engineering and Reuse of Software
The chapter will address the following questions:
Basic Concepts The Unified Modeling Language (UML) SYSC System Analysis and Design.
CASE Tools And Their Effect On Software Quality Peter Geddis – pxg07u.
Chapter 6: The Traditional Approach to Requirements
MDC Open Information Model West Virginia University CS486 Presentation Feb 18, 2000 Lijian Liu (OIM:
Chapter 7 Requirement Modeling : Flow, Behaviour, Patterns And WebApps.
Week 1 Lecture MSCD 600 Database Architecture Samuel ConnSamuel Conn, Asst. Professor Suggestions for using the Lecture Slides.
ITEC224 Database Programming
Database Design Adapted from Database Systems: Design, Implementation, and Management Eighth Edition Rob, Coronel.
ITEC 3220M Using and Designing Database Systems
1 Chapter 9 Database Design. 2 2 In this chapter, you will learn: That successful database design must reflect the information system of which the database.
9/14/2012ISC329 Isabelle Bichindaritz1 Database System Life Cycle.
Programming in Java Unit 3. Learning outcome:  LO2:Be able to design Java solutions  LO3:Be able to implement Java solutions Assessment criteria: 
Software development process ธนวัฒน์ แซ่ เอียบ. The development process Process –set of rules which define how a development project. Methodology and.
1/26/2004TCSS545A Isabelle Bichindaritz1 Database Management Systems Design Methodology.
Systems Analysis and Design in a Changing World, 3rd Edition
1 Introduction to Software Engineering Lecture 1.
Object-Oriented Analysis and Design Fall 2009.
5 - 1 Copyright © 2006, The McGraw-Hill Companies, Inc. All rights reserved.
Computer Systems & Architecture Lesson 4 8. Reconstructing Software Architectures.
1 CMPT 275 High Level Design Phase Modularization.
© 2010 Health Information Management: Concepts, Principles, and Practice Chapter 5: Data and Information Management.
© 2005 Prentice Hall1-1 Stumpf and Teague Object-Oriented Systems Analysis and Design with UML.
Software Architecture Evaluation Methodologies Presented By: Anthony Register.
Architecture View Models A model is a complete, simplified description of a system from a particular perspective or viewpoint. There is no single view.
Generating Software Documentation in Use Case Maps from Filtered Execution Traces Edna Braun, Daniel Amyot, Timothy Lethbridge University of Ottawa, Canada.
1 Advanced Software Architecture Muhammad Bilal Bashir PhD Scholar (Computer Science) Mohammad Ali Jinnah University.
Chapter 5 System Modeling. What is System modeling? System modeling is the process of developing abstract models of a system, with each model presenting.
® IBM Software Group © 2009 IBM Corporation Essentials of Modeling with the IBM Rational Software Architect, V7.5 Module 15: Traceability and Static Analysis.
Concepts and Realization of a Diagram Editor Generator Based on Hypergraph Transformation Author: Mark Minas Presenter: Song Gu.
21/1/ Analysis - Model of real-world situation - What ? System Design - Overall architecture (sub-systems) Object Design - Refinement of Design.
Class Diagrams. Terms and Concepts A class diagram is a diagram that shows a set of classes, interfaces, and collaborations and their relationships.
Object Oriented Analysis & Design By Rashid Mahmood.
Software Metrics 1.
Object-Oriented Analysis and Design
Unified Modeling Language
System Design.
File Systems and Databases
OORPT Object-Oriented Reengineering Patterns and Techniques
Presentation transcript:

Michele Lanza Software Visualization

2 Software Visualization - Outline  Introduction  Software Visualization in a Reengineering Context  Static Code Visualization  Examples  Dynamic Code Visualization  Examples  Lightweight Approaches  Combining Metrics and Visualization  Demonstration  Conclusion

3Prologue  Reverse engineer 1.2 MLOC C++ system of ca classes  * 2 = 2’400’000 seconds  / 3600 = 667 hours / 8 = 83 days / 5 = 16 weeks & 3 days  ~ 4 months to read the system  Questions :  What is the size and the overall structure of the system?  What is the internal structure of the system and its elements?  How did the software system become like that? Once upon a time…

4Introduction  Visualization  Information Visualization  Software Visualization  Algorithm Visualization  Program Visualization Static Code Visualization Dynamic Code Visualization  The overall goal is to reduce complexity

5 Information Visualization  The human eye and brain interpret visual information in order to “react to the world”  We want to answer questions on what we perceive  J. Bertin inferred three levels of questions  Lower perception (one element)  Medium perception (several elements)  Upper perception (all elements/the complete picture)  Information Visualization is about  how to display information  how to reduce its complexity

6 Software Visualization “Software Visualization is the use of the crafts of typography, graphic design, animation, and cinematography with modern human-computer interaction and computer graphics technology to facilitate both the human understanding and effective use of computer software.” Price, Baecker and Small, “Introduction to Software Visualization”  2 main fields:  Algorithm Visualization  Program Visualization

7 Conceptual Problem "Software is intangible, having no physical shape or size. Software visualization tools use graphical techniques to make software visible by displaying programs, program artifacts and program behavior.” [Thomas Ball]

8 Software Visualization in Context  There are many good-looking visualization techniques, but..when it comes to software maintenance & evolution, there are several problems:  Scalability  Information Retrieval  What to visualize  How to visualize  Reengineering context constraints Limited time Limited resources

9 The Reengineering Life-cycle Requirements Designs Code (0) requirement analysis (1) model capture (2) problem detection (3) problem resolution (4) program transformation (2) problem detection issues Tool support Scalability Efficiency

10 Program Visualization  Static code visualization  Dynamic code visualization  Generate different views of a system and infer knowledge based on the views  Complex problem domain (current research area)  Efficient space use, edge crossing problem, layout problem, focus, HCI issues, GUI issues, …  Lack of conventions (colors, symbols, interpretation, …) “Program visualization is the visualization of the actual program code or data structures in either static or dynamic form” [Price, Baecker and Small]

11 Program Visualization II  Level of granularity?  Complete systems, subsystems, modules, classes, hierarchies,...  When to apply?  First contact with an unknown system  Known/unknown parts?  Forward engineering?  Methodology?

12 Static Code Visualization  The Visualization of information that can be extracted from the static structure of a software system  Depends on the programming language and paradigm:  Object-Oriented PL: classes, methods, attributes, inheritance, …  Procedural PL: procedures, invocations, …  Functional PL: functions, function calls, …

13 Example 1: Class Hierarchies  Jun/OpenGL  The Smalltalk Class Hierarchy  Problems:  Colors are meaningless  Visual Overload  Navigation

14 Example 2: Tree Maps  Pros  100% screen  Large data  Scales well  Cons  Boundaries  Cluttered display  Interpretation  Leaves only  Useful for the display of Hard Disks

15 Examples 3 & 4  Euclidean cones  Pros: More info than 2D  Cons: Lack of depth Navigation  Hyperbolic trees  Pros: Good focus Dynamic  Cons: Copyright

16 Class Diagram Approaches  For example UML diagrams…  Pros:  OO Concepts  Good for small parts  Cons:  Lack of scalability  Require tool support  Requires mapping rules to reduce noise  Preconceived views

17 Class Diagram Examples

18 Example 5: MetricView  UML & 3D

19 Example 6a: Rigi  Scalability problem  Entity- Relationship visualization  Problems:  Filtering  Navigation

20 Example 6b: Rigi  Entities can be grouped  Pros:  Scales well  Applicable in other domains  Cons:  Not enough code semantics

21Evaluation  Pros  Intuitive approaches  Aesthetically pleasing results  Cons  Several approaches are orthogonal to each other  Too easy to produce meaningless results  Scaling up is sometimes possible, but at the expense of semantics

22 Dynamic Code Visualization  Visualization of dynamic behavior of a software system  Code instrumentation  Trace collection  Trace evaluation  What to visualize Execution trace Memory consumption Object interaction …

23 Example 1: JInsight  Visualization of execution trace

24 Example 2: Inter-class call matrix  Simple  Scales quite well  Reproducible

25 Example 3: TraceCrawler

26 Dynamic SV: Evaluation  Code instrumentation problem  Logging, Extended VMs, Method Wrapping  Scalability problem  Traces quickly become very big  Completeness problem  Scenario driven  Pros:  Good for fine-tuning, problem detection  Cons:  Tool support crucial  Lack of abstraction without tool support

27 Taking a step back…  Why is visualization important at all?  Is it actually useful?  No, visualization is only a means, not the end…  Yes, visualization is only a means, not the end!!!  The question is: “What is the end?”  We want to understand systems…

28 Lightweight Approaches  Already existing approaches and tools exist:  hyperbolic views, fish-eye views, spring layouts, …  Rigi, ShrimpView, Creole, Gsee, …  Some of them are even copyrighted and/or commercial tools!  Why are they not widely used?  The reengineering context does not permit heavy-weight approaches  Let’s do it lightweight then…

29 Object-Oriented Reverse Engineering  Goal: take a (large legacy) software system and “understand” it, i.e., construct a mental model of the system  Problem: the software system in question is  Unknown, very large, and complex  Domain- and language-specific  Seldom documented or commented  “In bad shape” ?

30 Object-Oriented Reverse Engineering (II)  Constructing a mental model requires information about the system:  Top-down approaches  Bottom-up approaches  Mixed Approaches  There is no “silver bullet” methodology  Every reverse engineering situation is unique  Need for flexibility, customizability, scalability, and simplicity

31 Reverse Engineering Approaches  Reading (source code, documentation, UML diagrams, comments)  Running the SW and analyze its execution trace  Interview users and developers (if available)  Clustering  Concept Analysis  Software Visualization  Software Metrics  Slicing and Dicing  Querying (Database)  Data Mining  Logic Reasoning  …

32 The “Information Crystallization” Problem  Many approaches generate too much or not enough information  The reverse engineer must make sense of this information by himself  We need the right information at the right time

33 What is the actual problem?  The information needed to reverse engineer a legacy software system resides at various levels  We need to obtain and combine  Coarse-grained information about the whole system  Fine-grained information about specific parts  Evolutionary information about the past of the system

34 A simple Solution - The Polymetric View  A lightweight combination of two approaches:  Software visualization (reduction of complexity, intuitive)  Software metrics (scalability, assessment)  Interactivity (iterative process, silver bullet impossible)  Does not replace other techniques, it complements them:  “Opportunistic code reading”

35 The Polymetric View - Principles  Visualize software:  entities as rectangles  relationships as edges  Enrich these visualizations:  Map up to 5 software metrics on a 2D figure  Map other kinds of semantic information on nominal colors width metric height metric 2 position metrics Entities Relationships color metric

36 The Polymetric View - Example Nodes = Classes Edges = Inheritance Relationships Width = Number of Attributes Height = Number of Methods Color = Number of Lines of Code System Complexity View

37 The Polymetric View - Example (II) Get an impression (build a first raw mental model) of the system, know the size, structure, and complexity of the system in terms of classes and inheritance hierarchies Locate important (domain model) hierarchies, see if there are any deep, nested hierarchies Locate large classes (standalone, within inheritance hierarchy), locate stateful classes and classes with behaviour Count the classes, look at the displayed nodes, count the hierarchies Search for node hierarchies, look at the size and shape of hierarchies, examine the structure of hierarchies Search big nodes, note their position, look for tall nodes, look for wide nodes, look for dark nodes, compare their size and shape, “read” their name => opportunistic code reading System Complexity View Reverse engineering goalsView-supported tasks Nodes = Classes Edges = Inheritance Relationships Width = # attributes Height = # methods Color = # lines of code

38 Structural Specification Target Scope Metrics Layout Description Goals……………………………………….. …………………………… Symptoms…………………….. …………………………… Scenario Case Study……………………………………….. ……………………….. The Polymetric View - Description  Every polymetric view is described according to a common pattern  Every view targets specific reverse engineering goals  The polymetric views are implemented in CodeCrawler System Complexity View

39 Coarse-grained Software Visualization  Reverse engineering question:  What is the size and the overall structure of the system?  Coarse-grained reverse engineering goals:  Gain an overview in terms of size, complexity, and structure  Asses the overall quality of the system  Locate and understand important (domain model) hierarchies  Identify large classes, exceptional methods, dead code, etc.  …

40 Coarse-grained Polymetric Views - Example Method Efficiency Correlation View Nodes:Methods Edges:- Size: Number of method parameters Position X: Number of lines of code Position Y: Number of statements LOC NOS Goals: Detect overly long methods Detect “dead” code Detect badly formatted methods Get an impression of the system in terms of coding style Know the size of the system in # methods

41 Inheritance Classification View Boxes:Classes Edges:Inheritance Width: Number of Methods Added Height: Number of Methods Overridden Color: Number of Method Extended

42 Data Storage Class Detection View Boxes: Classes Width: Number of Methods Height: Lines of Code Color: Lines of Code

43 Nodes:Classes Edges:Inheritance Relationships Width: Number of attributes Height: Number of methods Color: Number of lines of code Quiz: Where would you start looking?

44 CodeCrawler Demo

45 Clustering the Polymetric Views First Contact System Hotspots System Complexity Root Class Detection Implementation Weight Distribution Candidate Detection Data Storage Class Detection Method Efficiency Correlation Direct Attribute Access View Method Length Distribution Inheritance Assessment Inheritance Classification Inheritance Carrier Intermediate Abstract Class Internal The Class Blueprint

46 Coarse-grained SV - Conclusions  Benefits  Views are customizable (context…) and easily modifiable  Simple approach, yet powerful  Scalability  Limits  Visual language must be learned

47 Granularity level problem: It looks nice, but...what’s inside?

48 Fine-grained Software Visualization  Reverse engineering question:  What is the internal structure of the system and its elements?  Fine-grained reverse engineering goals:  Understand the internal implementation of classes and class hierarchies  Detect coding patterns and inconsistencies  Understand class/subclass roles  Identify key methods in a class  …

49 The Class Blueprint - Principles Invocation Sequence InitializationExternal InterfaceInternal ImplementationAccessorAttribute The class is divided into 5 layers Nodes Methods, Attributes, Classes Edges Invocation, Access, Inheritance The method nodes are positioned according to Layer Invocation sequence

50 The Class Blueprint - Principles (II) Attribute Read Accessor Delegating Method Constant MethodAbstract Method Overriding Method Extending Method Write Accessor Method # invocations # lines Attribute # external accesses # internal accesses Direct Attribute AccessMethod Invocation

51 The Class Blueprint - Example  Delegate:  Delegates functionality to other classes  May act as a “Façade” (DP)  Large Implementation:  Deep invocation structure  Several methods  High decomposition  Wide Interface  Direct Access  Sharing Entries

52 The Class Blueprint - Example (II)  Call-flow  Double Single Entry  (=> split class?)  Inheritance  Adder  Interface overriders  Semantics  Direct Access  State Usage  Sharing Entries

53 Class Blueprint: Data Storage  Has many attributes  May have many accessor methods  No complex behavior  No internal implementation!

54 Class Blueprint: Inheritance Policy Breach

55 The Class Blueprint - A Pattern Language?  The patterns reveal information about  Coding style  Coding policies  Particularities  We grouped them according to  Size  Layer distribution  Semantics  Call-flow  State usage  Moreover…  Inheritance Context  Frequent pattern combinations  Rare pattern combinations  They are all part of a pattern language

56 The Class Blueprint - What do we see?

57 CodeCrawler Demo

58 Fine-grained SV - Conclusions  Benefits  Complexity reduction  Visual code inspection technique  Complements the coarse-grained views  Limits  Visual language must be learned  Good object-oriented knowledge required  No information about actual functionality => opportunistic code reading necessary

59Epilogue  Did we succeed after all?  Not completely, but…  System Hotspots View on 1.200’000 LOC of C++  System Complexity View on ca. 200 classes of C++ …happily everafter.

60 Industrial Validation - The Acid Test  Several large, industrial case studies (NDA)  Different implementation languages  Severe time constraints SystemLanguageLines of CodeClasses ZC++1’200’000~2300 YC++/Java120’000~400 XSmalltalk600’000~2500 WCOBOL40’000- SortieC/C++28’000~70 DuplocSmalltalk32’000~230 JunSmalltalk135’000~700

61 Software Visualization: Conclusions  SV is very useful when used correctly  An integrated approach is needed, just having nice pictures is not enough  Most tools still at prototype level  In general: only people that know what they see can react on that: SV is for expert/advanced developers  The future of software development is coming…and SV is part of it