Re: Call for Votes: PEAR::Calendar
| From: | Pierre-Alain Joye | Date: | Fri, 24 Oct 2003 06:54:54 +0000 |
| Subject: | Re: Call for Votes: PEAR::Calendar | ||
| References: | 1 2 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-22943@lists.php.net to get a copy of this message | ||
On Thu, 23 Oct 2003 09:58:57 +0800
Alan Knowles <alan@akbkhome.com> wrote:
> 20 classes to do a calender is a little of an overkill (reminds me of
> the joke in an eddy murphy movie about using AK47 to shoot game)
:-)
> I like the idea of having a class to contain the date/time, but a
> single slightly larger class that handles all time/date combinations
> would make sense..
> eg.
> $date = Calendar_DateTime::make(2000,10,1);
> $datetime = Calendar_DateTime::make(2000,10,1,10,15,1);
I agree. Implementing little tiny classes in php only to strictly follow
a OO model sounds always bad to me.
> (basically it's pretty much how mktime works....)
>
> Other points (partly from the FAQ)
> - using define rather than require_once
> Thats one of the PEAR coding standards.. - you probably dont gain very
> much doing it that way.. - from what I remember they both do the same
> thing internally (look up a hash table)..
and PHP is not C. require_once and class_exists should help too here.
> It would be nice to handle non-unixtime dates like < 1970.. - but I
> guess that has to wait until we have someone bothered to write the
> algoritmns to do it...
Using Date and Date_Calc will skip the redundant implementation of
date/time validation and the calc of the days in a month and the related
things.
pierre