0
$\begingroup$

First of all, I know objects are not meant to model the real world, although they have been marketed as such and perhaps that was an intention at some point.

Here I say 'modeling the real world' in a general sense. That includes simulations, modeling of abstract (non-real) concepts and modeling of business support applications, although I'm not sure it is appropriate to develop all of them in a single general-purpose OO language.

Under the assumption that modeling the real world in software development is a desirable and advantageous trait (not considering inappropriate models), I'm inspecting the foundations of object-oriented programming and the Simula languages.

However I'm asking this question in the hope that someone can provide a quick spoiler.

I am under the impression that objects (i.e. endurants) may not be enough to model the real world since a) their classes are static across time, e.g. a Person is always a Person, not a Child who becomes an Adult and thus his/her responsibilities and actions change b) processes (i.e. perdurants) are not first-class citizens as objects are, and c) time also is not a first-class citizen.

Aren't requirements such as these necessary for a language to properly model the real world? Why haven't they been included in the concept?

$\endgroup$
7
  • $\begingroup$ I don't think the question is answerable. It all depends what you mean by 'properly'. Once you've defined what 'properly' means, then the question presumably answers itself. It sounds like a matter of opinion what the definition of 'properly' should be. $\endgroup$
    – D.W.
    Commented Sep 8, 2020 at 7:48
  • $\begingroup$ I am confused by your a), b), and c). I see nothing in the definition of OO that would prevent an object changing its class (provided that it even has a class, since there is nothing in the definition of OO that would force an object to have a class at all), and in fact, there are many OO languages where objects don't have classes and there are many OO languages where objects can change their class. I also see nothing in the definition of OO that would stop you from modeling processes, and in fact, many OO languages do. Lastly, I see nothing in the definition of OO that would stop you from … $\endgroup$ Commented Sep 8, 2020 at 11:38
  • $\begingroup$ … modeling time. It seems to me that you have created a very specific definition of OO, and are arguing against this very specific definition that you yourself created. At least, your definition of OO doesn't seem to be congruent with the one that I learnt. $\endgroup$ Commented Sep 8, 2020 at 11:38
  • $\begingroup$ I see. I was speaking from the POV of statically-typed class-based languages and that was a mistake. Thanks for clarifying. From my understanding, many things can be modeled in OO, but only objects are natural first-class citizens (although I'm not sure now if that is a requirement for modeling domains). I'm asking if a different paradigm (other than OO) could better model domains in a more natural way for the developers/domain experts and whether b) and c) would be necessary traits for such a paradigm. And ultimately, how useful it could be compared to OO. $\endgroup$
    – Piovezan
    Commented Sep 8, 2020 at 13:45
  • $\begingroup$ Ultimately I'm asking whether my pet, uneducated notion of a paradigm (based on the idea of naturality in modeling reality) would theoretically have reasons for wide adoption, which is a bit silly, but asking doesn't hurt. $\endgroup$
    – Piovezan
    Commented Sep 8, 2020 at 14:06

2 Answers 2

3
$\begingroup$

Object-oriented programming languages are designed to support programming. Whether they "properly" model the real world is beside the point and not the primary goal. So, when you ask "why haven't [these requirements] been included?", it's likely because those weren't considered relevant or necessary to the goal of supporting programming.

It's like saying "A hammer is no good for driving in a screw; why haven't the requirements of driving screws been included in the design of a hammer?" Well, that's not what hammers are designed for.

Of course you could invent your own language that follows different principles. You'd presumably end up with something that looks different. I'm not sure you'd ever finish such a project; I suspect there would always be some aspect of the real world that isn't incorporated in the language, and at some point you'd have to accept imperfect fidelity to the real world. In any case, that would be a different project, with different design goals, so it's no surprise that it might lead to a different result.

$\endgroup$
4
  • $\begingroup$ We wrote almost the same answer within minutes of each other. 🙂 $\endgroup$ Commented Sep 8, 2020 at 7:58
  • $\begingroup$ OO reduces the semantic/representational gap between the analysis model (the conceptual model) and the design model (e.g a class diagram). Analysis and design are typically iterative and one depends on feedback from the other in order to improve. I'm asking if a paradigm more focused in reliably modeling different domains would reduce this gap even further and prove more useful than OO. Or is OO as good as it gets at that? "At some point you'd have to accept imperfect fidelity to the real world" if this gets enough upvotes, I guess I'll concede. $\endgroup$
    – Piovezan
    Commented Sep 8, 2020 at 8:37
  • $\begingroup$ @Piovezan "OO reduces the semantic/representational gap between the analysis model (the conceptual model) and the design model (e.g a class diagram)." I was taught this at university, and honestly at this point I would dispute that it's a significant value of OO. The more I've programmed in OO languages, the less I think in terms of real-world objects and the more I think in terms of capturing axes of variation. $\endgroup$ Commented Sep 8, 2020 at 15:26
  • $\begingroup$ @AaronRotenberg Do you mean axes of change? I think, if we aren't at a too high-level discussion, that one thing does not necessarily preclude the other. Capturing axes of change is important for maintainability, as is keeping the code and the design in accordance with the conceptual model (it is important to discover along with domain experts and model the right thing after all, and I think OO helps with that, although it is told to introduce other difficulties in the process). A significant value for OO from my understanding is to manage complexity (even though it also adds complexity). $\endgroup$
    – Piovezan
    Commented Sep 8, 2020 at 16:40
2
$\begingroup$

It sounds like you have already answered all of your own questions:

objects are not meant to model the real world, although they have been marketed as such and perhaps that was an intention at some point.

OOP languages—at least the commonly-used modern ones—are not designed to be databases, and their features are not designed for describing ontologies. The value of OOP is in providing a meta-abstraction (the class) which has a nice balance of record-like and module-like features. These are features that are useful for programming, not for describing reality.

If you need a one-to-one mapping of records to ontological objects, start with an RDBMS and branch out if that doesn't work for your use case. (Although, a record in an relational database theoretically represents an element of a relation between values, not a value itself—but at least you are getting closer.)

$\endgroup$
1
  • $\begingroup$ Brilliant answer: the shortcoming is not in the object, but over-marketing it. $\endgroup$
    – greybeard
    Commented Sep 10, 2020 at 6:38

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.