CS 631 FAQ

1. What kind of software is to be used to draw sequence and
class diagram?

You can use any drawing program that you like. There are
UML tools that you can get if you want to go fancy. You can go to http://rational.com
to get a trial version of rose.Look at http://argouml.tigris.org
for a different tool. Some of the diagrams done in the past with Rose were
too fancy and hid the information in a flood of detail. You need to do use
cases, CRC cards (not part of uml), class diagrams, and
sequence diagrams. The class diagrams can be simple. They don't need
to show all class detail (especially the instance variables). This is a small
part of UML.

2. What needs to be done after the project scope document is
approved?

If you have been approved to continue then your next task
is to analyze and design your system. Start with use cases and develop them
for all of the interactions with the system. I will create a page on which
you can see each other's work as it is developed, but to make this work you
need to post your work on your project pages and tell me when you have made
changes. I will comment as we go along on things. After use cases you can
start on CRC cards. You can do something like what we did in class (coffee
machine). Once you have CRC cards you should walk through your use cases to
see that the classes you have will support your use cases and that the communication
is simple and clean. From the CRC cards you can develop class and then sequence
diagrams.

The midterm will require that you can write Java code so
you need to be sure you learn it in the first half of the course. You should
also explore internet programming in Java since the midterm may be an internet
program (probably with tcp/ip sockets). See Core Java (Horstman) and http://csis.pace.edu/~bergin/InternetProgramming.html

Two good sources are the CRC Card Book (Bellin...) and Designing
Object Oriented Software (Wirfs-Brock...). Another book is Hunt's Java for
Practitioners, though this focuses more on programming than design. There
are many more resources on the course "Student Task Page" (STP).
Note that although the techniques are different the quality criteria are the
same in OO as in structured design: cohesion, encapsulation, loose binding,
thin interfaces...

6. What are design patterns?

Design patterns are a tool for capturing expertise about
design and for improving design. For an introduction to patterns look at http://www.enteract.com/~bradapp/docs/patterns-intro.html
You can also use the Wiki Web: http://c2.com/cgi/wiki
Look especially for their find page. The wiki is the virtual meeting place
of the patterns community, actually. It will have information about many aspects
of this course including Extreme Programming.

7. What is Extreme Programming (XP)?

Extreme Programming (or XP) is a simple methodology for teams
of up to about 10 members on projects of up to about 100 person years. It
differs radically from most others. Another similar one is called Scrum. Look
on wiki. There is a good intro at http://c2.com/cgi/wiki?ExtremeProgramming.
See the book Extreme Programming Explained by Kent Beck. There is also a site
devoted to XP http://www.xprogramming.com/
It has a lot of information including an introduction to XP. Note that XP
focuses on the implementation part though, not the design part so it is for
later in the course. Scrum Methodology is discussed at http://c2.com/cgi/wiki?ScrumMethodology
and on their home site: http://www.controlchaos.com/

8. There is a lot to do in this course. How should we use our
time wisely?

You have a lot to learn and a lot to do. Take the books I've
suggested and parcel them out to your team so you can each develop an outline
of the important ideas in one book and share them with each other--in your
group and outside. Use each other and your teams to lessen the load. Again,
if you have a team you can have different people investigate the things I've
suggested you read and report back to the team. You could even organize across
teams to do this. Note that I'm treating you like professionals here, not
like students. You can/should help each other learn. You could post summaries
of what you learn in reading to one of your web sites or send it to me to
post. That would help you learn more since you will be writing as well as
reading and it would help the others too. What they do will help you. Share
out the work.

You can also have a team member serve as a consultant on
some aspect of your project, investigating it in depth and reporting to the
others. So, one member might focus on GUI stuff and another on RMI or TCP
sockets, for example.

9. How important is reuse in designing for OO? Do we need to
consider this for the project?

