Where are all the objects?
A question that has been bugging me for a long time is: where are all the objects in Object Oriented Programming? Rather that discussing the relationships between objects, OOP is mainly concerned by the static relationship of classes. A better term for OOP is probably Class Oriented Programming…
True, tools such as UML do have object centric views (e.g. *collaboration *diagrams) but have rarely – if ever – seen them in real use on a project.
Classes form an ontology: they specify what there can be and organize meaning in a (usually) coherent manner. They are used to define what properties an object can have or must have. One problem with classes is that if we are trying to model objects in the real world we are either forced to ignore the fact the objects often change their roles and attributes, i.e. that class membership is actually dynamic (change over time). A person start life as a child with a set of properties, grow up to be an adolescent, gaining properties on the way and shedding others. As an adult the same person (object) can gain additional properties by, e.g. acquiring a job or through eduction. Of course, the lifecycle of a real world person, going through stages in life can be modeled using classes at a metalevel and then relate different instances of those classes during the various stages in life.
Using dynamic class membership by modelling class membership, roles etc using traditional OOP begs the question of why use classes at all? Classes in OOP follow a different set of rules than object instances and if classes were just plain objects to start with OOP would really become object oriented. A parallell can be seen in the XML-world were the outdated DTD’s are being replaced by XSD (schemas). Schemas are expressed in the same syntax and follow the same rules as the data it is meant to constrain. The same should hold true for objects in OOP.
Perhaps the whole thing about OOP and its static, class centric view of systems is that is done off-line and once compiled and run, basically left alone until a user (or another actor) interacts with the system through any of the defined interfaces. If an object oriented system was developed on-line in an interactive fashion objects and not classes would probably be the focus. This though raises many issues, like the relation between a development and production system and even whether there is any merit to the thought – how would such development really look like?