in reply to Storing and organizing objects

If you need to access to your data by id and position, then you need to supply these attributes to whatever function or method returns that data.

Hiding the hash behind an accessor has achieved encapsulation because you could swap your storage medium to a disk-based hash, or a heap, or bag, or any number of other data structures or mediums that support keyed access without changing the interface.


Examine what is said, not who speaks.
"Efficiency is intelligent laziness." -David Dunham
"Think for yourself!" - Abigail
"Memory, processor, disk in that order on the hardware side. Algorithm, algorithm, algorithm on the code side." - tachyon