Summary of Class Presentation of August 24, 1999 The class syllabus was distributed and discussed. Students should notew that due next period assignments must be typed and spell-checked. They must be handed in during the first five minutes of the class period during which they are due. In-class exercises cannot be made up, if you are not present for that class. Students should ask three relevant course-related questions per week to obtain the 12 points available each week in this category. The basic notion of object-orientation was discussed. Nearly all object-orientation workers agree on the following as being part of object-orientation: 1. Objects which contain private data and operations that manipulate that data. This is called information hiding; 2. Each object presents an interface to the other objects in its system. The private data of the object should not be accessible except through the interface; 3. That interface shows the services the object will perform and the responsibilities that object takes on; 4. Objects communicate by passing messages from one object to another. A message is a request for a service from the other object. Messages differ from function calls in that the message is to a specific object and different objects are free to interpret the message differently. This is called polymorphism; 5. Which object receives a particular message is decided during execution This is called dynamic or late binding. 6. There is a mechanism available for easy reuse of code in other objects. The most common mechanism is single inheritance, but there are four possibilities: a. single inheritance b. multiple inheritance c. delegation d. composition The most commonly used are single inheritance and composition. 7. The private data of an object or class retains values from one use of that object or class until another. Therefore, the set of data values is the state of the object or class. This state can affect the execution of operations. Hence, different uses of the same message to the same object can give different results ( because the state each uses is different). Some other phenomena are very common in object-orientation, especially the class. A class is a template, framework, or model for a set of objects. In class-based languages, classes are what the programmer writes to form a program. At execution time, one function starts execution ( either within a class in a language like Java or a standalone function in a language like C++). This function creates one or more objects of various classes and sends a message to one of those objects. As that object responds to that message, it might in turn send a message to another object and/or create additional objects and so on. During execution, a message could be sent to a class as well. Classes act like objects during execution. However, classes differ from objects in that classes are written during program-creation time. A class is static while objects are created and destroyed dynamically during execution. Some programming languages, most notably SmallTalk, provide the notion of meta-class. Each class is an object in a meta-class. Meta- classes, when available, allow the programmer to change how a class operates. The programmer can override functions in the meta-class to determine how the classes that are objects of that meta-class operate. For example, the meta-class could be changed to change how objects of the member classes create objects. C++ and Java do not provide meta-classes that the programmer can directly change.