Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

comment on

( [id://3333]=superdoc: print w/replies, xml ) Need Help??
Howdy!

camelCase is tolerable when there are only two words. threeWordCamelcase is pushing it. havingReallyLongAndDescriptiveSubNamesThatRunHalfwayAcrossThePage is absolutely hideous, and the basis for my deep hatred for that part of the Sun Java Coding Standards *spit*.

This was driven home recently with great force when I had cause to pore over some Java source that had method names that were three inches long with many words mashed together. It was painful to try to parse the words apart to make sense of it.

It is, generally, far better to apply the "separate dictionary words with _" constraint to all symbol names. Most human written languages (and all that use the roman alphabet, I think) rely on white space to mark the spaces between words. Mashing the words together into a long word may be very German in its application, but it destroys the normal visual markers we rely on to parse the phrase, making it much harder to read. Using underscores connects the words with a non-whitespace character, but has a visual impact of nearly zero. The contour of the tops of the characters still has zero-height area, just as it would with spaces (or close enough as to add no appreciable load to the cognitive process).

I also take exception to rules 5 and 6.

Prefixing like that will tend to obscure the substantial part of the variable name. The sigils, being single, non-alphabetic characters, are easy to cope with. However, consider the mental processing in reading "$this_aref_foo" to discern the name of the variable.

You see "this" and have to remember that this simply marks it as local to some narrower scope (but which scope? hmmm...). OK. Ignore the "this". Next you come to "aref". OK, we have an array ref, but we still don't know what it is about. Finally, we come to "foo". At last! A name conveying some sort of meaning!

Recall "Hungarian notation", by which means one prefixes the "real" name with a series of characters that encode the data type. Nasty nasty nasty. Rules 5 and 6 go down that path, whence lies much danger and peril and nasty sticky bits that go ecky ecky ptoing niiiiiwha.

yours,
Michael

In reply to Re^3: coding rules by herveus
in thread coding rules by punkish

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-03-28 18:20 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found