aspose file tools*
The moose likes Cattle Drive and the fly likes Style Guide questions (spaces, not indents; identifiers; operators) Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Spring in Action this week in the Spring forum!
JavaRanch » Java Forums » This Site » Cattle Drive
Bookmark "Style Guide questions (spaces, not indents; identifiers; operators)" Watch "Style Guide questions (spaces, not indents; identifiers; operators)" New topic
Author

Style Guide questions (spaces, not indents; identifiers; operators)

William Peck
Ranch Hand

Joined: Dec 18, 2009
Posts: 54
Some questions on the Style Guide at JavaRanch . . .

1.1 I understand the reasoning behind not indenting, but am I really going to hit the space bar 24 times to "tab" over 6 times ? Or will I press and hold the space bar and hope to let up just at the right spot ?
I am pretty much in code all day long and when I first tried this here at the CattleDrive, I was like, "whoa, this is going to drive me nuts !" I program in Oracle Pl*Sql most of the time, some HTML / JavaScript, and this just hit me hard as way inefficient.

2. - Identifiers
Uh, what is an Identifier ? This might qualify as "there really ARE dumb questions", but I'm not relating to what exactly is an "identifier"

3.2 y+= 100 * x;

My question is not what does this mean (although I would like to know), but my question is why use cryptic language ? The style guide makes serveral mentions of "maintenance programming" so that writing easy to read code is a good thing. Seriously, even though I've dabbled in Java for a couple of years (like only my big toe ever got wet, not even the other toes), I still stare and this and say "I have no idea what this means".


Bill in Baltimore
Katrina Owen
Sheriff

Joined: Nov 03, 2006
Posts: 1364
    
  17
William Peck wrote:
1.1 I understand the reasoning behind not indenting, but am I really going to hit the space bar 24 times to "tab" over 6 times ? Or will I press and hold the space bar and hope to let up just at the right spot ?


Most text editors will let you edit your preferences/settings so that when you hit tab it will insert n number of spaces instead.

William Peck wrote:
2. - Identifiers
Uh, what is an Identifier ? This might qualify as "there really ARE dumb questions", but I'm not relating to what exactly is an "identifier"


Examples of identifiers are: classes, interfaces, packages, constants, fields, local variables, methods, parameters, and constants

Basically things that you use to identify something else, if that made any sense whatsoever.
William Peck
Ranch Hand

Joined: Dec 18, 2009
Posts: 54
Katrina,

thank you.

re: spaces, tabs: it sounds like you do tabbing and not spaces

re: Identifiers: ok, gotcha, I think I got thrown off by "use letters ('A' through 'Z' ...) and didn't even read the next phrase ('a' through 'z'), so I was thinking ALL identifiers use CAPS to start when I knew that wasn't true.
Marilyn de Queiroz
Sheriff

Joined: Jul 22, 2000
Posts: 9047
    
  10
William Peck wrote:Some questions on the Style Guide at JavaRanch . . .

1.1 I understand the reasoning behind not indenting, but am I really going to hit the space bar 24 times to "tab" over 6 times ? Or will I press and hold the space bar and hope to let up just at the right spot ?
I am pretty much in code all day long and when I first tried this here at the CattleDrive, I was like, "whoa, this is going to drive me nuts !" I program in Oracle Pl*Sql most of the time, some HTML / JavaScript, and this just hit me hard as way inefficient.


When you are using a font like Courier or another one that is not a proportional font (like Ariel), it's pretty easy to tell when something is aligned. In Notepad, for example, that is the default. Other text editors give you a choice (e.g. TextPad). Many editors default to 8 spaces per tab, so tabbing and then converting the tabs to spaces may or may not work for you. Many text editors will automatically insert the leading spaces on the next line once you have already lined up one line.

Some fancier text editors have formatting options.


JavaBeginnersFaq
"Yesterday is history, tomorrow is a mystery, and today is a gift; that's why they call it the present." Eleanor Roosevelt
William Peck
Ranch Hand

Joined: Dec 18, 2009
Posts: 54
Marilyn, ok, thanks for the advice. I guess I will just play around with things.
Ed Connery
Ranch Hand

Joined: Mar 11, 2010
Posts: 70
Just a suggestion: I'm using jEdit, and set the option so that pressing Tab inserts four spaces, and when I hit enter the cursor is positioned at the same indentation on the next line. jEdit "speaks Java" so when the file extension is .java the editor provides color-coded syntax highlighting, when you type a left paren the right paren is instantly generated, and when you type a left brace, your next <cr> generates the matching right brace.

There are lots of Java-sensitive editors out there, this one worked for me, basically intuitively (I never had to RTFM, though there are more features out there if I did so.)
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Style Guide questions (spaces, not indents; identifiers; operators)