In an OOP design phase strategy,

Any physical/conceptual object of a system can be modeled(considered) as computational object in your OOP designed program based on below two conditions:

First case: That physical/conceptual object of a system must have it's local state and that state changes over time.


Second case: that physical/conceptual object of a system may or may not have it's local state but that same object must influence the state of other physical/conceptual object of a system through interactions.

Above two cases are also supported here, which says: Viewing objects as finite state machines

To illustrate above two cases, below is the object model diagram and class diagram of coin flipping game.

class Coin and class Player type objects, have local state coinOption, as mentioned in first case. class CoinGame type object has no local state but influence the state of other objects(of type Player and Coin), as mentioned in second case.

enter image description here

As per second case, class CoinGame type object influences the state of other objects of type Player and Coin through below interactions, but class CoinGame type object itself does not have local state on it's own.

enter image description here

So, class CoinGame does not maintain any local state and has composite relation with Player and Coin, as per below java code.

public class CoinGame {

        Player[] players = new Player[2];

        Coin theCoin = new Coin();

        CoinGame(String player1Name, String player2Name){

            players[0] = new Player(player1Name);
            players[1] = new Player(player2Name);


Here is the complete code in java. Above two cases are valid, when you select objects from real world. Is my understanding correct?

  • 6
    Your understanding is incorrect because there is no universally agreed definition of "computational object". There's even no universally agreed definition of OOD or OOP. The answer to your question is that any physical/conceptual object can be a computational object when it makes sense in the context of your application. Meaning that, it might make perfect sense that Person is a class in one application and be perfectly wrong in another application even though Person shows up as a domain object in both applications.
    – Dunk
    May 27, 2015 at 22:00
  • There are no rules to apply in all situations. If there were then nobody would need you or me or other programmers. Somebody could write a program that does all this by just applying rules. There are guidelines, a class has behavior and data etc...but no rules, which is what your saying there are 2 conditions. If the class helps to make your system easier to understand, either by "organizing other classes", "performing functionality" or "any other reason" then it is a legitimate computational unit. Of course some ways of deciding are better than others but that's a whole other topic.
    – Dunk
    May 27, 2015 at 22:27
  • Here's how I use domain models. I draw the domain model. Then each domain class becomes a subsystem. I then design each subsystem depending on what it needs. That could end up with a subsystem being made up of only 1 class (very rare) or a subsystem that contains 25 classes. The subsystem can even contain a class with the same name as the domain class. It all depends on what makes sense. I focus on easy to understand. Someone else might focus on easy to implement. Someone else, easy to modify. There aren't specific rules that can be applied, just application of knowledge, skill and experience.
    – Dunk
    May 27, 2015 at 22:30
  • @svidgen This query talks about the approach to clarify which realworld and conceptual objects are meaningful candidates to model as computational objects, yes. May 27, 2015 at 23:05
  • 5
    there is more than one way to write code. there is no universal 1-1 mapping between reality & code. there are misc engr tradeoffs associated with different designs. UML does attempt to formulate general rules for this analysis.
    – vzn
    May 27, 2015 at 23:26

3 Answers 3


In SICP § 1.1.2, it says:

A critical aspect of a programming language is the means it provides for using names to refer to computational objects. We say that the name identifies a variable whose value is the object.

So a computational object is simply that which is pointed to by a variable. It can be an object, a first-class function, or even a number. That's all you need to have a computational object.

As to your first two assertions, that an object can model changes through time by changing its state and/or passing messages around to other objects, those two assertions are both true.


Is my understanding correct?

No, since immutable objects (like strings in Java or C#, or tuples in Python), do not change their state over time, nevertheless they are perfectly valid examples for (computational) objects in any kind of OOP definition I know. However, those kind of objects can influence the state of other objects through interactions.

Just because objects can have a mutable state, it is not mandatory for them to have one for beeing a "valid object in the OOP sense".

  • string and tuple type objects generally are not directly associated with physical/conceptual objects of real world amidst OOD design. I have added an example for the same in my query. May 27, 2015 at 19:44
  • 2
    @overexchange: that does not matter. You can design any kind of object in an immutable way, if those objects represent "real world objects" or not. Such a design may influence run time efficiency, but not the fact you create valid "OOP objects".
    – Doc Brown
    May 27, 2015 at 19:50
  • We ordinarily view the world as populated by independent objects, each of which has a state that changes over time. An object is said to ‘‘have state’’ if its behavior is influenced by its history. sicp-section-3.1 May 27, 2015 at 20:09
  • 3
    @overexchange that assumes a 1:1 mapping between real world state and object state. It is quite common for a real world objects to be represented as something higher dimensional - for example, an object representing a ball might have an associated sequence of seven dimensional vectors representing it position and rotation in space and time. The state of the real world ball at an instant corresponds to a value in the sequence, and the state evolves over time, but the sequence does not have to be mutable to implement that. May 27, 2015 at 20:17
  • 3
    @overexchange: Code is the place where computational objects actually live, so I don't see how it's not relevant. May 27, 2015 at 20:40

The two cases/conditions, by my reading, clarify which real world and conceptual objects are meaningful candidates to model computational objects after; not whether an object or variable in-code is a computational object. And there's a large degree of subjectivity there -- it's all about whether you, the programmer, can recognize a meaningful state or interaction to model some code after.

Consider two objects:

A Cup: An attribute of a cup is its fullness, which can vary over time. We can therefore model a "computational" cup object, in that our cup object would store fullness values that can change [over time]. For instance, if we need needed a small, finite container to buffer our consumption of a resource, a cup could be a legitimate model.

Your cousin Ed: Doesn't do nothin'. Just sits, doesn't move. And never bothers nobody. Hence ... no particular value as a computational model.

  • There's a REALLY LARGE degree of subjectivity. While a Cup might sound like a great idea for a class in your current iteration, you may know that your next upgrade will have a different kind of liquid container. Thus, LiquidContainer would probably be a superior choice because you very well might get that additional functionality for free doing it that way versus having a Cup Class and then needing to create a Glass and Bucket Class later on.
    – Dunk
    May 27, 2015 at 22:42
  • @dunk sure. I noted the high degree of subjectivity, i think. That's not the point though. The point is, because I can think of a cup's state over time, I can use it as a model. Not that it's a good model, necessarily. Just that is a valid object we can "compute" with.
    – svidgen
    May 27, 2015 at 23:04
  • @overexchange did or didn't? ... "model some code after" means something like "design code that mimics its [computational] behavior"
    – svidgen
    May 28, 2015 at 13:30
  • didn't get the point "model some code after" ): May 28, 2015 at 15:16
  • From your answer, I still did not get you, whether you agree with those two conditions or not. May be, am struggling with English May 28, 2015 at 15:17

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.