> On 9/7/07, Paul Vernon <[EMAIL PROTECTED]> wrote: > >
<snip> > > > OK, but you're defining the event to listener mappings somewhere then. > That's the point. To have somewhere you can look to figure out what is > going > on. I've seen apps (particularly Flash/Flex apps but it could apply to > CF as > well) where people just have an event run that calls a method and that > method raises another event, meanwhile other objects are listening to > those > events and they run, and maybe raise yet other events. This almost > instantly > turns into a spaghetti nightmare where you have absolutely no idea what > is > going on. Yes, that is the purpose of the listener, it keeps track of everything. With CF8, I'm attempting to use cfthread to make this quicker but I do have a couple of events that in-turn fire other events. This means that for these particular cases, cfthread won't work because I cannot nest thread generation. I know it was a conscious decision to disallow nested threading models in the CF8 development process to a) keep things simple and b) protect CF from poor coders using cfthread to kill the server :) but I'd rather have had a cfadmin setting to allow or disallow this feature so in shared hosted environments, nested threading would be off and for people who run their own servers, they could if they wanted to, turn nested threading on... > By giving the responsibility of registration to the init functions of > each > > object, I do not need to statically configure dependencies in an XML > file > > like you are describing for Mach-II. Instead, the entire application > > object > > hierarchy configures itself dynamically and any dependencies are > resolved > > automatically. > > > I'm not sure what you mean here. If you mean "object dependencies", I > use > ColdSpring to resolve dependencies (as well as perform AOP tasks and > proxy > generation). I'm unclear on how you could resolve all the object > dependencies by the "application object hierarchy" since CF only > supports > single inheritance. Unless you have some other, external method of > defining > this hierarchy. I have a spider object. I have a string manipulation services object. The spider object is not an instance of a strings object because it doesn't make sense in an OO fashion for it to be. However, the spider object relies heavily on the string manipulation object. In fact, many of my objects rely on services offered by the strings object. Essentially, the string manipulation object is "injected" into those objects that need it so I don't have to keep re-instantiating multiple string manipulation objects over and over again. This is extremely memory efficient as I have far fewer object instantiations within the applications object hierarchy. > Also, by using an object factory to handle the object instantiation, I > don't > > even have to worry about an object being there or not at start up. If > an > > object isn't there and a piece of code runs that has a dependency, > the > > object factory handles the instantiation of that "missing" object. > > > Factories are wonderful. Again, I use ColdSpring but rolling your own > is > always an option. > > The only static configuration I have to do for my apps is telling it > which > > features any given app has. Some clients want a newsletter manager, > some > > want and e-Commerce system. All I do is set up the objectFactory > config > > file > > as required and run the app. > > > > Because we couple this framework with a separate presentation layer > > (usually > > XHTML), most of my work these days is based on configuration, styling > and > > resource bundle editing :-)... It makes for fast development and > > turnaround > > times with a higher profit margin than building from scratch every > time. > > Every so often, a client asks for a feature that we don't have so I > still > > get to build new sets of objects and features in CF. > > > As always, separate presentation layers are a must. What you describe > sounds > similar to what Peter Bell is doing with his generation of applications > based on DSLs (domain-specific languages for anyone who might not know > the > acronym). > > I have to say though, I wouldn't attempt to do this sort of thing in > PHP > > maybe ASP.NET but not PHP... What a hateful situation that would be. > CF > > makes my life so much easier! > > > Heh, yes CF makes many things very easy. To be fair, you could totally > do > this in PHP as well. In some ways it's support for objects is better > than > CF's (static methods can be handy). (And if Vince pops in, yes, I know > BlueDragon has static methods ;-) ) > I know PHP5 is very capable of the techniques and methods we're discussing but the way it achieves them for me is an over complication of something that should be simple. Being a software engineer at heart and coming from an 6502 assembler background as a kid, moving onto C/C++, Delphi and Java as a teenager, student and now for the last 1- years, professional, my use and understanding of OO languages, technologies and methodologies goes back over 15 years. Controversial though it may be, I don't think CF is an OO language. It is based on Java which is an OO language but I find having programmed in many OO languages and many *Object Based* languages, CF seems to me to fall into the latter classification. Paul ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~| Get the answers you are looking for on the ColdFusion Labs Forum direct from active programmers and developers. http://www.adobe.com/cfusion/webforums/forum/categories.cfm?forumid-72&catid=648 Archive: http://www.houseoffusion.com/groups/CF-Talk/message.cfm/messageid:288013 Subscription: http://www.houseoffusion.com/groups/CF-Talk/subscribe.cfm Unsubscribe: http://www.houseoffusion.com/cf_lists/unsubscribe.cfm?user=11502.10531.4

