I know the experience. When I started learning programming, I needed randomly access 1 of 50 objects. So, using Excel, I created something like: obj1=new foo(1); obj2=new foo(2)..., and a giant if ... else chain.
In general what I find works for this problem is that when you are doing something that seems like it should be easier, it probably is and you should look it up or ask in a forum.
Comments
I know the experience. When I started learning programming, I needed randomly access 1 of 50 objects. So, using Excel, I created something like: obj1=new foo(1); obj2=new foo(2)..., and a giant if ... else chain.
In general what I find works for this problem is that when you are doing something that seems like it should be easier, it probably is and you should look it up or ask in a forum.