[thelist] [JavaScript] Advanced JS - go OO on this or not? Hit the wall...

Tom Dell'Aringa pixelmech at yahoo.com
Wed Mar 1 14:33:59 CST 2006


I have this calendar script for a kiosk app we have. The first version was whipped together as
fast as I could build it to work. I'm now going back and optimizing and trying to make it better,
and I thought I might make it an object. I've worked on it most of the day and I've made some
progress, but I've really hit the wall on whether it's worth making an object or not, seeing as
how it works how it is now, and I don't know what I'll gain. Plus, I'm not sure how to proceed. A
quick shot of the page where the calendar is here:

(can't post a link, it's kiosk)

The thing works by grabbing some dates off an array written to the page by the server
(scheduleArray[]) and then proceeds to write out the calendar cell by cell. Only weekdays are
selectable that are not holidays, basically. 

You can see my code here:


At the bottom is my beginning of the OO experiment. 

I guess I am open to any suggestions to improve this - or stop and leave it or whatever. I've been
looking at this so long, I'm not sure what to do next! Aaaugh!

One thing that concerns me is my nested function (the getCellType() function) and how that would
be implemented in an object. It seems to me I may be using too many private/local vars when most
of the stuff might be able to be properties of the object. Note that the calendar gets rewritten
completely when you select another month or reload the page. 



Professor Rumford: 'But I still don't understand about hyperspace.' 
The Doctor: 'Well, who does?' 
K9: 'I do.' 
Doctor: 'Shut up, K9!' 

More information about the thelist mailing list