To develop software, the object-oriented concepts need to be implemented in any high-level language. The high-level language that implements the concepts of object-oriented programming is known as an object-oriented language (also called an OO language). In general, an object-oriented language must support all or some of these OO concepts.
• Encapsulation and data hiding
• Inheritance
• Polymorphism and dynamic binding
• All built-in and user-defined data types are objects
• All operations are performed using the message passing techniques
Depending on the extent to which they support OO concepts, the OO languages are classified into several categories which are listed here.
• Pure languages: Languages that not only support but also enforce all object-oriented concepts are called pure OO languages. In these languages, everything from character and punctuations to modules is treated as an object. Smalltalk, Eiffel and Ruby are the examples of pure OO languages.
• Hybrid languages: Languages that support some (not all) of the OO concepts are called hybrid languages. Java, Python and C# are the examples of hybrid languages.
• Multi-paradigm languages: Languages that support many programming paradigms (such as procedural programming, generic programming, etc.), one of which is object-oriented paradigm are called multi-paradigm languages. c++ is the example of multi-paradigm language.
• Object-based languages: Languages that support the concept of abstract data types and also other OO concepts like encapsulation, data hiding and operator overloading are known as known as object-.based languages. However, these languages do not support the concept of inheritance and dynamic binding. Ada and Modula-2 are the examples of object-based languages.
An evaluation and comparison of some of the popularly used programming languages, based on the OO concepts they support, is listed in Table
There is no fixed rule or principle based on which a particular language can be chosen for developing software. The decision of choice of language entirely depends on the characteristics and basic needs of the application to be developed, re-usability of the existing code, the impact of the organization on the choice of the programming language and various other aspects. However, C++ is the most successful and widely used general-purpose OO language.
We’ll be covering the following topics in this tutorial:
Advantages of OOP
The object-oriented programming paradigm came into use as it overcomes certain limitations of other conventional programming paradigms like the structured and unstructured paradigms. The new and advanced features of OOP such as encapsulation, abstraction, inheritance, and polymorphism help in developing high-quality software. The high-quality software can be developed due to its certain advantages. Some of the advantages of OOP are listed here.
• In OOP, writing programs with the help of objects is much similar to working with real-world objects. That is, the real world objects can be conveniently represented in a program which reduces the complexity of the program and also makes the program structure clear.
• In object-oriented programs, each object is an independent and separate entity which makes modifications, locating and fixing problems in a program an easy task. In addition, any changes made inside the class do not affect the other parts of a program. Thus, object-oriented programs are easy-to-write and easy-to-maintain.
• In object-oriented programming, data integrity and data security is high as it focuses on the data and its protection from manipulation by different parts of the program. As a result, object-oriented programs are less error-prone, more reliable and secure.
• Object-oriented programs are easy to extend as new features in a program can be added easily by introducing a few new objects without modifying the existing ones.
• Object-oriented programming allows re-usability of code. That is, the objects created in one program can be re-used in other programs. In addition, new classes can be created with the help of existing ones using inheritance. It leads to faster software development and high-quality programs.
• Object-oriented programs are easier to adapt and scale, that is, large system can be created by assembling re-usable subsystems.
Applications of OOP
Since 1960, when Simula-67 was developed, object-oriented paradigm has touched many major application areas of software development. Some of the application areas where OOP has been used to develop software are listed here.
• Simulations and Modeling: Simulation is the technique of representing the real world entities with the help of a computer program. Simula-67 and Smalltalk are two object-oriented languages are designed for making simulations.
• User-interface design: Another popular application of OOP has been in the area of designing graphical user interfaces such as Windows. C++ is mainly used for developing user-interfaces.
• Developing computer games: OOP is also used for developing computer games such as Diablo, Startcraft and Warcraft III. These games offer virtual reality environments in which a number of objects interact with each other in complex ways to give the desired result.
• Scripting: In recent years, OOP has also been used for developing HTML, XHTML and XML documents for the Internet. Python, Ruby and Java are the scripting languages based on object-oriented principles which are used for scripting.
• Object Databases: These days OOP concepts have also been introduced in database systems to develop a new DBMS named object databases. These databases store the data directly in the form of objects. However, these databases are not as popular as the traditional RDBMS.
Some other areas of applications include office automation systems, decision support systems, Artificial Intelligence (AI) and expert systems, Neural networks and parallel programming, and Computer-Aided Design (CAD) systems.