Generate UML diagrams from Smalltalk code for Pharo

Mentor: Stéphane Ducasse
Second mentor: Geert Claes
Level: Intermediate
Accepted student: Carla Griggio
Invited students: Carla Griggio, Reinout Stevens
Students interested: Carla Griggio(very), Nilesh Maaheshwari, Mikaël Smaha, Reinout Stevens

Key Features:

  • Provide a simple interface to build Class Diagrams and Sequence Diagrams and export them as images.
  • Right click on a package and generate it’s class diagram
  • Right click on a class and generate it’s inheritance tree class diagram
  • Generate sequence diagrams by executing a block 
(i.e.:  [anObject doSomeMagic] drawSequenceDiagram)
  • Generate class diagrams of the involved classes in the execution of a block.
(i.e.:  [anObject doSomeMagic] drawClassDiagram)
  • Generate the Smalltalk code that would reproduce an auto-generated diagram, in order to have the possibility to adapt those diagrams with richer information that illustrates a specific scenario (i.e.: add/remove messages from a sequence diagram or methods from a class diagram, add or remove relations from a class diagram, etc). 
  • Build a simple website where people can write code that generates an UML diagram and get the result images.

The idea would focus on static Class and Sequence diagrams, although in the future other features could be added, such as drawing an Object Diagram illustrating the relations of an object on a specific moment, adding comments or code into the diagrams, different strategies to generate diagrams (instead of just static graphics, maybe some interactive graphics or HTML), etc.

Technical Details

The student will have to integrate the functionality achieved by the framework with the coding tools already used on Pharo such as Class Browsers / Package Browsers for better usability. It would be useful to have specific tools for the project (i.e.: a window with two panes, one to preview the diagram and one for writing the code that generates it).
There are no restrictions about what technology has to be used to draw the diagrams. Part of the project consists in evaluating the different alternatives on that, and making a good choice. The generated diagrams will have to be exported as PNG / JPEG images or any format that can be easily shared and viewed.

The Smalltalk code generated with the diagrams could be useful to share diagrams “yet to be drawn” via Monticello or other forms of code sharing.

The website should be a very simple Seaside app. If the protocol to build a diagram is simple, the code that people would write in the website in order to describe the UML diagram and generate it, that code could just be Smalltalk without the need of a particular UML describing new language. Despite of this, designing a UML describing language to be used on the website can still be an option.

Benefits to the Student

  • Get involved with some “inside aspects” of the Pharo environment
  • Learn how to add features to the coding tools already working on Pharo
  • Learn how to create graphics dynamically.

Benefits to the Community

  • Have a comfortable and easy tool that helps communicating the object oriented design of a project by big or very specific parts of it.
  • Get to share diagrams as code and not just images, that way they can be easily updated and manteined if any refactor or new requirements affect them, or it could even be useful to sketch possible changes in the code.
  • Earn some popularity through the UML generation website, which could use as an introduction to Smalltalk to people who doesn't know about the language yet.

Updated: 22.3.2010