Monday, January 8, 2007

Meta Schmeta

David Black with a little common sense about the unnecessary glorification of "metaprogramming":

Nothing is gained by putting class_eval on a pedestal and getting all worked up about how “meta” it is. All you have to do is study it a little and then use it when it’s the correct choice for accomplishing what you’re trying to accomplish.


My take on this is that the phenomenon is entirely cultural. A lot of people coming to Ruby are coming from either PHP or Java. I don't know very much about PHP, and this is a very deliberate ignorance, but I wasn't so successful at avoiding Java, and from a Java perspective, Ruby accomodates "normal" OOP, while also giving you all kinds of unaccustomed freedoms. The idea that certain uses of Ruby are "meta" is probably a way of pigeonholing the new stuff. If you call it "metaprogramming," you don't have to learn how to use it; you just put a little velvet rope around it, call it high wizardry, and continue solving problems the way you're used to. In other words, it's a cop-out; a way to keep thinking the same way you did in Java, and essentially write Java in Ruby.

This kind of thing has probably been happening ever since the first time a programmer migrated from one language to another. Everyone knows the Fortran joke. It's actually the reason I have my doubts about Pat Maddox's optimism:


I think a lot of programmers are going to find themselves looking for jobs in the coming years, and not because their jobs are getting sent to India. In fact, fewer and fewer jobs will go to India for the same reason these guys will be out of jobs. In the past, and increasingly less so now, the knowledge of how to configure different frameworks and technologies to play well together was mistaken for the ability to develop. Programming jobs are filled with people who are more admins than developers. With things like Rails obviating the need for these pradministrators, the jobs will go to the guys who know how to build valuable software.


The sad truth of this is that if it were true, Smalltalk would be king, Lisp would be emperor, Microsoft would never have stood a chance against Apple, and Baywatch would never have even taped a single pilot episode. But that's not how it works. Whether due to inertia in the culture of business, or the general proliferation of stupidity, or God knows what reason, the vast majority of people simply do not choose the best technology available to them (as I've said before). If you choose to be something more than a maintenance programmer, or pradministrator as Pat calls them, or adminigrammer, or whatever, that's a great personal choice, a great career choice, an all-around good decision. But expecting all those other idiots to promptly disappear in a puff of logic, it might not be entirely realistic.

Speaking of Fortran, the programming language most used in production environments today is either Fortran or Cobol. Business isn't only about technical elegance; it's also about people, and people are often slow to change. Anybody who's ever had the experience of discovering something marvellous and life-changing which makes everything in their lives better has also shortly thereafter had the astonishing experience of discovering people who don't want to know about it. This is the whole point of the Total Perspective Vortex.

There's a paradox to this. If you take the time to learn "metaprogramming" in Ruby, you will discover how totally it is nothing other than simply programming; and you will also see people just as intelligent as you are calling you a wizard. The thing is, this is the same paradox anybody faces when they think for themselves. It's just the way the world works. The only way to avoid it is to go back to being a sheep.

No comments:

Post a Comment

Note: Only a member of this blog may post a comment.