rickers@drexel.UUCP (Rick Wargo) (12/23/87)
Netlanders... Here is a quick guide that I had put together for a just-for-the-heck-of-it Concepts of Objected-Oriented Programming Languages Course. I have not been reading the news lately, I hope this is not too out of date. I have had many requests for this in the past, but I have not been able to find it until today. I hope that it self explanatory (it should be 8-). It is structured not by topic, but by order of reference. I have found these references valuable and well worth reading. Rickers =-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=-=- Concepts of Object-Oriented Programming - from Elements Of Object-Oriented Programming Elements Of Object-Oriented Programming Geoffrey Pascoe of DoD Computing Systems Research Division (MD) Byte Magazine Volume 11 Number 8 (August 1986) pages 139-144 - information hiding - important for ensuring reliability fo software - reduces inter-dependencies - state of a software module contained in private variables accessible from only within the scope of the module - most languages support information hiding example static variables in functions in C - data abstraction - could be considered a way of using information hiding - programmer defines an abstract data type consists of an internal representation a set of routines to access and manipulate the data - dynamic binding - poly-morphism the same message can elicit a different response depending on the receiver done at runtime no need to modify existing code - inheritance - sub/super classing - automatic storage management - better known as garbage collection - should qualify as fifth important element - from ObjC Reference Manual Objective C Reference Manual 1984 - PPI Sandy Hook, CT - a computational metaphor operands replaced by objects (private data - encapsulated - operator/operand model vs. object message model - operator/operand model similar to a switchboard concept. user must select which operators to match each specific operand. plugs are the set of operators sockets are the addressable operands - message/object model no interdependencies user is responsible for knowing and respecting all data type assumptions. responsibilities user is responsible for selecting objects and telling them what to do. objects are responsible for deciding how to implement each command. - binding - user-specified binding example languages - C, Pascal, Fortran seperate routines to manipulate independent types ex. prnPoint(point) ; prnRectangle(rect) - static binding example languages - Simula, Ada, CLU programmer specifies abstract name of operation, compiler differentiates at compile time. example: print(point); print(rect) - examples container if want to add objects, need to update all switch statements for all elements in (variant) array print each one need to use switch statement depending upon data type of aray element. example of dynamic binding not reusable because all switch statements need to be updated when a new data type is added. - new basic concepts - object set of organized data/operations - class a description of whatUs shared by a group of similar objects inheritance - method how an object will perform one of its operations "a functional call" - message a request for an object to cayy out a method - operations done by objects, not to objects - a message expression - receiver identifies the object that will receive the message - selector identifies the message being sent to the receiver - arguments same as functional arguments - keywords unary - factory objects - main function creating new unitialized objects - parts of an object - shared part describes what is similar among all objects of this class methods are shared template (or structure) describing private data of each instance called the class structure - private part actual values held in each instance - methods (or behaviors) - may have format arguments - can return a value - names need not be unique across classes - not called directly by name, but by a dispatch table - can access private data of it receiver - self - available automatically to every method - identifies the object receiving the message - inheritance - a technique for organizing information into specialization/generalization hierarches - class description specifies only how the class being defined differs from some existing class (the suoerclass) - root class a generic, non-specialized class at the top of the hierarchy tree, usually specified by "Object." - code reusability - multiple inheritence "toy truck" example should it be a member of the "toy" class? should it be a member of the "truck" class? - from Smalltalk-80 - The Interactive Programming Environment Smalltalk-80 - The Interactive Programming Environment "The Orange Book" as opposed to "The Blue Book" Adele Goldberg - Xerox PARK Addison-Wesley Publishing Co. 1984 - Adele Goldberg - group manager at PARC (Software Concepts Group) - responsible for documenting the system - Larry Tesler - first introduced the system browser enriched by Dan Ingalls - General system configuration for Smalltalk - high-resolution bitmapped display screen - a typewriter keyboard - a pointing device - objects - a uniform representation of information - has "private memory" can only be manipulated by the operations in the objects interface - capability to manipulate stored info - capability to carry out some activity - objects and messages - encourages modular design - implementation of one object cannot depend on internals of another only on how they respond to messages - used to implement the entire programming environment - used to represent: numbers lists text strings dictionaries spatial locations areas text editors processes compilers debuggers and all other system components - classes - objects that respond to the same messages in the same way - objects in a group are called instances of the class - ability to create a subclass of an existing class adds new functionality adds new private memory modifies or prohibits existing functionality - advantages of Object-Oriented Programming - information known privately to an object is protected can only be accessed by methods of the object - a simple and expressive model for the relationship of parts & wholes via classes and inheritance - objects support modularity - interaction is same within all levels of complexity - message expressions - represent interactions between components of a Smalltalk system - describe receiver, selector and possible arguments - cascaded messages - multiple messages to the same object - method - describes how an object will perform one of its operations - class descriptions - a class name - the superclass of the class - a declaration of the variables to the instances - the methods used by instances to respond to messages - kinds of variables accessed by methods - instance variables exist for the lifetime of the object represent the current state of an object - temporary variables created for specific activity available only for durations of that activity represents the transitory state necessary to execute a method - class variables shared by all instances of a class - global variables shared by all instances of all classes - pool variables shared by the instances of a subset of classes in the system - metaclass - a class whose instances are themselves classes - analagous to a factory object - method determination - message is searched for in the methods of the receivers class - if not found, searched for in that classes superclass, etc. - if not found (stops at root class (Object)) that class generates the message doesNotUnderstand: (selector) - self search own methods first for message - super search superclass methods first for the message - programming involves - specification of one or more class descriptions - creating instances of the class - sequencing messages to the instances - keyword - an identifier with a trailing colon (:) - keyword message - a message with one or more arguments whose selector is made up of one or more keywords - from Software ICUs Software ICUs Lamar Ledbetter and Brad Cox of PPI Byte Magazine Volume 10 Number 6 (June 1985) pages 307-316 - Software IC - a reusable software component - encapsulation - defines a data structure and a group of procedures for accessing it - users access the data structure only through standardized interfaces carefully documented controlled - hardware world achieves a high amount of reusability - through the development of standards - operator/operand versus message/object - Hardware ICUs - custom circuits from individual components - reusability possible because chip packaging makes hardware environment independent of the detailed workings of the chip high degree of reusability through standards dynamic binding and encapsulation are at the root of reusability - division of responsibility defined and enforced through messaging - hardware components delivered in un-modifiable form - a hardware designer never starts from scratch - Software ICUs - directly support the concept of rapid prototyping - direct relationships to Hardware ICUs ideas - from A Taste of Smalltalk A Taste Of Smalltalk Ted Kaehler (Xerox PARC & Apple) Dave Patterson (University of CA, Berkeley) 1986 W.W. Norton & Co., Inc. - Smalltalk-80 is - a civilized programming environment - the premier OOPL - uniform treatment of different kinds of info - similar to Lisp in this aspect - examples text graphics symbols numbers - Smalltalk roots - where developed Developed in the Learning Research Group at XeroxUs Palo Alto Research Center (PARC) in the early 1970Us. - major ideas belong to Alan Kay also Simula Lisp SketchPad - early implementation by Dan Ingalls first person to write code for multiple overlapping windows opaque pop-up menus BitBlt - Smalltalk-80 is a "presentable" version of Smalltalk-76 - license 2 is the standard system (active) - license 1 is older (available from Apple) - methods - a Smalltalk procedure or subroutine - can have arguments message selectors a method is a procedure, a selector is the procedure name use selector to find right method to execute - a description of one of an objectUs operations not an action - objects - a package of data and procedures that belong together - like a Pascal record, but much richer - self a way of referring to the object used for recursion - all return an object as its result default is self - modular code - well established in computer science - alone does not make a program Object-Oriented - from Object-Oriented Programming for the Macintosh Object-Oriented Programming for the Macintosh Kurt Schmucker of PPI Hayden Book Company 1986 - effects of the Object-Oriented approach - significant reductions in development time size of source code - notions central to Object-Oriented programming - objects - classes - methods - inheritance - the classes protocol - set of messages of a class - a reference - an objects address - methods - call by desire message sender need not worry about anything just sends what it desires the object to do - a root class - the place for hierarchy to start - method overhead - when implemented in a sufficiently clever manner - as small as 1.75 times that of the standard procedure call - time penalty less than 10 percent - hybrid languages most so-called objected-oriented languages fall into this class. Smalltalk is a true OOL - allow to choose between an Object-Oriented approach and a conventional procedural one - make use of existing libraries - less of a culture shock - learned in less time - allow to choose between a method and subroutine call - methods - private methods used only by the class designer - basic methods very rarely (or never) overridden - class methods instance methods of the class (factory) - class instance variables - rarely used - metaclass - a classUs class - multiple inheritance - ability to be a subclass of more than one class - very powerful - examples houseboat a subclass of the classes "house" and "boat" is it a house or a boat? squares a subclass of the classes "rects" and "rhombi" circular queues a subclass of the classes "queues" and "linked lists" - primary immediate ancestor class inherits most from this class on conflict of methods, inherits from this class - searching for method now more complex tree becomes a graph (acyclic) more difficult and time consuming - existing languages that support multple inheritance Smalltalk Object Logo available for $79.95 from Coral Software ExperCommon LISP - unique instance methods - provide storage of a method in the object itself - not stored in its classUs message and method table - Object Logo demonstrates this - from The C++ Programming Language The C++ Programming Language Bjarne Stroustrup AT&T Bell Labs Murray Hill, NJ Addison Wesley Publishing Company 1986 - C++ - is a superset of the C programming language - originally called C with classes - data abstraction - partition an application into manageable pieces done by defining new data types that closely match the concepts of the application - classes - a user defined type - provides data-hiding guaranteed initialization of data implicit type conversion for user defined types dynamic typing user controlled memory management mechanism for overloading operators - features not related to classes - symbolic constants - inline substitution of functions - default function arguments - overloaded function names - free store management operators - a reference type - operator overloading - same operator has different meanings in different contexts - constructors - class initializers - destructors - class cleaner-uppers - derived classes - inheritance - friends - lets a function be the friend of two or more classes - virtual functions - defined in a derived class - overloaded function names - a certain routine is called depending upon function arguments - self reference is accomplished via the variable "this" - auto-initialization is accomplished via constructors - cleanup is done via destructors - from Usenet discussion, C++ Bjarne Stroustrup article date ???? - is a better C - argument type checking and type conversion - free store operators (new & delete) - scoped and typed constants - inline functions (function semantics with macro efficiency) - supports data abstraction - data hiding - member functions (operations on objects of a class) - constructors (optional guaranteed initialization) - destructors (optional implicit cleanup) - operator overloading (+ * / etc; and also () [] and =) - user defined type coercion - references - supports Object-Oriented programming - (single) inheritance (sub/super classes) - virtual functions (a bit like Smalltalk methods, but fast)