I also avoid this because of the instantiation cost in CF. I have a system where I treat every property of a bean as an object so that I can give it rich properties for being able to self validate and the like. However, my implementation is via a collection of singleton ³Custom Data Type² classes which I use to handle the richer property methods (I encapsulate all of this nastiness within my beans). The reason I take this approach is because in CF, even with the speed up, if you¹d displaying 100 objects each of which have 15 properties, I really don¹t want the overhead of instantiating 1500 objects just to display the list.
Best Wishes, Peter On 11/11/07 7:29 PM, "Sam Larbi" <[EMAIL PROTECTED]> wrote: > > > On Nov 9, 2007 9:23 PM, Alan Livie <[EMAIL PROTECTED]> wrote: >> >> I was doing some validation inside a CFC 'bean' and wanted to validate >> the email address. >> >> I didn't want the email validation inside the bean itself as I know >> I'll be needing email validation in other beans very soon. >> >> I was going to put the email validation method in a generic >> 'validation utilities' cfc and compose it into my beans that needed >> it. >> >> I then remembered something from the Kent Beck book on Test Driven >> Development where he mentioned he made a class called 'Money' that >> acted almost like a custom data type with basic behaviour. He said >> small objects were not only acceptable, they were desirable (or >> something along those lines). >> >> Bearing this in mind I think maybe a simple bean called Email that can >> be injected into other beans that need it and only methods it would >> have was a getter, a setter and validate() >> >> I'd be interested what others think about this. Is it a good way to go >> or is it overkill? > > I think it's a good practice. I also think the reason we didn't see more of > this from our OO experts in the past is because the computational cost of > using CFCs was high enough that we might fear having too many small types like > this. > > With improved performance, I would expect we'll see more of it, though it may > take a while to break the chains of habit. > > Sam > > > > > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "CFCDev" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/cfcdev?hl=en -~----------~----~----~----~------~----~------~--~---