OO programmers/designers are learning that reuse is overrated.
A much more powerful benefit of OO is the the fact that it enables piecemeal
growth. Build a small system that works and then add to it to get a big
system. This is the XP way, actually. It has been said that no LARGE project
has ever been succesful if built in one go. All successful LARGE projects
grew out of well designed small projects. There is a LOT of evidence for this
in the telecom industry in which they depend on hundreds of millions of lines
of code. This is why Star Wars and its replacements cannot be successful.
They are huge and there is no way to build them incrementally. The wiki has
this page: http://c2.com/cgi/wiki?PiecemealGrowth

I will suggest that after midterm you build the implementation
this way. First build a small part of your project that is still end to end.
(client-server-back end) and then add features to it. You will then always
have something to show even if you come to the end of the course before you
come to the end of the project.

I will not be judging your project on how well you design
for reuse, but I will require that you do reuse the available resources, like
the Java libraries.

10. How does the midterm exam work?

I will distribute the exam by email. You will send me your
solution by email after one week. It will be a Java program to write, probably
a simple distributed program using GUI elmements and TCP sockets. The midterm
is strictly individual work. You may obtain no help from any source other
than books and the instructor. Any evidence of collaboration will be dealt
with harshly. Sorry.

11. Why do we each have to participate in the team presentations
at Midterm and at the End?

You need to learn to to presentations in front of people
to be successful in this field. If you don't the marketplace will penalize
you horribly. The university provides a safer place to get the practice and
get your feet wet as we say. One way to get really good practice is to rehearse
your presentation before you give it. Capture it on video tape if you can
and then review it.

You can use powerpoint if you like in your presentation or
use html presentations for graphics. Be sure that things are nicely visible,
however. Everyone must speak at the presentation and everyone must give some
significant part of their project if they want a decent number of points.
I will be grading your oral presentation primarily on your presentation skills
and less on content. There will be a content grade on the written work. However,
if you are boring as you speak and only give boring information, this will
affect your grade here.

Each person should cover only a part of the project, not
repeat over things done by their teammates. The purpose is so that everyone
in the class can understand everyone else's design. This will make mutual
help possible later. All your life you will be making
presentations to people who need to understand what you are doing. Mostly
so that you can continue to get paid.

12. What is a good place to learn about Client/Server and Distributed
Computing?

13. Does my communication topology need to be a star (centered
at the server) or can it be more general?

It can be more general. In RMI, for example it is relatively
easy to use a generalized interconnection topology. In effect, each remote
object is both a client and a server. An RMI application looks like one large
application and hides the fact that it is distributed. If you have a reference
to an object local or remote you can send it messages in the same way. It
doesn't matter where it is. If each "client" has a list of references to all
the other "clients" It could talk to each of them directly and wouldn't have
to relay communication thru a server (in RMI)

However, if your application needs a database to store information
persistently, a star topology may be the most useful since all communication
goes through the server which can capture it for the database. Otherwise you
may need too much redundancy to be sure information isn't lost.

14. Can we use "found code" in our project?

If you find code on the net or in a book that will help you
may use it with permission of the instructor provided that the owner of the
code also grants permission and you cite all uses explicitly.

15. How do I get a Button inside a Panel in my GUI? Do I need
inner classes for this?

Actually you don't need inner classes for this. Distinguish
between inner classes which is a programming concept and containment of GUI
elements which is a human factors design concept. A panel is a Java Component
that can contain other Components. The design pattern
is called Composite. You send the add message to the Panel giving the
button as param. Where it shows up depends on the layout manager of the panel
and the form of the add message.

Inner classes on the other hand both control
name spaces and provide a handy way to interlink tightly related objects.
An object of a (non-static) inner class has an automatic hidden link (reference)
to a specific outer class object. This is what makes inner classes so nice
for listeners. The listener has a link to the GUI it was created within as
well as to the button or whatever it is listening to. The link to the button
is done explicitly (addActionListener...). The other is implicit.

16. Should we use the Event pattern "Component
Listens to Itself" primarily?

No. You can use it, but it has a down side.
One Component per Listener is much more flexible. Component Listens to Itself
is implemented by subclassing the component and also implementing one of the
listener interfaces. This binds two kinds of code together that should usually
not be bound.

