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.
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:
First - examine the URL
Check ./config/routes.php to see which ./controllers/controllerName.php is called.
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.
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.
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.