Laziness vs. Efficiency

Joel Moss (a fellow member of the CakePHP community) has been acting like a bit of a Rails (and Ruby) fanboi as of late. He's doing a series of blog posts proclaiming his love for Ruby. Personally, I loved Rails when I first encountered it. Played around with it. Wrote a web site for my simulation baseball league in it. Then started disliking *some* of the people in the community and are now pretty much ambivalent about Ruby and Rails in general. Great tool, not for me. Python seems to be a better fit for me at least.

I think a lot of what he says is nonsense and can be summarized with "I don't like PHP's syntax." Hell, I don't even like it myself. PHP's big problem has been consistency with parameter order and a less-than-stellar object implementation. Yes, things have improved in terms of OOP (closures and traits!) but PHP clings hard to it's procedural roots and that is not necessarily a bad thing. Slamming PHP for it's OO implementation is like picking at a scab so it never goes away. Pointless. "PHP sucks because of bad syntax" is an argument I'd expect from my 9 year-old daughter, not a good programmer like Joel. Kind of disappointing. Never mind all the awesome built-in functions or wealth of high-quality third-party libraries out there for PHP. Sure, those things exist for Ruby too but often you only have one or two choices. PHP is absolutely rich in choices of third-party libraries. Sure, a lot of them are not top quality but it never takes long to figure that out. Okay, I'm drifting. On to the rest of my point.

I think where Joel starts to go off the rails was a follow-up in Twitter that said "Hands up if you're a lazy developer. [I proudly hold both my hands up high in the sky] Laziness makes me a better coder". Once and for all, we need to stamp out the "laziness makes me a better coder" meme that is picking up steam. There is a HUGE difference between laziness defined as "I want to write less code" and laziness defined as "I don't want to have to figure shit out.". The first one is called efficiency, not laziness. The second one is the type of trait that a programmer should be ashamed to have.

I realize now that reliance on the use of frameworks for your applications is the type of laziness that is straying from efficiency to pure laziness. Before you get all riled up, hear (read?) me out. When you use a framework, you are accepting that it will be abstracting a lot of functionality away. Functionality that you might not even understand correctly. Which is great for quickly building something, but bad when you run into an error being generated by the framework itself. Or behaviour that is unexpected. I like to call this "fighting against the conventions", and I believe that is the #1 reason why people end up not using a particular framework. They cannot or are unwilling to follow the conventions and as a result, nothing will work.

So, if you use a framework all the time, you might find that certain skills or bits of knowledge start to erode. Use an ORM all the time? You forget how to make finely tuned SQL queries. Rely on built-in form validation? You start to forget what POST requests look like. Use the Ajax helper that comes with the framework? You forget how to make tight, customized Javascript code. I think you're starting to get the point.

Joel is 100% correct when he talks about that there are features in Ruby that allow you to be more EFFICIENT with your code than in PHP. That is not laziness. Usually when a developer calls themselves lazy, it is a self-deprecating statement. I have called myself "lazy" because I strive to write as little code as possible to accomplish a task. That's not laziness, that's efficiency.

The use of the term "laziness in terms of coding" is just a bad one to use. Use the proper term, which is "efficiency in terms of coding". "Laziness in terms of coding" is cut-and-pasting code all over the place, or blind use of code examples you find on the web without understanding what they really do.

Joel, I'm happy that you are loving Ruby. Python gives me the same fuzzy glow on those occasions when I play around with it. But please put things in the proper prospective. To paraphrase the Princess Bride: "You keep using that word. I do not think it means what you think it means."