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

Re: Way to calculate day-of-the-week

by clueless newbie (Curate)
on Dec 24, 2014 at 13:03 UTC ( [id://1111301]=note: print w/replies, xml ) Need Help??


in reply to Way to calculate day-of-the-week

Super simple ... no modules - just a few arithmetic operations!

Day of week for an arbitrary date using core modules

Replies are listed 'Best First'.
Re^2: Way to calculate day-of-the-week
by Anonymous Monk on Dec 24, 2014 at 23:48 UTC
    Please, please, please don't encourage people to do this when there are perfectly good, well-maintained, well-tested date/time modules available to do the task. People copy-pasting or re-inventing their own date/time routines is an incredibly common source of bugs and maintenance nightmares.

      Y’see?   If you had logged-in, you would have accumulated 17 experience-points and counting.)

      This is fundamentally excellent advice.   If you “roll your own” solution to [any ...] “well-known Thing That Has Already Been Done™,” merely to avoid installing and useing a well-known CPAN module that does the entire task, then you have imposed an unnecessary maintenance burden upon the future maintainers of your code.   (“Goody for you that you now work at Google, but I’m still here ...”)   If you had used the CPAN tool, then your successors would not have to dumpster-dive into that piece of logic to be sure that you did it right to discover the subtle bug in your one-of-a-kind code.   Instead, they could have relied upon the self-tests that the CPAN module includes, knowing that the module would not have been installed at all if any of those self-tests had failed.

      Also:   if you are maintaining a legacy code-base that did these things in a particular way, e.g. using a CPAN module that you really don’t like but that does do the job correctly, please “keep using that module.”   Don’t unnecessarily introduce “two sources of Truth.”

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://1111301]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others sharing their wisdom with the Monastery: (4)
As of 2024-04-25 06:54 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found