[1645] in java-interest

home help back first fref pref prev next nref lref last post

Reading the source for information

daemon@ATHENA.MIT.EDU (Andrew Gilmartin)
Tue Sep 12 15:32:58 1995

Date: Tue, 12 Sep 95 11:25:46 EDT
To: java-interest@java.sun.com
From: ajg@cadre.com (Andrew Gilmartin)

Each distribution of java and hotjava include the source code for all
classes. This code is a far richer source of information about how to use
the classes than the documentation or the mailing list archives are. When
you have a question about how a class works, check to see if it is being
using by hotjava. Grep across the code for the class name of interest.
(There is grep for all java supported platforms and it is a principle every
programmer should know.)

When I needed to know how awt worked, I wrote a few trials. They failed, but
worse I couldn't find a pattern in the failures to help me further
understand awt. Since the documentation was not helping I looked at the
code. While I knew hotjava used awt there was way too much source to wade
through. After using hotjava a little more I noticed that the search tool
had a much simpler interface and, as it turns out, was a single source file
example of awt. Studdying SearchTool I figured out how windows a frame
related and how to use BorderLayout and RowLayout to layout my interface.
This gave me enough information to rework by failed trails and get them to
work. Once I had a foothold on awt I could then learn about each of the awt
classes in turn.

If I really wanted to know how to use the Socket class I would look at the
NetworkClient and NetworkServer classes.

Reading another programmer's code is not an easy task, but with practice it
becomes easier. Do it as often as possible. Don't be afraid to show your
work, it might help some else better understand: Simion Spero's recent
example of the Queue class showed me how to use Object's wait() and
notifyAll() to cleanly coding a data reader.

-- Andrew
--
Andrew Gilmartin
Cadre Technologies Inc.
ajg@cadre.com

-
Note to Sun employees: this is an EXTERNAL mailing list!
Info: send 'help' to java-interest-request@java.sun.com

home help back first fref pref prev next nref lref last post