Procedural programming: "What does the is program do?"
Object oriented programming: "What components in the real world am I modeling?"
From Booch, there are four major elements in the object-oriented model
Abstraction
Encapsulation
Modularity
Hierarchy
Abstraction
Booch defines abstraction "An abstraction denotes the essential characteristics of an object that distinguish it from all other kinds of objects and thus provide a crisply defined conceptual boundaries, relative to the perspective of the viewer."
In my mind, the "crisply defined boundaries" is important
What does this object do?
What is is responsible for?
Booch mentions
The principle of least commitment: where the interface of an object provides its essential behavior and nothing more.
The principle of least astonishment, where the abstraction of an object captures the entire behavior of some object, no more and no less.
Should a BodyPartT know how many are part of a beetle?
Booch says "Deciding on the right set of abstractions for a given domain is the central problem in object-orient design."
Encapsulation
Hiding the details of the implementation of an object
Wikipedia "bundling of data with the mechanisms or methods that operation on the data. It may also refer to the limiting of direct access to some of that data, such as an object's components"
"No part of a complex system should depend on the internal details of any other part"
"Allows program changes to be reliably made with limited effort.
IE you only need to change the internals of a class, not the clients using the class.
This is achieved through information hiding or the process of hiding all information of an object that do not contribute to the object's essential characteristics.
Think about our AbilityT,
We care about abilities and related disabilities
We don't care that these are ints, and that even ones are abilities and odd ones are disabilities.
We accomplish this with private/public and .h and .cpp files.
Modularity
is a tool to reduce complexity
For us, for now, modules will be the files we break our code into.
We don't need to go any deeper here.
Hierarchy is a ranking or ordering of abstractions.
Again, for now this is enough.
But we will pick more up in another set of notes for this section.