- •Unit ………….Object Oriented Languages.
- •Study the vocabulary
- •Read and translate the text Object Oriented Languages.
- •Characteristics of Object-Oriented Programming
- •Common Object-Oriented Languages
- •Answer the following questions about the text
- •Complete the following definitions with necessary words from the box.
- •Complete the following text using words from the box:
Characteristics of Object-Oriented Programming
Key characteristics of object-oriented programming include encapsulation and data hiding, inheritance, and polymorphism.
Encapsulation and Data Hiding. The central idea in object-oriented programming (OOP) is that the object attributes and the methods that operate on the attributes are bound together, or encapsulated, in the object. The object's methods provide the only interfaces between the object and other parts of the program. This is different from earlier languages, where any part of a program could operate on any piece of data at any time. Although this seems restrictive, the restrictions result in a more modular program that is easier to develop and less likely to contain errors. It also means it is easier to move an object to a different environment and still have it function correctly.
Inheritance. Another important concept to object-oriented programming is inheritance. An object class is defined in a hierarchy, and is said to inherit the behavior of its ancestors (those objects above it in the hierarchy).
The inheritance capability of an object-oriented language added a whole new dimension to programming. Learning an earlier high order language was mainly involved with learning the language syntax (how the language statements are constructed), which is not difficult. In an object-oriented language, learning the syntax is still necessary, but becoming familiar with the standard class hierarchies - which may include thousands of classes, each class with its own methods - is a much larger task. It is worthwhile, however, because an object inherits the attributes and behavior of its parent. A programmer can avoid unnecessary work by finding an existing object that already does most of what is needed. Then new capability can be added incrementally. The result is lower cost, higher quality software.
This characteristic also led to the inclusion of automatic documentation features in several object-oriented languages. In earlier languages, documentation was done separately. Now documentation information can be included in the object source code and used to generate a Hypertext Markup Language (HTML) document automatically, complete with hyperlinks up and down the class hierarchies, which may be viewed with an Internet browser. This makes it much easier to maintain accurate, up-to-date documentation.
Polymorphism. The next important characteristic of object-oriented language is polymorphism, which means that a descendent object does not have to respond to a message exactly like its ancestor does. A new object can override its parent's methods, which causes the new object to react to a message differently.
Common Object-Oriented Languages
Common object-oriented languages include Smalltalk, C, Java, and other languages such as BASIC and PASCAL.
Smalltalk was the original object-oriented language, developed in the early 1970s by Xerox. Since then, several variations have been introduced. It is still being used, but widespread acceptance has been hampered by the lack of a universal standard.
C+ + is an extension of the C language that provided OOP capabilities. It is probably the most widespread object-oriented language currently in use. C is a hybrid language because it compiles standard C programs; it does not require the use of objects. This enables it to take advantage of existing C software, while using object orientation for new software. C is controlled by ANSI standards.
Java is the most widely accepted pure object-oriented language. It was developed by Sun Microsystems originally as a control language for small appliances. However, it proved ideal for use with the Internet. A Java applet can be embedded in a web page. When a browser loads the web page, it also loads and displays the applet. Sun still maintains strict control of the language standard. To facilitate cross-platform operability (working on entirely different computer types without recompiling), Java is implemented in two parts. The compiler produces an object file that can only be executed by a Java Virtual Machine (JVM). A separate JVM is available for each supported operating system (Windows, Unix/Linux, or Solaris). This makes Java programs able to run on any of those systems without recompiling.
Donald M. McIver
