Win a copy of Functional Reactive Programming this week in the Other Languages forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

what each part of this program does

 
jake bellhorn
Greenhorn
Posts: 24
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


ive tried to comment on things in the program that i knew, im not sure if i got them right, what other key things in this program should i comment on, what do they do?
 
Christophe Verré
Sheriff
Posts: 14691
16
Eclipse IDE Ubuntu VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
When commenting a program, we usually try to not overcomment it. Obvious things should not be commented.
You have written : // clac is the name of the class
First, you've got the wrong class name in your comment (no big deal). But, no comment is better than a bad comment
Second, such obvious things do not need to be commented.
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Labeling variables is a start. But if you want to take this code apart to understand how it really works, I suggest that you look at each class separately. In other words, understand the different types of objects that work together in this program, examining their methods to understand what each class does.

Once you have the pieces figured out, then work through the path of execution -- looking at what is called when.

Also, there are depreciated methods here. If you compile with...

javac -Xlinteprecation PocketCalc.java

...you will generate a list of the depreciated methods. You should check the API to see what these methods have been replaced with.
[ June 20, 2006: Message edited by: marc weber ]
 
Ulf Dittmer
Rancher
Posts: 42968
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Is this a piece of code you found somewhere on the net, and are thinking about turning in for an assignment of yours?
 
marc weber
Sheriff
Posts: 11343
Java Mac Safari
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
jake, here again, you need to at least cite your source, since this code is copyrighted material...

http://www.df.lth.se/~mikaelb/PocketCalc/PocketCalc.java

(If this was submitted as an assignment, I expect a professor would recognize the code was not written in "modern" times, given the depreciated awt methods. A quick search of the internet would find several examples of this exact code.)
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic