Objects - Chapter 1
“This excerpt is from the book, ‘Windows 7 Device Driver’ by Ronald D. Reeves, Published Nov 16, 2010 by Addison-Wesley Professional. Part of theAddison-Wesley Microsoft Technology Series series.l, ISBN 139780321670212, Copyright 2011. For more info please visit the publisher site: http://www.informit.com/title/0321670213 Before we go into the discussion on drivers, we need to first briefly review objects, which are mentioned extensively throughout the book. 1.1 Nature of an Object One of the fundamental ideas in software component engineering is the use of objects. But just what is an object? There doesn’t seem to be a universally accepted idea as to what an object is. The view that the computer scientist Grady Booch (1991) takes is that an object is defined primarily by three characteristics: its state, its behavior, and its identity. The fundamental unit of analysis, in most cognitive theories, is the information-processing component. A component is an elementary information process that operates on the internal representation of objects or symbols (Newell & Simon 1972; Sternberg 1977). If we look at the way these components work, they may translate a sensory input into a conceptual representation, transform one conceptual representation into another, or translate a conceptual representation into a motor output. The Object Oriented Programming (OOP) techniques for software have been around now for approximately a quarter of a century. But the phenomenon is not new. Ancient philosophers, such as Plato and Aristotle, as well as modern philosophers like Immanuel Kant have been involved in explaining the meaning of existence in general and determining the essential characteristics of concepts and objects (Rand 1990). Very recently Minsky developed a theory of objects, whose behavior closely resembles processes that take place in the human mind (Minsky 1986). Novak and Gowin (Novak and Gowin 1984) showed how objects play an important role in education and cognitive science. Their approach is one in which concepts are discovered by finding patterns in objects designated by some name. But wait, we were talking about objects and now we are talking about concepts. That is because concepts reflect the way we divide the world into classes, and much of what we learn, communicate, and reason about involves relations among these classes. Concepts are mental representations of classes, and their salient function is to promote cognitive economy. A class then can be seen as a template for generating objects with similar structure and behavior. The Object Management Group (OMG) defines a class as follows: A class is an implementation that can be instantiated to create multiple objects with the same behavior. An object is an instance of a class. From the software point of view, by partitioning the software into classes, we decrease the amount of information we must perceive, learn, remember, communicate, and reason about. 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 TypeFor 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. 1.3 Gaining an Understanding We have slowly come 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 like VB.NET or C# and their associated capabilities to create classes and objects was not enough. We realized that just using the abstract data type or class was not enough. As part of this ongoing development, the methodology called object-oriented technology evolved into 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 C++ 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 first published his book Object-Oriented Analysis and 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 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 for a time became the predominate 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 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 VB.NET or C#, 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 other objects. Let’s just 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 allows such tremendous advances in electronic system creations. Software using inheritance is certainly very small scale at the present, but the direction is set. Inheritance allows the creating of a small-scale integration (SSI) black box in software. This SSI creates 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 designed has wires between ICs, over which signals are sent. 1.4 Software Components Although 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 lays a great deal of the complexity nature of software programs. However, the software components ride on top of the hardware chips adding another complete level of abstraction. 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 synergist relationship with a human mental object. The more we dwell upon the direction of the .NET Framework’s object model, in all its technologies, the more it seems to feel like we are externalizing the mind’s use of mental object behavior mechanics. Certainly, the object relationships formed with linking and embedding of 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 its 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. Because 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 and placement in our program.
| & | | Windows 7 Device Driver

By: Ronald D. Reeves To purchase book, click on the link below: http://www.informit.com/store/product.aspx?isbn=0321670213 |