There has already been some pretty good advice on approach and optimization. 

> Assuming the shipping date calculation is the only one you 
> would be doing on a regular bases for this application, 
> I think it is a bit of an overkill.
> However, there are situations when doing that is a good idea. 

Yes, I would agree this definitely falls into the realm of "it depends". But 
for some reason I keep wondering if there is not a little more involved here .. 
Either way, it is still good to consider some of the options.

Two factors I generally consider when handling dates are flexibility and 
maintainability. While there are typically base rules like "business days", 
most applications also have to deal with exceptions to those rules, like 
holidays. That is when can often make more sense to use a calendar
table. Exceptions like those are usually easier to maintain in database table, 
rather than trying to  do the equivalent in CF code. It is certainly possible, 
but it is not always easy to maintain.

Also given the availability of information, many applications quickly grow into 
the need for reporting as well. For example, how many orders were placed, what 
were the average orders in a given date period  (including days with no sales), 
etcetera. There again it is often easier to use a calendar table for those 
tasks. As code based alternatives can be much more cumbersome in certain 
situations.

Having said that, not every application needs that much flexibility. If you 
simply need to display the days of the month, a calendar table probably is not 
needed. But given some of the rules you mentioned, I suspect there may be a 
little more involved here, in which case your application _might_ benefit from 
this kind of flexibity. Either way, it is good to think broadly and consider 
what features your application may need and how easy it would be to achieve and 
maintain them with approach A versus B. So you can make an informed decision 
about the "best" approach for your application overall, with regards to 
flexibility, maintainence and performance. 

-Leigh


      

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~|
Want to reach the ColdFusion community with something they want? Let them know 
on the House of Fusion mailing lists
Archive: 
http://www.houseoffusion.com/groups/cf-talk/message.cfm/messageid:329742
Subscription: http://www.houseoffusion.com/groups/cf-talk/subscribe.cfm
Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=89.70.4

Reply via email to