So, just now, I was reading a good Rails post by Stuart Herbert and nodding my head along. I have not gotten into the Rails bashing fun on my blog, but I do poke fun at it around the office. Then I got to this part:
The OO in Rails continues to leave PHP for dead, and OO brings many advantages to a thriving development community. There are real advantages to being able to share code between both the must-be-real-time web front-end and the non-real time backends, and to be able to easily reuse whatever external open-source libraries save you time and effort.
Now, I have no idea about the first part. I am not an OOP guy. But, what I have issue with is the idea that for code to be reusable, it has to be OOP. So, if I am a college kid or young PHP developer, I would read this and think “Oh, so, to reuse code or share it, I have to be using OOP”. Man, this is just so dead wrong and irresponsible. Can someone tell me why only OOP can be reused? Why can’t people write sane functions that can be reused? I do it every day. They do it in C all the time. Our front end web servers run the same code base as the cron jobs that do a wide variety of things. They use the same libraries. They use the same objects (yeah, i use them when they are a good idea).
Please, someone explain this to me.
(I have a half written post about how you can write good, maintainable, reusable code without OOP. I have not finished it yet, but I guess I need to. It seems the world is going to OOP hell otherwise.)