1.2 What Is a Software Object?
What is a software object? In 1976, Niklaus Wirth published his book Algorithms + Data Structures = Programs. The relationship of these two aspects heightens our awareness of the major parts of a program. In 1986, J. Craig Cleaveland published his book Data Types. In 1979 Bjarne Stroustrup had started the work on C with classes. By 1985, the C++ Programming Language had evolved and in 1990 the book The Annotated C++ Reference Manual was published by Bjarne Stroustrup. In this discussion, I will only talk about .NET Framework base classes and .NET Framework library classes with respect to objects, because that seems to be the main focus of where we are going today.
When Bjarne Stroustrup published the above book on C++ or C with classes, we started associating the word class and object with the term abstract data type. But what is the difference between data types and abstract data types? A data type is a set of values. Some algorithm then operates upon managing and changing the set of values. An abstract data type has not only a set of values, but also a set of operations that can be performed upon the set of values. The main idea behind the abstract data types is the separation of the use of the data type from its implementation. Figure 1.1 shows the four major parts of an abstract data type. Syntax and semantics define how an application program will use the abstract data type. Representation and algorithms show a possible implementation.
Figure 1.1 Abstract Data Type
For an abstract data type, we have therefore defined a set of behaviors, and a range of values that the abstract data type can assume. Using the data type does not involve knowing the implementation details. Representation is specified to define how values will be represented in memory. We call these representations class member variables in VB.NET or C#. The algorithm or programs specify how the operations are implemented. We call these programs member functions in VB.NET or C#. The semantics specify what results would be returned for any possible input value for each member function. The syntax specifies the VB.NET or C# operator symbols or function names, the number and types of all the operands, and the return values of the member functions. We are therefore creating our own data object (abstract data type) for the software to work with and use. This is opposed to only using the data types predefined by the compiler, such as integer, character, and so on. These abstract data types or objects, as defined in Grady Booch's book Object-Oriented Analysis and Design with Applications, Third Edition (2007), are as follows: "an object represents an individual, identifiable item, unit, or entity, either real or abstract, with a well-defined role in the problem domain."
Another classic book relating to objects is Design Patterns (Gamma 1995). This books points out the elements of reusable object-oriented software.