Baz,

I generally agree.  It all gets kinda fuzzy when you throw it in ColdFusion.

Because an iterator can be anything behind the scenes it allows you to 
change the implementation details behind the interface without having to 
re-write your entire application.  Anything that implements the iterator 
interface is thus plug n play with no modifications required!  Pursuit 
of loose coupling and separation of concerns will save you a surprising 
amount of maintenance costs.

Don't swing a fly swatter at a tank, don't shoot at a mosquito with a 
cannon.  Arrays work just fine for smaller local jobs.  Use an interface 
for something that gets used everywhere.

Interestingly, CF arrays have a Java iterator interface that you can 
access in your cf code.  See Ben Nadel's post 
http://www.bennadel.com/blog/253-Leverage-ColdFusion-Array-s-Underlying-Iterator-Object.htm.


David Henry

Baz wrote:
> Is it *generally* good practice to use iterators to handle multiple 
> values for an attribute - mainly for relationships between objects - 
> rather than native types like arrays of objects or structs of objects 
> (forget about the performance issues in cf)? The problem with using 
> native types is that if you ever needed more logic, you would have to 
> replace all handling of said arrays/structs with a new object anyway. 
> So if you start out with an iterator that at first does little more 
> than encapsulate an array, atleast you are future-proofing (I use that 
> *very* lightly) the api. Agree?
>
> Cheers,
> Baz
>
>
> >

--~--~---------~--~----~------------~-------~--~----~
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
-~----------~----~----~----~------~----~------~--~---

Reply via email to