jQuery in Action, 3rd edition
The moose likes Cattle Drive and the fly likes Assignment 1.1 - Number Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Assignment 1.1 - Number" Watch "Assignment 1.1 - Number" New topic

Assignment 1.1 - Number

landon manning
Ranch Hand

Joined: Nov 20, 2000
Posts: 47
Formatting issues: Sorry about that, I thought that VisualStudios 4 was formating properly and I think it actually does. I think the problem is with hotmail. I shall look into it.
Style guide issues: "This includes final identifiers (using all upper case, as traditionally done in C, is a violation of OO abstraction)":
Please define what is ment by "OO abstraction" as it pertains to final identifiers and how using all uppercase is a violation of this.
(Don't worry, I'll adhere to the style guide, just wondering about the reasoning behind some of the style guide's style. )

Looks like this is the only time you use MAX_LINE_LENGTH/NUMBER . What did you gain by introducing MAX_LINE_LENGTH/NUMBER ?:
One of the things that I gained was readability. I can look back at my code and more easily understand what I was doing. With MAX_LINE_LENGTH in the formula as opposed to 80, I understand that the formula involves the maximumn character line length. If I only had 80 in there, I or someone who might potentially come along to read the code, must first figure out what the formula does and then figure out where I got 80. Using descriptive identifiers helps ease both of those burdens.
Landon Manning
paul wheaton

Joined: Dec 14, 1998
Posts: 20972

OO Abstraction will be covered later. The gist of it is that using all upper case has an implication with it as to the type of identifier. With OO, you want to keep things flexible for future changes. Later, you might make that a variable instead of a constant.
As to readability:
You're saying that
int namesPerLine = 80 / name.length() ;
is less readable than
int lineWidth = 80 ;
int namesPerLine = lineWidth / name.length() ;
I think it's a debatable point. So I think we can let it go.

permaculture Wood Burning Stoves 2.0 - 4-DVD set
Marilyn de Queiroz

Joined: Jul 22, 2000
Posts: 9059
I think we can let this one go.

"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
wood burning stoves
subject: Assignment 1.1 - Number
It's not a secret anymore!