Friday, December 28, 2007

Object Orientedness in Web applications

The important aspects of Object Oriented Programming is as follows
1. Encapsulation : Data security
2. Polymorphism : One function several uses
3. Inheritance : Write once, use many times

Web has evolved into a global environment ranging from small scale to large scale and enterprise workflow systems. But still the approach towards web application is very ad hoc. It is not in a structured way. Some of the web frameworks support object orientedness, but to a very limited extent. In some frameworks, you can achieve Encapsulation by concept of namespaces or Inheritnace by reusing the available procedures. The concept of object orientedness is present in many web application frameworks, but it is not in a fully structured way.

OOPs concept in web applications

Encapsulation: It can be achieved in the form of classes and access specifiers. The functions defined in the class will not be accessible from outside the class unless it is explicitly defined as public. This way we can achieve better security and can be guaranteed that your code is in control of you and also in a structured way. I say structured because all the code related to one particular module is at one place i.e in a Class.

Polymorphism and Inheritance: These two work in align with each other. Assume we have an class called "Validate" which takes care of validations of some text fields. I can reuse the same functionality in my other modules with the concept of inheritance. Once I inherit the Validation class, I will have all the functions and variables available in my sub class and i dont need to write validation again for my module. I can reuse the available functions.

If my module requires more functionalites or changes in existing functionality of the module, then I can overwrite the function in my subclass. This way we can achieve polymorphism.

So on onverall, object oriented concept will defnitely help a lot in web applications and will ease the job of the developer.

No comments: