Google Groups
Subscribe to Software Outsourcing [ Hire Dedicated Group ]
Email:
Visit this group

Wednesday, December 5, 2007

Object Oriented Prgramming (OOP) without classes!!!

Nowadays, object oriented programming (OOP) is quickly taking place over the traditional procedure oriented programming (POP). Success of the modern programming languages like C# and Java is obviously because of OOPs Power.

As all the OOP languages use CLASS or similar data structures for Object Oriented Programming, we have considered that without a "CLASS", OOP is not possible.

With the same idea in my mind, I’d briefly gone through the code base of "Drupal" - One of the most popular open source content management system and framework built with PHP language. I often read and heard many praise about the power of Drupal, but after the first look at the code base, I amazed that Drupal doesn’t use a single Class in it’s code base! Whole Drupal code base is based on just functions. As PHP, with which programming language Drupal itself is built, is also implementing many powerful OPP features, I could not understand why Drupal is not using these features!

As I’d not seen the keyword 'class' in Drupal code base, I evaluated Drupal as non-OOP as many programmers do. And that was my mistake! Even though, Drupal doesn’t contain any class like data structure, it is still Object Oriented. I realized this fact after details study of Drupal.

Actually, the OOP concept is not based on uses of data structures like CLASS. It is based on the fundamentals of features like Objects, Abstraction, Encapsulation, Polymorphism, Inheritance etc. If these fundamental features are included in programming then it can be considered in OOP.

Drupal covers all these features without classes. I also realized that the power of Drupal is hardly depends on this programming structure only. The way, how the hook system has been implemented in Drupal would never been possible with the use of Classes.

See more details about how Drupal implements Object Oriented Programming (OOP) without using Classes, visit: http://api.drupal.org/api/HEAD/file/developer/topics/oop.html