Please join us at the new JavaWorld Q&A Forums. Your existing login will work there. The discussions here are now read-only.


JavaWorld Talkback >> 958242

Pages: 1
Anonymous
Unregistered




Source
      #228 - 07/10/03 09:41 AM

This masses of source code printed would have been more
useful if the author had used proper coding conventions.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: Source [Re: Anonymous]
      #231 - 07/10/03 12:33 PM

I recognized the author, Allan Holub, immediately by his own coding conventions. He's got this thing for being able to run his code through a spell checker. Needless to say, he eschews the Java coding conventions. Obviously, the important thing to do though is to focus on the code design, not on his style.

Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: Source (coding conventions) [Re: Anonymous]
      #668 - 08/02/03 12:23 AM

I'm not sure what you mean by "proper" coding conventions. The main issues are readablity and maintenance. I personally think my code is a lot easier to read that most :-), but people seem willing to argue for hours about how to place braces. Seems silly.

It's hard for me to belive that you find the code less valueable because_I_use_underscores rather than MungingEverythingTogetherIntoOneWord.

Java is somewhat conflicted about the MixedUpperAndLowerCase
style versus the_underscore_style. The former comes from Pascal, the latter from C/C++. (Microsoft, by the way, adopted the Pascal style because the original Windows APIs were for Pascal! We all thought that Pascal was the language of the future back then.) Given Java's obvious connection to the C/C++ side of the world, using C/C++ naming conventions seems reasonable. The Java standard recommends PascalStyleMungingTogetherOfWords in one place, but it also permits underscores in an identifier. If underscores were evil, then why are they in the language spec?

I personally think that you should go with whichever style
makes for the best readability. I *do* run my code through a spell checker, both because I'm a lousy speller and becuase I strongly believe that identifiers should be words in a dictionary so that a non-English-speaker can maintain the code. (What's a native speaker of French going to do with 17 consonants munged together, some upper case and some not?) Nothing improves readability more than well-chosen identifiers that actually read correctly in English.

Anyway, the underscores work for me because they're treated as punctuation by the spell checker.


Post Extras: Print Post   Remind Me!   Notify Moderator  
Anonymous
Unregistered




Re: Source (coding conventions) [Re: Anonymous]
      #34890 - 08/03/06 03:47 PM

Dont you see inconsistencies in the style within the same class:

setVisible(true);
return selector.get_selected_date();

It seems like if the whole world wants to go this way, just for the heck of it you want to go the other way!


Post Extras: Print Post   Remind Me!   Notify Moderator  
Pages: 1



Extra information
0 registered and 1 anonymous users are browsing this forum.

Moderator:   

Print Topic

Forum Permissions
      You cannot start new topics
      You cannot reply to topics
      HTML is disabled
      UBBCode is enabled

Rating:
Topic views: 13542

Rate this topic

Jump to

Contact us JavaWorld

Powered by UBB.threads™ 6.5.5