Archive - Originally posted on "The Horse's Mouth" - 2005-11-27 08:05:41 - Graham Ellis
So what exactly IS object oriented programming? Easy question to ask, but a hard one to answer in just a sentence or two. Let's try.
In an object oriented scenario, you group together all the pieces of code that relate to a certain type of data. That code grouping will be called a class and it will usually be kept in a separate file to your main programs, so that you can write a whole suite of programs that handle the same data in different ways without having to keep re-writing the low level code.
For example, this Blog might be using an "entry" class (a class is the name given to the bundle of code that relates to a type of data) so that the logic I use when I write each day is shared with the logic used to generate the pages you see when you read it on our site, and is also shared with the logic that's use if anyone calls up an XML feed.
This isn't an easy way to start writing a small and simple program, but it's great when you expand your applications. You don't have to re-invent the wheel ... and if you change the internals of a class, all your applications will just keep on running provided that you keep the calls to the class compatible with the previous ones. In other words, it's a great way of cutting maintenance costs too.
A language is described as "An object oriented language" if it has a number of extra features that weren't in languages such as Fortran, Algol and C (on which I cut my teeth) and which facilitate programming in the OO way. OO has its whole world of extra concepts and buzzwords, but to bring them all up here on a horse's mouth entry would take me beyond my challenge of telling you what OO is about in just a short item. Longer articles (part of our training notes) may be downloaded from our training notes site.