wiki:path:pathView

PathView

PathView is a single-source, round-trip engineering, and model-based code editor. In other words, it presents UML-like views of classes, methods, and their relationships that are always an up-to-date view on the source code. Each editing in model or source code will change the other representation automatically in background. For that reason, it does not matter if developers favorite code or models for programming.

Description

Our PathView tool allows developers to create editable mid-level abstractions of a system under observation in form of UML-like diagrams. It ensures a synchronization mechanism between the created abstraction and the underlying source code. As soon as something changes, other entities are also updated immediately. Developers create such diagrams in an interactive and semi-automatic manner. Starting from a static (selected classes in source code) or dynamic (test cases that cover methods of specific concerns) perspective, they refine their views of classes and methods step by step. In doing so, static analysis techniques and our Type Harvester provide the necessary information for generating and syncing these diagrams automatically. Finally, these diagrams are helpful in many software engineering and maintenance activities. They provide an always up-to-date documentation in form of class diagrams; they help in program comprehension by selecting and presenting methods and classes for a specific concern at once; they allow developers to discuss about architectural decisions; and they have been shown very useful in our lectures when students have to present an overview of their implemented systems. Besides these read-only use-cases, our PathView also allows the development and refactoring of entire systems in such diagrams.

In other words, there is no difference between writing source code and model-based development and everything that is required is source code and test cases.

See also the following tutorials: Model-based Source Code Editing and Type Harvesting.

Screenshot

How to Use

  • First, you need a proper Path project that is selected as current and already harvested type information. For more information see PathProject. Note: It also works without a project and type information but then it is more manual work than necessary.
  • To start PathView choose the tool either in the world docking bar at the top (Apps -> PathView) or in the world menu (open... -> PathView).
  • After that, you will see a tool as in the screenshot above with a large white space in the middle.
  • In order to create your first diagram, open a standard source code browser, select a corresponding class within your project, and drag'n'drop it within the white area. Answer the question for automatically creating connection with yes and our analysis techniques try to create associations and inheritance relationships of this class automatically.
  • Now you can refine your diagram step by step as described below.

Note: There is a hidden feature in PathFinder that opens a complete diagram based on the covered methods of a test case. Therefore, open PathFinder and run a test case. Scroll down to the end and right-click into the white area. Click on PathView in the menu and wait a second.

User Interface

PathView's main components are a control panel on the top and a large white area below for drawing the diagram.

Control Panel

The control panel offers from left to right and top to bottom the following buttons:

  • File: Menu for storing and loading existing diagrams. Furthermore, it offers a PNG export feature and the possibility to discard an entire diagram.
  • Preferences: Link to Squeak's preferences that are related to PathView?. Description for each preference can be found by clicking on its label.
  • Extend diagram area: Request a number of pixel to extend the drawing area (downright). The existing diagram does not change but it will be more space for creating new elements.
  • Add ...: Besides drag'n'drop of classes from Squeak's source code browser, this button adds new elements to the diagram area. Developers can choose between new notes and existing classes or creating a new class.
  • Toggle labels: To limit the amount of information on a diagram, developers can select and highlight elements such as specific methods, instance variables or categories. With this button we hide all other elements and show only selected elements in the diagram. This will provide more space on the area and allows developers to focus on a specific concern. However, it also changes the layout a bit.
  • Zoom in/out: Zoom the diagram area. Please note that zooming will distort the diagram but you can fix that with the smoothing buttons. Currently, the influence of zooming etc. is quite expensive and we are working on a more efficient solution.
  • Mini-map --/++: Enables the mini-map with different sizes but also slows down the entire tool. The mini-map can be used to navigate through the entire diagram area.
  • Smoothing --/++: See Zooming, it helps to improve the visualization during zooming and the mini-map.
  • Layout: Experimental feature that tries different layout algorithm to rearrange class widgets. Please note there is no undo mechanism so far. Just try it multiple times until you are satisfied.

Drawing Area

Mostly a white area for drawing class, method, and note widgets. The interaction is done within the widgets. To create widgets apply drag'n'drop of classes from Squeak's source code browser or the Add ... button.

Class Widget and Arrows

The most important widget represents classes and offers various ways for interacting with it.

Widget
Represents classes and their content (instance variables, categories, and methods). Elements can be extended to show more information (click), highlighted (click, blue highlight color, see also toggle labels button), and extracted to create a new widget (drag'n'drop). Furthermore, classes in the same hierarchy can be merged (drag'n'drop of widgets) in order to densify the diagram. Besides standard class widgets, we offer also collection widgets. These summarize elements that are used in collections. For example, an instance variable has an ordered collection of integers. They offer the same functionality but look a bit different than the UML notation for collections.
Menus
By right-clicking on specific entities of a class widget, a menu will open and offer several possibilities to edit and refactor program entities. All operations are done with the help of Squeak's refactoring engine. Please note, these changes will also be reflected in source code, immediately.
  • Class name: Rename or delete class. Furthermore, add variables, method, and category as well as create accessors.
  • Variables: Add, rename, and delete variable. Also, create accessors.
  • Method categories: Rename category and add method.
  • Methods: Rename and delete method. Add, remove, and inline parameter.

In order to change source code, drag'n'drop the method name and edit the corresponding source code in the opened method widget.

Line
There are two kinds of lines between class widgets (based on UML). First, associations represent instance variables and their applied types. For example, in the figure above the spellChecker variable of CodeSpellChecker includes a Hunspell object. The arrow heads represent the navigation/access directions and the labels show the name and cardinality. Here, Hunspell objects are not able to access CodeSpellChecker objects through this variable. Second, inheritance relationships between classes are represented by a line with an unfilled triangle at the end.

Please note: These lines can also be used for refactoring purposes. For example, click on the arrow head of an inheritance relationship and drop it over another class.

Icon buttons
There are several buttons when hovering over the widget that allow developers to modify, highlight, and browse classes. From top and clock-wise, we offer the following functionality:
  • up arrow (top): Add the superclass as another class widget on top.
  • multiple rectangles (top): Open the class in Squeak's source code browser.
  • color wheel (top): Colorize the class widget in order to highlight specific relationships between multiple classes.
  • right arrow (right): Automatically create for each instance variable a corresponding association and class widget if type information is available.
  • note (right): Add a yellow and note that includes the existing class comment.
  • add note (right): Add a yellow and empty free text note.
  • two down arrows (bottom): Choose existing subclasses for adding another class widgets or creating a new subclass.
  • close (left): Close widget.

Method Widget

Widget
Includes the method source code of an opened method from class widget. It can be edited as known from standard source code browsers.
Line
A dashed line presents the connection to the corresponding class widget.
Icon buttons
There are two buttons.
  • asterisk (top): Enable/disable syntax highlighting of source code.
  • close (left): Close widget.

Note Widget

Widget
Includes comments and notes for a class widget. It can be filled out with class comments.
Line
A dashed line presents the connection to the corresponding class widget.
Icon buttons
Just a close button.
Last modified 3 years ago Last modified on 02/21/14 11:55:28

Attachments (5)

Download all attachments as: .zip