Meaningless Drivel is fun!*
The moose likes Cattle Drive and the fly likes Spaced out. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Spaced out." Watch "Spaced out." New topic
Author

Spaced out.

Richard Boren
Ranch Hand

Joined: Mar 01, 2001
Posts: 233
Got a nitpick about my spacing, but I don't see the problem.
MyConstructor( String arg1, String arg2, String arg3, String arg4 )
{
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
MyConstructor( String arg1 , String arg2 , String arg3 , String arg4 )
ps we use something else here in the Netherlands to space-out
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
it was really hard for me to get accustomed to that part of the spacing... especially in the "for" loops and "import" statements. however, i do see how it makes life a lot easier in the long run.
look at the example programs in the style guide if you are not sure about a particular spacing issue. i used it this morning to check on one of my programs. they do not specifically point out a couple cases that i wondered about, but those issues are included in the programs. i also look at the instructor's solutions to see how paul handled some of the things.


what?
Richard Boren
Ranch Hand

Joined: Mar 01, 2001
Posts: 233
Originally posted by Johannes de Jong:
MyConstructor( String arg1 , String arg2 , String arg3 , String arg4 )

Strange, I've never been nitpick for this before. I guess the line "All identifiers are surounded with whitespace." from the Style Guide addresses this.

ps we use something else here in the Netherlands to space-out

And what would that be Johannes
Pauline McNamara
Sheriff

Joined: Jan 19, 2001
Posts: 4012
    
    6
Just looked at the style guide again and noticed that spaces before semi-colons is sometimes used, sometimes not:
foo( i );
start();
int theTick = 5 ;
++count ;
Doesn't matter? Only if after an identifier? I think I've been playing it safe and always used it, so haven't gotten picked...
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
The spacing issue that I stumbled over was something like this
if ( !done )
which according to the style guide should be
if ( ! done )
But I stared and stared and couldn't see it. Read through the style guide again. Resubmitted and got the same nitpick back. The nitpick was "Spacing!" -- When I finally saw the problem, I asked Marilyn if the exclamation point in the nitpick was a special clue, but she said no.
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
if you think about it, Richard, your programs must be really good and Marilyn is digging for something to nitpick! i think i got away with it a few times as well.
Michael Matola
whippersnapper
Ranch Hand

Joined: Mar 25, 2001
Posts: 1746
    
    2
Originally posted by Pauline McNamara:
Just looked at the style guide again and noticed that spaces before semi-colons is sometimes used, sometimes not:
<snip>
Doesn't matter? Only if after an identifier? I think I've been playing it safe and always used it, so haven't gotten picked...

Me too. I've been putting a space in before semi-colons regardless of what comes before the semi-colon, and noone's said boo.
It's taken some getting used to, but overall I really like the JavaRanch spacing conventions. (It makes my code so light and airy!)
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Pauline McNamara:
Just looked at the style guide again and noticed that spaces before semi-colons is sometimes used, sometimes not:

foo( i );
start();

int theTick = 5 ;
++count ;

Doesn't matter? Only if after an identifier? I think I've been playing it safe and always used it, so haven't gotten picked...

The rule is spacing around identifiers (including between identifier and punctuation). Other spacing regarding punctuation is left to the discretion of the author.

JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Michael Matola:
... The nitpick was "Spacing!" -- When I finally saw the problem, I asked Marilyn if the exclamation point in the nitpick was a special clue, but she said no.

Well, I guess it was a clue, but it was an unintentional one.
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
i think the answer is that you should put a space anytime you have a vairable or identifier that can be changed...
int i = 0 ;
if( ! done );
because you can go back and change "done" to "finished"... but if you did not have a space, you would need to type the "!" as well. not really a big deal, but that is how i think about it.
obviously, you do not need a space after the ")" in an if statement or for loop because you are only changing what is inside the "( )".
the one that really got me was not putting a space after an import statement.
[This message has been edited by Greg Harris (edited July 16, 2001).]
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9044
    
  10
Originally posted by Greg Harris:
i think i got away with it a few times as well.

I'm human, too. Sometimes I miss stuff. That is not necessarily a good thing for the student.

[This message has been edited by Marilyn deQueiroz (edited July 16, 2001).]
Greg Harris
Ranch Hand

Joined: Apr 12, 2001
Posts: 1012
oops... now i'm busted! i knew i shouldn't have posted that.
Manju Jain
Ranch Hand

Joined: Feb 08, 2001
Posts: 168
I think I must be the Number One[ dubious rank ] 'spacing' offender. I am doing Servlets-2 and still get rapped around for spacing issues. I am
sorry Marilyn , it does make me feel guilty about your unnecessary workload. I take care of spacing and stuff only when
sending email. I am in a hurry to complete the program first.
I am learning, I swear because of resubmitting assignments.
Johannes de Jong
tumbleweed
Bartender

Joined: Jan 27, 2001
Posts: 5089
Originally posted by Greg Harris:
oops... now i'm busted! i knew i shouldn't have posted that.

Man your next attempt is gone be checked for spacing like you cant believe
Paul Ralph
Ranch Hand

Joined: Aug 10, 2000
Posts: 312
I'm always getting busted for spacing.
I'm human, too. Sometimes I miss stuff.

Not on my assignments.
Paul R
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Spaced out.
 
Similar Threads
Tech Word Game
date format with MS Access database
ResultSet to Array
WA #1.....word association
How to convert byte array into string array?