Oh I don't disagree... but don't get me wrong, I am passionately in love with OOP. I live and breathe Javascript, and I use my own custom objects and attributes there all the time. I only consider CF "structs" to not be basic because of my outdated education. The programming portion of my Bachelors was basically "Here are numbers, strings, if's, loops, and arrays. Now here is 3.5 years of how to use those data types to accomplish everything. Oh and here is some SQL.". I tought myself Javascript and Coldfusion, primarily only using CF to get my data and maintain SESSIONs. I never really got hooked on custom structs because I've never really needed them. Typically I just use JS for any dynamic objects. As for my CFC example, I'm not hell-bent on using an array. A struct is just fine as well. I was just hoping to find a solution that didn't require the user to know either. I just wanted him to be able to feed queries into the CFC. It's much more dummy-proof that way.
On Tuesday, July 10, 2012 1:16:36 PM UTC-4, websolete wrote: > I think you're missing out on one of the most basic and powerful > constructs in CF (and many other languages) then. I also think you may not > be seeing the forest for the trees. Every time you reference a url, form, > application, session, etc., variable you're working with structs. Does it > get any easier than <cfset session.loggedIn = true> ? Not by much, if at > all. > > The only difference, to me, between structs and arrays is one uses a > string for the key and the other uses a number. For your purposes of this > CFC, you're just using a 2D array as a 'container' for a few things, so > you're not going to get the performance benefit of an array vs. a struct > (arrays perform better than structs with a large number of keys). You're > also not getting the benefit of simplifying the references to the queries > contained within the 'container' by using struct notation. > > By all means, do what you're comfortable with, but to my eye, you're > adding a needless level of complexity to your code to adhere to an odd > standard of what 'basic' constitutes. > > -- online documentation: http://openbd.org/manual/ http://groups.google.com/group/openbd?hl=en
