Visualization CS 351 Software Engineering AY 2007 Program

  • Slides: 16
Download presentation
Visualization CS 351 - Software Engineering (AY 2007)

Visualization CS 351 - Software Engineering (AY 2007)

Program visualization • • • Debugging programs without the aid of support tools can

Program visualization • • • Debugging programs without the aid of support tools can be extremely difficult. See “My Hairest Bug War Stories”, Marc Eisenstadt, Communications of the ACM, Vol 40, No 4, April 1997, pp 30 -37. This article makes it clear that the potential sources for bugs in software is enormous and that tracking them down is both costly and time consuming Clearly it is preferable that we do not put bugs in our code, but we are all human. . . Software visualization, or program visualization, can assist programmers to better debug, maintain and understand the behaviour of their programs and thereby track down bugs through the use of graphically presented information. Program visualisation is a technique to manage complexity. CS 351 - Software Engineering (AY 2007) 2

Program visualization • • • The paper “Aspects and Taxonomy of Program Visualisation”, M.

Program visualization • • • The paper “Aspects and Taxonomy of Program Visualisation”, M. J. Oudshoorn, H. Widjaja, and S. K. Ellershaw, in Software Visualisation, P. Eades and K. Zhang (Eds), World Scientific, 1996, pp 3 -26, provides an overview of the current state of the art with respect to program visualization. We aim to use pictures to convey meaning clearly and succinctly. Humans perceive pictorial representations more quickly than textual ones. Aim is to help programmers synchronise their mental model of the executing program with reality. Knowledge of code decays as the software ages and the original programmers and design team move on. CS 351 - Software Engineering (AY 2007) 3

Principle of immediacy • • • Minimise the separation between cause and effect. This

Principle of immediacy • • • Minimise the separation between cause and effect. This can occur in at least three dimensions: temporal, space and semantics. (“Debugging and the Experience of Immediacy”, D. Ungar, H. Lieberman and C. Fry, Communications of the ACM, Vol 40, No 4, April 1997, pp 38– 43). Temporal immediacy – In debugging it is important to reason backwards from effects to causes. Temporal immediacy helps track down faults. Spatial immediacy – Physical distance between causally related events is minimised. Events widely separated by space on the screen require users to conscientiously link them, forcing them to shift attention and putting additional strain on their short-term memory. CS 351 - Software Engineering (AY 2007) 4

Principle of immediacy • • Semantic immediacy – The conceptual distance (eg. , number

Principle of immediacy • • Semantic immediacy – The conceptual distance (eg. , number of mouse clicks) to get between semantically related pieces of information is minimised. These issues of immediacy are also relevant in program visualization. CS 351 - Software Engineering (AY 2007) 5

Program visualization model Static model Run-time control Programmer’s mental model Dynamic model Program visualisation

Program visualization model Static model Run-time control Programmer’s mental model Dynamic model Program visualisation Correspondence searching CS 351 - Software Engineering (AY 2007) Executing program model 6

Basic properties • Three basic properties of software can be visualized: – Software structure.

Basic properties • Three basic properties of software can be visualized: – Software structure. – Run-time behaviour. – The code itself. CS 351 - Software Engineering (AY 2007) 7

Ideals • The ideals of a visualization system are: – From the system’s perspective:

Ideals • The ideals of a visualization system are: – From the system’s perspective: • Scalability. • Extensibility. • Portability. – From the user’s perspective: • Minimal disturbances to the user’s program. • Little or no programmer intervention. • Handle real-world problems. • Present the “right” things to the user. CS 351 - Software Engineering (AY 2007) 8

The “right” things • • • Provide multiple views of multiple facets of the

The “right” things • • • Provide multiple views of multiple facets of the program. Give information to the user rather than rationalise it. Let the user discover things about the program. Appear aesthetically pleasing, but not use graphics as mere decorations. Organise information appropriately - hierarchical views, for example. Provide the user with appropriate control over the views to navigate quickly. CS 351 - Software Engineering (AY 2007) 9

Mechanisms • • • Instrumentation and data collection are the first steps. Instrumentation is

Mechanisms • • • Instrumentation and data collection are the first steps. Instrumentation is often done through the insertion of probe statements into the user code. This can cause perturbations in the behaviour and timings of the user code – this is inevitable, but should be minimised. Visualizations may be provided to the user on-the-fly or via a postmortem analysis. Post-mortem analysis allows the collected data to be manipulated before it is displayed to the user (eg. , reordering, clustering, …) CS 351 - Software Engineering (AY 2007) 10

Displays • • May be related to the static structure of the code. Helps

Displays • • May be related to the static structure of the code. Helps the user relate dynamic behaviour to the static code. Graph-based – Generally used for simulating, and representing program activities. Statistics-based – Typically used for showing performance data. Source-code related – The source code structure is presented through flowcharts and Nasi-Schneiderman diagrams. CS 351 - Software Engineering (AY 2007) 11

Taxonomy Visualisation Hardware Architecture Software Uniprocessor Multiprocessor Distributed Operating Systems Programming Language Parallel CS

Taxonomy Visualisation Hardware Architecture Software Uniprocessor Multiprocessor Distributed Operating Systems Programming Language Parallel CS 351 - Software Engineering (AY 2007) 12 Application

Sample view CS 351 - Software Engineering (AY 2007) 13

Sample view CS 351 - Software Engineering (AY 2007) 13

Software visualization for debugging • • • “Software Visualisation for Debugging”, R. Baecker, C.

Software visualization for debugging • • • “Software Visualisation for Debugging”, R. Baecker, C. Di. Giano and A. Marcus, Communications of the ACM, Vol 40, No 4, April 1997, pp 44– 54. In addition to graphical representation of program behaviour, animation can be used to demonstrate algorithm behaviour. This typically requires the programmer to manually animate the algorithm! Auralisation may be another technique which can be employed to help improve program understanding? ? ? CS 351 - Software Engineering (AY 2007) 14

Software visualization for software engineering • • • “Software Visualisation in the Large”, T.

Software visualization for software engineering • • • “Software Visualisation in the Large”, T. Ball, S. G. Eick, IEEE Computer, April 1996, pp 33– 43. There is a need to visualize more than just code and behaviour in order to understand large and complex software systems. There is no reason why program visualization techniques cannot be applied to other aspects of the software engineering process: – When each line was last modified. – Which programmer wrote which sections of code. – Where bugs and bug fixes are located. – Complexity analysis (eg. , conditional nesting complexity). CS 351 - Software Engineering (AY 2007) 15

Software visualization for software engineering – Code profiling. – Execution hot spots. – Dynamic

Software visualization for software engineering – Code profiling. – Execution hot spots. – Dynamic program slicing (ie. , determine the code that impacts on a statement or procedure call within a particular program execution). CS 351 - Software Engineering (AY 2007) 16