Home > Articles > Programming > General Programming/Other Languages

  • Print
  • + Share This
This chapter is from the book

1.4 What Is a Software Object?

In 1976, Niklaus Wirth published his book Algorithms + Data Structures = Programs. This heightened 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. I will talk primarily about COBOL and associated .NET Framework base classes and objects in this book, because this is the main focus of this book.

When Bjarne Stroustrup published his book on C++ or C with classes, we started associating the words 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-1Figure 1–1 Abstract Data Types

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 COBOL. The algorithm or programs specify how the operations are implemented. We call these programs member functions in COBOL. The semantics specify what results would be returned for any possible input value for each member function. The syntax specifies the COBOL 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, as 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, 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."

We have slowly been coming to the realization of just what properties our program should have to make it work in solving complex real world problems. Having a new language paradigm like COBOL.NET and its associated capabilities to create classes and objects is not sufficient. We realized that just using the abstract data type or class was also not enough. So as part of this ongoing development, the methodology called object-oriented technology evolved what is called the object model. The software engineering foundation, whose elements are collectively called the object model, encompass the principles of abstraction, modularity, encapsulation, hierarchy, typing, concurrency, and persistence. The object model defines the use of these elements in such a way that they form a synergistic association.

As with any discipline, such as calculus in mathematics, we need a symbolism or notation in which to express the design of the objects. The creation of the COBOL.NET language, as an example, supplied one language notation needed to write our object-oriented programs. However, we still needed a notation for the design methodology to express our overall approach to the software development. In 1991 Grady Booch published his book, Object-Oriented Design with Applications, in which he defined a set of notations. These notations have become the defacto standard for object-oriented design. His second edition (1994) does an even better job of describing the overall object-oriented design notation and the object model. In this second edition he expresses all examples in terms of the C++ language, which has become a major language for object-oriented software development. We even have a Windows GUI tool based upon this notation to aid us in our thinking. This tool by Rational Corporation and Grady Booch was initially called ROSE. Quite a change from how calculus and its notation were initially used. We almost immediately have the same engine we wish to program on, aiding us in doing the programming. This tool has continued to evolve and is now called the Universal Modeling Language (UML).

An object (or component), then, is an entity based upon abstract data type theory, implemented as a class in a language such as COBOL.NET, and the class incorporates the attributes of the object model. What we have been describing, however, is just the tip of the iceberg relative to objects. The description so far has described the static definitions and has not talked about objects talking with one other. Let's look at one of the object model attributes, inheritance. Inheritance is our software equivalent of the integrated electronic circuit (IC) manufacturing technique of large-scale integration (LSI) that has allowed such tremendous advances in electronic system creations. Software using inheritance is certainly very small in scale at present, but the direction is set. Inheritance allows the creating of what I will call a small-scale integration (SSI) black box in software. This SSI creates what I will call an encapsulated software cluster of objects directed toward the solution of some function needed for the application. We have thus abstracted away a large amount of the complexity, and the programmer works only with the interfaces of the cluster. The programmer then sends messages between these clusters, just like the electronic logic design has wires between ICs, over which signals are sent.

While we allude to software components having an analogy to hardware chips, this is only true in a most general sense. Software components created with the rich vocabularies of the programming language, and based upon the constructs created by the programmer's mind, have a far greater range of flexibility and power for problem solving than hardware chips. Of course, therein lies a great deal of the complex nature of software programs. However, the software components ride on top of the hardware chips, adding another complete level of abstraction. I grant you that the deterministic logic involved in a complex LSI chip is very impressive. But the LSI chip is very limited in the possibility of forming any synergistic relationship with a human mental object. The more I dwell upon the direction of the .NET Framework base classes, in all its technologies, the more I feel we are externalizing the mind's use of mental object behavior mechanics. Certainly the object relationships formed with linking and embedding software objects, via interfaces, doesn't look much like the dendrite distribution of influences on clusters of neurons. But certainly now one software object is starting to effect one or more other software objects to accomplish its goal.

Let's look at a control object or collection of control objects from an everyday practical standpoint that we are using in other engineering fields. One of our early loves is the automobile. We can hardly wait to learn how to drive one. Notice we said drive one, any one. We have done such a great job on our encapsulation and interface exposure that we can learn to drive any kind and be able to drive any other kind. The automobile object we interact with has three primary interface controls: steering wheel, throttle, and brake. We realize that encapsulated within that automobile object is many internal functions. We can be assured that these control interfaces will not change from automobile object to automobile object. In other words, if we go from a General Motors car to a Ford car we can depend on the same functionality of these control interfaces.

Another characteristic of a software object is persistence. Persistence of an object is learned very early by a child. Eventually when we show a child a toy and then hide it behind our back, the child knows the toy still exists. The child has now conceptualized the toy object as part of his mental set of objects. As the programmer does a mental conceptualization of various software objects, this will lead to a high level of persistence of the objects in the programmer's mind. Since one of the main features of standard software objects is reusability, the efficiency of the programmer will continue to increase as the standard objects are conceptualized in the programmer's mental model.

Polymorphic behavior is another characteristic that can be implemented in a software object. Probably one of the earlier forms that a child realizes has different behavior, based upon form, is the chair object. The chair object is polymorphic in that its behavior depends on its form. We have rocking chairs, kitchen chairs, lounge chairs, and so on. This idea of form and related behavior has created a whole field of study called morphology. Certainly this is a key idea in how we relate cognitively to various objects. Not only does the clustering of our objects have form relationships, the internal constructs of the objects have a form relationship. There is a definite relationship between the logic flow of a program and the placement of the various meaningful chunks of a program. This is somewhat different than a pure polymorphic nature of a function, but does point out that we should be aware of the morphology of our objects and their parts.

  • + Share This
  • 🔖 Save To Your Account