Re: [PEPr] Comment on Date and Time::Date_Holidays
| From: | Lorenzo Alberton | Date: | Sun, 20 Jun 2004 14:40:18 +0000 |
| Subject: | Re: [PEPr] Comment on Date and Time::Date_Holidays | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-30956@lists.php.net to get a copy of this message | ||
Hi Stephan,
On Sun, 20 Jun 2004 15:58:06 +0200, Stephan Schmidt wrote:
>> don't store holidays in the class, but provide a method to import
>> them from a datasource (.ini file, database, whatever).
>>
> I think, the holidays should be stored and calculated inside
> drivers, as the calc rules can get quite complex. It's not always
> addition/subtraction from the easter date. That's why I recommended
> a driver-based approach to Carsten (in private)...
> Users had to learn complex rules like "the second thursday in
> November, except November 1st is a thursday"...
yes, I'm aware of it, a couple years ago I built a site heavily based on
holidays calculation, so I have a sharp idea on how hairy it all can be.
I'm certainly not suggesting to use the stupid .ini example I wrote
in the comment, and yes, an IDL language to write date rules
is probably an overkill, but I still think that hardcoding the holiday
dates in the class is a bad idea. Build a holiday management
class and a common driver interface, but don't ship baked drivers
with it (they're ok in the /examples/ dir), since they can't be
flexible enough for all users. Or maybe provide a filter() method
to remove unwanted holidays (something like a reverse composition
mechanism).
>> Internationalization management could be delegated to external
>> classes like PEAR::Translation2 [1] & [2], and Localization to
>> PEAR::I18Nv2
>
> I'd see this more like the validation errors in Quickform, which
> are stored internally, too. IMHO it would add quite some overhead
> if users had to install Translation2...
well, I designed it to be really slim and low on resources,
you should give it a try :-)
AFAICS, the current Date_Holidays class has all the translations
hardcoded in the class as well? What if I want to add another translation?
That's why I'm suggesting to delegate it to another class...
Note: I hope my remarks are taken as constructive suggestions... :-)
Regards,
--
Lorenzo Alberton
http://pear.php.net/user/quipo