Hotspots: Admin Pages | Turn-in Site |
Current Links: Cases Final Project Summer 2007
An Intro to Dia
Brought to you by the Squeak Assassins.
To produce the UML for our group's milestones, our group used a program called "Dia", which we heard about from two of our friends in /dev/random who had taken CS2340 the semester before us. Dia is a fairly easy to use tool, it's available free of charge, and best of all, it's already pre-installed on the Linux machines in the CoC. This makes it a great choice when your group meets in the CoC, as ours did.
Starting dia is easy: Just run "dia"! So open up Dia and follow along.
You'll be greeted by Dia's toolbar.
Before you can begin work on the class diagrams for your classes, there are two things you'll need to do. First, you need to open a new diagram. This is probably done in the fashion you'd most expect: choose the "New Diagram" option under the "File" menu.
Secondly, you'll need to put Dia into UML mode. This may not be quite as obvious. See the box labeled "Circuit"? It's actually a drop-down box, and one of the options is UML.
If you look in the bottom part of the toolbox (right under where it says UML), you'll notice lots of new UMLish icons. For example, the top-left icon is a class in UML. You'll also notice atleast a half dozen different line variants that represent the different relations in UML (inheritance, aggregation, .etc). If you scroll down far enough, you'll even see the stick figures, bubbles, and other representations used in use cases and sequence diagrams (which makes a Dia a great tool for CS2335, as well!).
Click on the top-left icon (the one that looks like a class in UML). Then, click somewhere in the diagram and – viola! – a new class is born.
To change the properties of an object, double click on it. In this case, if we double click on "class", we'll get the dialog box shown below. From here, we can change the class's name or switch to another tab for even more options.
Switch to the "Attributes" tab. From here, we can add and remove variables from the class. To add a new variable to a class, simply click "new" and then enter the appropriate information in the "Attribute data" area of the dialog box. Since Squeak is a typeless language and all variables are private, you'll just need to enter a name. By default, all variables are instance variables. If you want to indicate that a variable is a class variable (known as a "static" variable in C++/Java), check the "Class Scope" box.
Now switch to the "Operations" tab. From here, we can add and remove methods from the class. Once again, click the new button and type the name of the method in Name under "Operation data". (If this is a class rather than an instance method, check the "Class Scope" box.)
Note: Dia will automatically add () to the end of every method name. We do not know how to prevent this behavior, and if you ever figure it out, be sure to let us all know. Fortunately, however, the TAs are nice about this!
Now, place a line on the diagram. (Any line is fine. You can change the type of line later by double-clicking on it.) Note that at the end of the line, there are two small green squares. Drag one of the green squares so it's on top of one of the blue spots on the boxes, and the green square will become red – indicating that it has latched onto the box. Try moving the box. The line will now move with it!
Finally, right click on the diagram. You'll get a menu with several options, two of which are save and export. Note that we don't recommend printing directly from dia (try it and you'll see why). If you want to print a copy of the diagram, use the "export" option in the menu to export your diagram to an image file, and then open that in your favorite image editor (we recommend Gimp!) and print from there.
Well, I hope you've enjoyed this tour of Dia. It has proved to be a useful tool in CS2200, CS2335, and CS2340. In CS2200, it can be very helpful in constructing state diagrams and pipeline buffers, while in CS2335, it's great for doing use cases and sequence diagrams. Obviously it's also great for UML class diagrams, which are used in both CS2335 and CS2340.
Links to this Page
- Cases last edited on 30 July 2011 at 2:33 am by r59h132.res.gatech.edu
- UML FAQ last edited on 17 September 2003 at 11:59 am by wisconsin-lnx.cc.gatech.edu
- Squeak Assassins last edited on 22 April 2002 at 2:57 am by r69h64.res.gatech.edu
- Squeak Assassins Cases Page last edited on 28 April 2002 at 4:33 pm by adsl-80-94-187.asm.bellsouth.net