Software Design (CSC-223 97F)
Outline of Class 12: Tools
- A reminder that majors should see Mr. Imig to have your pictures taken
for the majors' board.
- The reading on greedy algorithms
is almost ready.
- For the first part of
you only have to recreate your fellow student's
routine (although you will do so in a separate class).
- Tony and Omar will be presenting on Monday instead of Friday.
- Anyone who hasn't made their directory readable (Kevin N., ...)
better do so asap.
- We'll spend some time today discussing a few Java issues that you
seem to be having probems with.
- I've made some fairly significant modifications to the
syllabus. We'll be doing algorithms
next week, instead of this week; and doing
make this week
instead of next week.
- In helping some of you folks (and hearing from Andrew about some of
the more common problems), it seems that there are a few more things
that we need to cover in a little more depth.
- Don't initialize non-static fields when you declare them.
Initialization (particularly initialization that involves allocation)
should be done in your constructor.
- Remember that
static (also known as "class")
variables and methods are associated
with the class as a whole (although they can also be used in conjunction
with individual objects).
- You need not create objects (instantiate the class) to use
static variables and methods.
- All the objects in a class share the static variables, so
a change in one will affect all objects.
- Non-static methods and fields can only be used in conjunction with
- You must create objects to use these methods and fields
(even if you're working within the same "class").
- Within a non-static method, you can refer to other non-static
methods and fields.
- Within a static method, you need to create an object in order
to use that object's non-static methods and fields.
main method is a static method. You can,
however, create objects in the current class for use iwthin that
- In creating constructors for subclasses, you will often want to call the
constructor of the superclass. The constructor for a superclass is called
- An odd coding tip. Rather than doing comparision with
var == value
value == var
(so that it won't compile if you mistakenly use one equal sign
instead of two).
- There's a link to the standard Java API in my home directory.
- Since RCS keeps track of a number of things, such as the author of
the latest version of your code (and even the "number" of the latest
version of your code), there's no reason for you to have to hand-code
- RCS permits you to insert a number of keywords of the
$keyword$ in your code, and replaces them
- Particularly useful ones are
- I'd caution against using
$Author$ as that only gives
you the author of the latest revision.
- Other keywords are documented in the man page for
- Even with the most modular design, there will be times that more
than one programmer will need to work on the same file (but hopefully
on different parts of the same file).
- There are also times that you might want to try different extensions to
the same piece of code.
- RCS supports version trees to accomodate these and similar
- The tree is given by the numbering hierarchy.
- The main branch of the tree has versions of the form
- Primary branches have versions of the form
- To start a new version tree, use the
-r option when you
check in a file. If you give three parts (e.g., a.b.c) to the version
number, it should start a new branch of the form a.b.c.1
- You can use
rcsmerge to merge in changes to a document
rcsdiff to compare two versions.
rcsmerge doesn't seem to work with the
fields mentioned above (at least in my tests). That is, if you use
the fields in comments,
- The form of
rcsmerge is a little odd.
rcsmerge -rrev1 -rrev2 file
finds the changes between rev1 and rev2 and
then makes those changes to the current version of the file (which
should be checked out).
- You can learn more about the rcs version tree by looking at the man
- Some of the following instructions are left purposefully vague so that you
think about how to express them in RCS.
- I also want you to get used to reading manual pages.
- Create a simple Java class with no body.
- Add it to an RCS archive (with
rcs -i and
- Add a field within that class. Check in the modified version as part
of a new branch.
- Return to the main branch.
- Add a
- Check that in as part of the main branch.
rcsdiff to compare your changes.
- Merge your two versions together.
- Try the same, but using overlapping changes.