"Java For ColdFusion Developers" is a good book to start reading about OO...
I don't think all your objects should go into one CFC, the error.cfc should handle all errors and not just those for your form, so that should be a CFC on its own IMHO. Centralized data validation is certainly a good idea, but I would store the meta data for the fields in a XML file instead of defining it by a prefix. That's all for now. ;-) Taco Fleur Tell me and I will forget Show me and I will remember Teach me and I will learn > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] On Behalf > Of Jamie Lawrence Jenner > Sent: Wednesday, 28 July 2004 8:33 PM > To: CFAussie Mailing List > Subject: [cfaussie] the big oo train, on the right track? > > > hi all, > > I am just setting out on the OO express (couldnt find any oo > books for cf, so im using action script book instead!), so i > thought i would create a group of cfcs, whcih will create a > form dynamically, validate and return any errors > automatically so i dont have to keep binding errors and data > back to the form. > > I currently have 4 objects. > > tempForm.cfc > This creates a copy of the form data values on re post, > which, if any errors are found, are bound to the form > elements when displayed to the user > > ElementBuilder.cfc > Wherever i want a form element, i invoke the makeformelement function > (below) and the function returns a html string of the form > element required. n.b During this stage, if the error object > is initialised (signifying a re post and the validator > finding an error) then the form values are taken from > tempform, instead of the values passed > (session.myName) > > #application.formbuilder.makeFormElement("name","text",20,50,s > ession.myName)# > > > Validator.cfc > This is passed the arguments collection:form, and then > validates each form element based upon a prefix it is given > s_=string, n_=numeric etc. > > Errors.cfc > If the validator finds any problems then the error object is > initialised, and gets passed the error and field name etc to > display to the user > > This just a very brief explanation, but am i on the right > track? Should all of the above be bundled into one cfc as > they are all working on the same object (theform). Is this an > ok use of a cfc function (elementbuilder > cfc) or should this really be done with a custom tag? > Personally, as the function is returning 1 value, it seems > ok. just after some views on it thats all. I havent got any > cf chums you see, my friends work on the dark side (asp.net), > cfug in uk is not very good :-( > > Also, if OO programming is the future, then why arent there > any books for cf out there. I have many books on cf, and each > one has about two pages on oop, "this is an object, this a > class", but they really dont explain the real benefits of > oop, and how cf fits in. i spent a year learning how ot > program in cf (the traditional way) and it was only once i > found cfaussie that i found there was a better way! The right > way! the OOP way! But if there had been a book out there on > oop when i took up cf, then i would have got it then, and be > good at it now! > > Sorry went off on one there! > > > cheers in advance! > > jamo > > --- > You are currently subscribed to cfaussie as: > [EMAIL PROTECTED] To unsubscribe send a blank email to > [EMAIL PROTECTED] > Aussie Macromedia Developers: http://lists.daemon.com.au/ > --- You are currently subscribed to cfaussie as: [EMAIL PROTECTED] To unsubscribe send a blank email to [EMAIL PROTECTED] Aussie Macromedia Developers: http://lists.daemon.com.au/
