Catalogue of Artificial Intelligence Techniques


Jump to: Top | Entry | References | Comments

View Maths as: Images | MathML

Object-oriented Programming

Aliases: OOP

Keywords: C++, Smalltalk

Categories: Programming Languages

Author(s): Peter Ross

Object-oriented programming dates back to the 1960s; it developed in response to software engineers' needs to handle function overloading, data abstraction and code re-use in a clean way. In object-oriented programming one typically defines a set of classes, arranged in an inheritance hierarchy or lattice. A class is a definition; instances conforming to that definition can then be defined. Functions are attached to classes. Thus, for example, addition may be independently defined for strings and for numbers; typically a compiler or interpreter then sorts out which function is to be invoked for the expression `A+B', by considering the type of A, and in some systems also of B. A jargon has evolved with the technology: for example, a `method' is a function definition, a `message' is a function call. Free variables in function definitions refer to variables named in the class definition to which the function is attached, or in any class from which that class inherits. There are many extensions to the basic idea sketched here. Object-oriented programming is of clear relevance to AI, not only because of AI's software engineering requirements but also from a knowledge representation perspective. KRL (qv) and its descendants have made a point of keeping data and procedures together in an object-oriented programming-like way. Many AI theories can be expressed fairly cleanly in object-oriented programming since the meaning of a message is determined by the receiver rather than by the sender. C++ is perhaps the best-known object-oriented programming language generally, CLOS (Common Lisp Object System) the most used within AI, and Smalltalk the oldest and purest. Most versions of Lisp, Prolog and Scheme now have object-oriented programming features built in or available as extensions.



Add Comment

No comments.