Main Content

When should I use OO techniques?

Archive - Originally posted on "The Horse's Mouth" - 2009-05-11 04:37:21 - Graham Ellis

We have two friends. They're married. She's a keen advocate of Object Oriented Programming and he can't stand the approach. So take them to the pub, buy them a couple of drinks each, mention OO programming and watch the feathers fly ;-)

Seriously, Object Oriented Programming has its place - and there are places it should not be used. Along the base of this diagram you'll find the size of application from tiny to huge, and on the left axis is the easy of writing - from trivial to impossible. The orange line represents "single block" code, the blue line is structured coding, and the black line is object oriented.

• With a single block of code, you can start coding very quickly and easily, but you'll rapidly find that it gets impractical to manage what you're doing. Like writing an article with no paragraphs.

• Structured coding is like writing a short story - there's a bit of an overhead, but the text is broken into paragraphs and it's easy enough to write and maintain up to a certain point.

• And with Object Oriented programming, you can compare with a complete book. There's considerable overhead in the initial setup, but the scheme is expandable far beyond the small and medium sized application - it works really well for something substantial in size


Which of our friends is 'right' in their argument? They both are - she writes parts of large systems, and he writes short system administration utilities.