In this article I want to look at the essential characteristics that objects have, namely those of state, behaviour and identity. This article follows on from my my What is an Object? article of a while ago, when I offered the following definition of what an object is:
An object is a physical manifestation of a type, that executes the responsibilities of that type
That definition is just the first step and isn’t very useful by itself. This article continues a miniseries that began with my What is an Object? article. In this miniseries, I want to dig deeper, so that the above definition makes sense and thus becomes useful. I will write future articles about each of state, behaviour and identity individually, and in more detail. For now though, in order to get started, I will give just a short summary on which to build later:
State is the informational content of an object. An object’s client (usage) code perceives the object’s state as the values of its publicly exposed properties.
Identity refers to the properties of an object that make it unique; that is, the properties that distinguish it from all other objects. An object’s identity is expressed through a subset of its state.
Behaviour is the activity of an object, that is to say it is the way the object responds in interactions with its client code. Such interactions may be in the form of how the object responds to requests other objects make of it, and the notifications of changes to its state that it sends out to other objects.
That builds a little bit more on the above definition of an object, and, as I said above, I will build on it with more articles in the future in order to give a more complete picture. Unfortunately, like many aspects of software development, object oriented design and programming is not a simple topic.