Stories
Slash Boxes
Comments
NOTE: use Perl; is on undef hiatus. You can read content, but you can't post it. More info will be forthcoming forthcomingly.

All the Perl that's Practical to Extract and Report

use Perl Log In

Log In

[ Create a new account ]

jtrammell (6222)

Journal of jtrammell (6222)

Thursday July 05, 2007
03:58 PM

MORE HORROR

[ #33704 ]
Also seen today, from the same author:

sub deliver_emails_for_products_and_section_types_for_users_that_have_not_already_re ceived_email {
...
}

(any errant spaces in that sub name were inserted by slashcode...)

The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
 Full
 Abbreviated
 Hidden
More | Login | Reply
Loading... please wait.
  • Unless I'm way off base, the last one was a one-liner (with 80-char lines). Please share more delicious sub body!
    • Nah, I've beat that gong once already this week. But I can tell you it contains:
      1. all lexicals defined at the top
      2. 8 positional sub arguments
      3. indirect object method calls
      4. logic 8 levels deep
      5. no unit tests
  • It could've been:

    sub defpastfuthnare {
      ...
    }
    --
    rjbs
  • I don't have a problem with long sub names themselves, though that one looks absurd.
    I can imagine using that sub, but it should apparently be broken into two subs, at least,
    if it's doing two things (delivering emails, delivering section types).

    deliver_emails_for_products would be a wrapper around deliver_emails,
    if it's delivering separate emails for several products (maybe I misunderstand it).

    deliver_section_types_for_users_that_havent_received_email
    would wrap around deliver_section_types:

    sub deliver_sectio
    • Actually, this sub doesn't really deliver any email (the code that does so is not in the lexical scope of that sub). It gathers information about email to send, then calls send_email_to_user_if_not_already_sent().

      That sub has fourteen positional arguments.

      • “If you have a procedure with 10 parameters, you probably missed some.” —Alan J. Perlis, Epigrams on Programming

  • sub deliver_emails_for_products_and_section_ types_for_users_that_have_not_already_re ceived_email {
    ...
    }

    It seems like there's a good joke here; something about how great domain-specific languages are and how "rails with rubies would make this so easy you guys" ... but it's too early in the morning for me .... see, however complex that method is, the method name reads like English! Fantastic!