Friday, February 1, 2008

[2008.02.01] Object Oriented Programming

I figured as my first blog post, I should start off with the basics and work my way up.

Object Oriented Programming (OOP) is basically a method of using real world objects (table, dog, car) as a basis of designing and writing applications, i.e. write applications that take on the characteristics of everyday objects/items we are used to interacting with.

When you think of an object, you imagine that it is something real, tangible and it is something you can interact with. As such, when you are writing code that reflects objects, you want the code to 'feel' as though you are actually interacting with the actual object you are trying to model.

For instance, take a look at a person as an object. As an object and a person it will have certain characteristics or properties such as height, weight, eye color. Also, the person can also be in a certain state, such healthy, sick, bored, playful, etc. Finally, the person may exhibit certain actions or behaviors such as walking, talking and in general 'doing something'.

These three items - property, state and behavior is the basis of building an object in code.

In order for an application to be considered 'object oriented', it must follow the ideals of the Pillars of Objected Oriented Programming. These are:

[1] Encapsulation

[2] Inheritance

[3] Polymorphism

No comments: