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.
In reply to Re: Storing and organizing objects
by BrowserUk
in thread Storing and organizing objects
by bobf
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |