Well I think I should refine my statement to languages that support OO. If your project uses a procedural language, such as C or BASIC, writing OO code may not necessarily be a good practice. Though theoretically possible to write OO in procedural languages, the fact that they lack native object and OO support makes things difficult. In this case, writing in OO can be inefficient, which kills the purpose.
But I think this is a PHP forum so all topics are PHP related. As PHP is now a language that almost fully supports OO, my statement above was perfectly valid. This is not a subforum for C or BASIC, we are not writing in a procedural language. In a language that supports OO enough well, there’s no reason not to write in OO and instead go with the old and bad ways. Perhaps it can be a controversial topic with PHP 3 or PHP 4, whose object models are somewhat primitive and inconvenient to use. Since version 5, PHP’s object model has matured and should be used by every aspiring PHP developers.
Of course, the difficulty of OO thinking can prove to be a problem for newbies, which is understandable and acceptable. But once a developer gets a hang of the basic programming concept, it will be a good time to switch into OO, if he hasnt already done so. Sticking with procedural mindset can be severely detrimental for a programmer’s career, the longer you are stuck with procedural code, the harder it is to make the transition to OO, as evidenced in your own experience. This is why I recommend newbies to try switching into OO as soon as they can, once they are comfortable at writing functions and arrays it will be about time to make the transition.
You make an interesting point. I actually think that Objects should be taught from day 1, in universities/colleges that you can safely assume your students are capable programmers, or will be capable programmers. If they all major in Computer Science, and aspire to work for companies like Microsoft and Facebook, it is a good way to go. But this indeed makes the learning process more difficult, as not everyone possess the talent to write quality code. There will be some people who just cannot click when it comes to programming and its concept, some may be web designers who are more like artists in nature. They do not care about elegant code or reusable code, they just want to learn something quick and be done with it. Teaching OO to those who do not have a programmer’s mindset at the first day of their coding lesson may be infeasible.
So I guess, eventually, it all comes down to the audience, whom you are supposed to teach, and what expectations you have on them. Do you think they will eventually become capable coders who will find programming jobs in this industry? Or do you think they are just hobbyists who only learn coding for fun or for minor purposes? The answer to this question dictates whether teaching students OO at their first day at school is necessary, or not.
If the result of asking a question is simply to refuse and reject the valid answers you receive, it sure is not very encouraging. It is hard to learn anything when you aint willing to learn.