demerphq

Normally I agree with your post but on this one I have to disagree. ++ for a well articulated post, I just don't agree with it. I think your argument hinges on one tiny aspect of perl - using a sub name to invoke it without any syntactic sugar. I like the sugar! I think most perl devs spend too much time playing golf - that sugar helps me. I like the visual clues. When I see bar its hard for me to know what the heck that is but when I see bar() (my pref) or &bar, I instantly know what that is.

Now for my reasoning on why subs should be after (an implicit or explicit main) - it's easier to read. I love to read - newspapers, magazines, web sites, books, code, books on code. There is a definite well designed, well thought out, and well documented approach to writing - it's called the funnel method where the first paragraph is your general outline (moving from general to hypothesis with each sentence). Succeeding paragraphs are the specifics that support your hypothesis. I strongly believe code should follow this method because coding is just another form of writing and communicating. Think about it.

Now for you personally, the subs first is great but for someone coming behind you, you're asking them to disavow every other type of writing and succumb to your approach. Much like reading a James Joyce novel, a lot of people will praise you but only a select few will read you the whole way through and even less will emulate you. Hemingway is a better approach - simple, straightforward and very little verbosity. I only ask you to think about those poor slob maintenance programmers who have to come behind you. It's much easier to start at the top and see the general outline of the writing then to skip to the last chapter.

Being able to read the code is of much greater value than how fast it runs, how few resources it uses, and definetly less than how the compiler or interpreter goes about it's business. Needless to say we definetly cannot reduce down to "See Dick Run" but we can definetly employ a straightforward, almost shaker, style as oppossed to a baroque one.

-derby

update: Also, I would never think one was an amatuer for putting sups at the bottom but I would think I was dealing with a pascal convert if I saw them up front (and I would re-arrange it).


In reply to Re: Re: where do you put your subs by derby
in thread where do you put your subs by greenFox

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



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.