Survey: How OO are you?

How object oriented are you in your approach to programming in practice?

For instance, in python (which I am most familiar with) I often put things in classes and add in private and public methods and try to properly encapsulate data. However I hardly ever use class inheritance in my own classes. Normally I use it only if I am using someone elses code library and their usage pattern is to derive their class as a base class.

Also I have only used polymorphism when learning a new language and working through a tutorial as far as I recall. I dont think I have ever used abstract base classes in my own code and I’ve only used interfaces when playing around with Java.

How much do other people use OO’s more esoteric features? Just curious.

In practice? For me that’s a very appropriate choice of words.

I have deep roots in procedural code, so getting my head around OOP hasn’t been easy.

I read about it and go “Oh, yeah, that makes sense” yet a while later I’m thinking “huh?”

I understand it enough to be able to use it OK, and I’ve even written a bit of my own - but nothing I would consider to be “esoteric” by any means.

I agree with him.

I know my way around and can program but I am mainly procedural. I guess it is the way my mind works.

I do see the advantages of OO though

I can not understand OO programming and to be honist I have no interest in learning it.

I only build small websites and as far as I can see I need to write 2 or 3 times more code to use OO rather than longhand or functions.

I am told it is portable but so are functions and snippets of code.

A long time ago I took an Open University course databases. Part of the course was learning the difference between computer languages. I got the impression that OOP is used extensively and very effectively on very large projects.

Personally I use a PHP Framework that uses OOP classes very well. I only write Controllers, Models and Views which interface easily with the main framework. Maintenance is easy because of the rigid structure.

When debugging an old project:

  1. First - examine the URL
  2. Check ./config/routes.php to see which ./controllers/controllerName.php is called.
  3. Examine controllerName.php reveals which ./view/viewName.php is called.

Finding the two relevant “needles” from a project that has hundreds of files is very quick and simple.

I have written my own classes but prefer using the built in functions and adding functions.

An interesting blog I Stumbled upon recently:

http://harmful.cat-v.org/software/OO_programming/why_oo_sucks

I agree with the article since I never liked the OOP Encapsuled Methods. I far prefer how C and Pascal use Structures and global functions to manipulate data. In electrical engineering I learnt about the power of “Black Boxes” which can be applied to functions. Function parameters are passed, data manipulated and a result returned.

I was amused at the article summation :slight_smile:

Thanks for that reply and that article was quite interesting. Your comparison of MVC pattern was fairly apt as well and like you I wonder if its merely the fact that when people adhere to a convention it merely gives a better “leg up” to understanding someone elses code. The main “take away” I get from MVC is a seperation of business logic from presentation logic and it makes sense that a rethemeing or restyling of a website shouldn’t be a major undertaking. However, although understanding a convention does help you to understand code that has been written to that convention it does not necessarily follow that the convention is a good one.

Regarding the url on OOP was a fascinating read and I agree with the author that OOP’s promise of code reuse never lived up to its marketing hype.

I have also been looking at (and trying to learn) functional languages lately and their declarative style does feel more natural than OOP does and many people say learning a functional language helps one to think differently about problems and therefore become a better coder.

It does feel like OOP tries to “hide away” blemishes at times and yet most of those blemishes come from trying to put messy state handling away from the visibility of the person using the object.

Yes, interesting article.