[ lab01.html ]
To have compiled and tested the Person class from
[ 02.html ]
session 2 using a Makefile.
By the end of the lab you should know how to draw and print
diagrams using the Dia tool.
Dia is a simple, free, and useful diagramming tool. It runs
on UNIX and MSWindows platforms (Mac users had similar program 20 years ago).
Show us that you know how to make and run the test.Person program.
Show us some diagrams that includes at least two UML diagrams.
One is from the "Person" class we studied in class and the other
from the examples in
[ uml0.html ]
, pick one and see how well you can duplicate it.
I will start the lab with a demo of how dia and make works.
- Create a directory to work in -- lab02 would be a good name.
- Change directory to lab02
- Download these files into lab02
[ 02ex/Person.h ]
(declare class interface),
[ 02ex/Person.cpp ]
[ 02ex/test.Person.cpp ]
(unit test), and
[ 02ex/Makefile ]
(makefile for directory).
- Type the command
to compile the programs.
- Type the command
to test the code.
. . . . . . . . . ( end of section First Part) <<Contents | End>>
- Start Dia. This may be on the desktop, in a "Start" menu (under Graphics?), or
you may have to open a terminal window and type the command
The "&" means that "dia" starts up in a new window and returns
control to your terminal. You can use
the terminal and "Dia" windows at the same time.
- Wait for a "Dia" control/toolkit window to pop up.
- In the toolkit look for the drop down menu of diagram types and select UML.
- Stretch the toolkit window to see all the "UML" symbols. This is important.
- Use the "File"->"New Diagram" to start a new diagram.
- Draw a diagram of the class "Person" that you just downloaded.
- Select the "Class" icon in the toolkit and click on the diagram to create it.
- Double click on the class and change its name to "Person".
- Select the "Attributes" tab and add the two attributes -- with types.
- Select the "Operations" tab to describe the functions -- with arguments etc.
- Close the properties window to look at the result.
- If ok, use the file menu to save it.
- Draw any other diagram from my notes
[ uml0.html ]
- Select a shape in the toolkit, and use the mouse in the drawing window to
- Repeat with different figures in the tool kit.
- Select a figure by clicking on it. Right click and a menu pops up. The
Edit submenu lets you copy, cut, paste, delete, etc. the selected figure.
- Double click a symbol to see what other options are available. These are fun and useful.
- At the bottom of the toolkit is a line and arrow menu. You can
specify just about any kind of arrow or line. The left box is the first
end as you draw it, and the right hand box selects the other end. The middle
selects dots, dashes, solid, etc. Select the symbols
in the third line of the top toolkit to get lines, curves, rectilinear lines,
etc. Experiment with drawing some arrowhead lines of different types.
- When you draw a line, you can drop one end on to a blue connection point and the line will attach itself
so that when the symbol moves, so does the end of the arrow. Try this out.
- You can draw an arrow from one blue cross to another and connect two symbols.
- In the toolkit: T means Text. Try using it to add words to a diagram.
Double click text to change font.
- Double clicking most objects lets you change their colors and other properties... try this out. Creating UML classes and objects always involves
double clicking and filling in some tabs.
- When in doubt: double click a symbol to
change details. This is how you change the name of a class and add
attributes and operations. Try it!
- You can also hide attributes and operations by double clicking and
unchecking check boxes. Try this! Simplified diagrams with just names make complex
software and data bases much clearer.
- Before you print from Dia you may have to select a default printer for it to use.
Select the System Menu -> Preferences -> Hardware -> ...Printer and pick the
printer in your laboratory.
- To print a diagram, first Right Click in the drawing and pull down to
File->Page Setup In this dialog select "Fit to 1 by 1" in the scaling
section. Then "OK".
- Print by right Click->File->Print diagram.
. . . . . . . . . ( end of section Ideal Procedure) <<Contents | End>>
- To save a file: right-click the diagram and select File->Save...
- Reopen a saved file by menu File->Open in the Dia Tool window.
- Use File->Defaults/Options/Properties? menu to change things you dislike about Dia.
- To learn how to put your diagram on the web, take CSci320 with me!
. . . . . . . . . ( end of section Dia options) <<Contents | End>>
[ lab03.html ]
. . . . . . . . . ( end of section CSci202 Laboratory 02 Diagrams) <<Contents | End>>
- accessor::=`A Function that accesses information in an object with out changing the object in any visible way".
In C++ this is called a "const function".
In the UML it is called a query.
- Algorithm::=A precise description of a series of steps to attain a goal,
[ Algorithm ]
- class::="A description of a set of similar objects that have similar data plus the functions needed to manipulate the data".
- constructor::="A Function in a class that creates new objects in the class".
- Data_Structure::=A small data base.
- destructor::=`A Function that is called when an object is destroyed".
- Function::programming=A selfcontained and named piece of program that knows how to do something.
- Gnu::="Gnu's Not Unix", a long running open source project that supplies a
very popular and free C++ compiler.
- mutator::="A Function that changes an object".
- object::="A little bit of knowledge -- some data and some know how". An
object is instance of a class.
- objects::=plural of object.
- OOP::="Object-Oriented Programming",
Current paradigm for programming.
- Semantics::=Rules determining the meaning of correct statements in a language.
- SP::="Structured Programming",
a previous paradigm for programming.
- STL::="The standard C++ library of classes and functions" -- also called the
"Standard Template Library" because many of the classes and functions will work
with any kind of data.
- Syntax::=The rules determining the correctness and structure of statements in a language, grammar.
- Q::software="A program I wrote to make software easier to develop",
- TBA::="To Be Announced", something I should do.
- TBD::="To Be Done", something you have to do.
- UML::="Unified Modeling Language".
- void::C++Keyword="Indicates a function that has no return".