Object-Oriented Programming (OOP) and Object-Based Programming (OBP) share similarities in their use of objects, but there are notable differences between the two programming paradigms.
Object-Oriented Languages (OOP) follow all the concepts of OOP such as Abstraction, Inheritance, Polymorphism and Encapsulation.
Whereas Object-based languages don’t follow all the concepts of OOPs like inheritance and polymorphism. These languages do support Abstraction and Encapsulation, but the features are very limited.
Another major difference is the use of built-in objects. Object-Oriented languages do not have the inbuilt objects whereas Object-based languages have the inbuilt objects, for example, JavaScript has window object.
Module HelloWorld
Sub Main()
Console.WriteLine("Hello, World!")
Console.ReadLine()
End Sub
End Module
The above example is a simple Visual Basic program that prints Hello World to the console. It uses the built-in Console object.
class Greeting:
def __init__(self, message):
self.message = message
def display_message(self):
print(self.message)
# Creating an instance of the Greeting class
hello_world = Greeting("Hello, World!")
# Calling the display_message method to show the greeting
hello_world.display_message()
The above example is a simple Python program that prints Hello World to the console. It shows the features of Object Oriented Programming.
Differences between Object Oriented and Object Based Languages Simplified
Object Oriented Languages | Object Based Languages |
---|---|
follows all concepts of Object Oriented Programming * Encapsulation * Abstraction * Inheritance * Polymorphism | Don’t follow all the concepts of OOP like Inheritance or Polymorphism |
Don’t have any built-in objects, developers create and work with objects of built-in classes | Offer built-in objects such as window (JavaScript) |
Common Examples are C#, Java, Python etc. | JavaScript (to some extent), Visual Basic 6, and early versions of JavaScript before it became more object-oriented with ES6. |