Elgon wrote:
My conclusion is that provided that your code does things in a sensible manner, is secure and is readable and maintainable, imposing extreme or artificial coding
standards can waste more time than it saves.
It would seem that way, but as an organization gets larger, you wind up with a much greater range of ability and style. This can have a significant impact on code quality and maintainability.
Consider the following:
- Bob decides that the best way to deal with a particular issue is to use a pseudo-hash. Hmm... well, that's an experimental feature. Is it appropriate?
- Jane thinks that CGI has too much overhead, so she uses CGI::Lite. No one else uses it. Hmm...
- Irving uses incredibly descriptive sub names like grab_the_headers_and_look_for_a_id_cookie(\@headers). Well, it's descriptive and he argues that it cuts down on documentation.
- Sally hates having subs that require arguments be passed in a particular order, so she keeps writing wrappers for everyone else's code that allows her to pass a hash.
- One of the coders I work with right now refuses to declare hashes. Instead, he always declares a scalar and makes it a reference to an anonymous hash. (%hash = (); versus $hash = {};). As an interesting side note, he's gotten in trouble for writing production programs in Perl :)
Every one of the above programmers could make an argument for their particular coding practice. They may even be reasonable arguments. How do you settle issues like that? That's what coding standards are for: to remove that guesswork. I think that it does take some of the fun out of coding, but it does tend to ensure a bit of sanity in larger shops.
Cheers,
Ovid
Join the Perlmonks Setiathome Group or just click on the the link and check out our stats.
-
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.
|