vikas wrote:
> hey i am working on a project in which i will be requiring plenty of
> different parameters to be associated with similar objects. what is a
> better idea, to use multidimentional arrays or classes?
>
Well, "it depends" is the usual answer. Generally, though, unless you have a
compelling reason not to (an unhealthy preoccupation with performance, for
instance :-), then I would suggest separating interface from implementation and
designing an API for manipulating your data which is not dependent on the
underlying implementation. Of course, with classes you get this anyway (or
should do, at least). However, if you design the API right then the same can be
achieved with arrays and procs, which gives you flexibility to choose. I would
fairly strongly advise against passing around "raw" arrays, as then it would be
much more difficult to change the implementation. If you're willing to use 8.5,
then you also get dicts as another possible implementation.
-- Neil
Received on Sat Oct 15 03:53:55 2005