One of the objections made to Component Listens
to Itself is that the gui (display) and the actions performed on the "model"
should be separate. Read the stuff on model-view-controller for a look at
what the separation should be. Your
application minus any gui is the model. The look and feel of the screen (gui)
is one or more models. And the listeners are the controllers (MVC). All separate.

If two components need to behave in exactly
the same way (as a "business rule") then they can/should share a listener.
The pattern is "Say it Once". If Listeners can be parametrized
so that a set of components can be created to work with the same Class of
listeners then you don't need as many listener classes as you need active
components, but you need as many listener objects, generally. An example is
in a calculator where a NumberButtonListener class can be used to listen to
the 10 digit buttons. But you create 10 Listener objects from this class so
that you don't have one object doing testing to determine which button it
is handling an event for.

17. How do I handle "messages" coming from the client
to the server that need to be distributed to all the clients?

The term "message" can mean two
things. First is the message protocol of any OO system (send a message to
an object ). Second is a distributed/telecom concept( send some information
from one place (usually the client) to another (usually the server). Here
we are talking about the second kind.

I have a chat room on my site that does
this distribution. A chatroom works something like the following, and requires
that the communication be thread safe (synchronized). A client sends a message
to the server which catches the resulting "message" using a separate thread.
One thread per client. This thread is responsible only
for receiving information from the client.

When the message is received, it is passed
using sync'd communication to a broadcaster object in the server, which queues
the incoming messages from the many threads. All these threads are on the
server. The broadcaster is in its own thread also. The broadcaster then sends
the incoming messages from the queue to all clients.

You can use a LinkedList from java.util for this. It needs
to be sync'd to work in a multi-threaded environment, however. There is a
class in java.util called Collections that has a syncing "wrapper"
for linked lists and other collections. Don't confuse
Collection (root of the collection hierarchy) with Collections (lots of utility
code for working with Collection objects.

In my chat code, the Queue is much simpler.
It is just a single cell with sync'd access. If it is full and some thread
wants to insert into it, the thread blocks until it becomes empty. This is
probably sufficient for communication (slow) coming from humans unless there
are thousands of them (like at Amazon.com).

19. What level of detail do we need to show in our Class diagrams?
Inner classes? AWT code?

This depends on the level of detail needed
to define your project. I will assume that you have used inner classes for
each button, etc, so a higl level diagram is probably enough without inner
classes. However, some projects may need some of that to show how it works.
There is no reason why you can't have both a high level diagram and several
lower level ones. They are supposed to help you and others understand what
is going on, after all. The level of detail must be appropriate for that.
A low level class diagram would be
used for just some portion of your application, not the whole thing.

You may or may not need to show classes from the jdk in your
class diagram. Again this depends on the level of the diagram and what is
needed to make the design understandable. A low level supplementary diagram
can be helpful to show details fo a part of the design.

20. How fancy do the "screen layouts" need to be
in the initial design?

They don't need to be screen shots. They can be made with
any draw program. They are just mockups in the initial design documents. It
is "initial" design, after all. In particular, you don't build the
GUI to then snap shot it to show in your design. The design better preceed
the build.

21. Can we use Visual Cafe (etc) to build the GUI?

You can use these things as IDE's only, not as GUI graphic
builders. Otherwise the code will be too ugly. Don't
use any tool to draw your gui on the screen. Write it in Java. You can prototype
it on the screen, of course.

You will suffer in grading if you give me
code as ugly as produced by GUI
tools.

Another problem with GUI
tools is that if you start with them and then decide you want to modify their
code and then later decide you want to go back to the GUI
tool to change the look, it may wipe out your changes at the next save. They
only permit certain edits and wipe the rest. Very frustrating.

22. In Java is there any advantage of
declaring and initialising objects at the same time?

Yes, you can't forget to initialize if you
do it as part of declaration. Much safer and definitely preferred.Do it the other way only when necessary.

23. Do we need to use Swing or can we use AWT?

Use what works. AWT is easier, but Swing has a nice design.
Use AWT if you need to deploy Applets, however as Swing isn't well supported
yet by browsers. For deployed applications, either will do. However, use one
or the other. Don't try to mix them. That may not work correctly.