One of the cool things, I think, about Smalltalk is that Classes are
objects... i.e. concrete factories that can be modified at runtime to
produce objects in different ways, depending on the runtime
situation. I just find this so much more intuitive, compared to how
classes are done in other languages...
But I think I may have used it in a naive way...
For example, I needed an Adapter class that could produce standard
Item objects by connecting to a variety of legacy database tables,
converting the non-standard item records into standard Item objects.
This way, the consumer of those Item objects doesn't care where the
items come from.
Originally, I thought I would only have to make these connections,
one at a time. I.e., I'd program the Item class 'factory' with the
legacy database hostname, username, password, and then just start
asking for Items. The Item class would then go out to the database,
fetch the proper row, create an Item object, initialize the instance
variables, and return it to the Item object consumer.
This is intuitive, cool, and it works.
Then the requirements changed and I needed to connect to multiple
database *at the same time*.
But there is only one Item class object!
This really muddles things up, because I basically have to update the
Item class variables every time I need an Item object. No longer cool!
Did I just misuse this feature? Should I have built two Adapter
Objects, instead? Am I missing something obvious? Is a little
knowledge a dangerous thing? :-)
TIA... John