Gordon Myers
Articles on Life, Truth, Love, Computers, and Music
Programming is like salsa dancing, for better or worse
My last post was about programming, and this one will be too. Although the last one was a "how to" post, whereas this will be philosophical musings on the merits of programming languages. So with that said, let me tell you that I hate Java. (I'm not referring to coffee, as my hatred of that flavor is merely incidental.) But Java, as a programming language, is dreadful. Why? Because of something that has nothing to do with the actual language at all.
I will posit to you that all modern programming languages (worth discussing in terms of business applications) are basically the same. Any major programming language worth its salt is going to have things like exception handling, regular expressions, loop structures, object orientation, etc. Each one will naturally have different syntax and their own unique quirks, but it all comes out in the wash. If you've been programming for any amount of time, you probably won't have too much difficulty jumping from one major language to another.
What really sets languages apart, then, is how easy they are to pick up when you don't know what you're doing. There are three facets to this. Easy to pick up languages should have (1) as little boilerplate as possible, (2) a low probability of causing fatal errors, and (3) good documentation. Java fails miserably on all three counts. Java is riddled with meaningless and cryptic boilerplate. And unless you type everything exactly right the first time, your Java program will not compile. You'll very likely be given some obscure red error message.
And on documentation -- perhaps I'm just spoiled as a PHP developer, because PHP, hands down, has the best documentation out there of any language. The PHP manual is pretty, it's full of helpful and real-world examples, and the user comments are renowned for their usefulness. Sure, every once in awhile you'll get a bad egg in there, but overall, PHP's user comments are so highly regarded that you can actually download an official copy of the manual with user comments included.
Java, on the other hand, has miserable documentation. It's not as though things go undocumented in the Java world. On the contrary -- every single class, method, and property in Java is documented, and that documentation is verbose. But those documents say nothing. Their length is downright deceiving, as it's often some of the most obscure language you'll ever run into. And don't expect to find any use case examples or user comments.
Now here's the analogy you've all been waiting for. I've taken salsa dance classes a couple of times over the years. I'm not exceptional at it, but the classes are fun. But I've learned the hard way that what you learn in the classroom is very different from actually going to a club and dancing real salsa with strangers. I had a bad experience with that last year; a friend (who is a girl) needed someone to go with her to a salsa dance downtown. It might be the bitterness talking here, but I think girls have a very different experience going to dances than guys do -- particularly guys who aren't great dancers and only have a lukewarm interest in it. More on that in a moment.
Looking at all the other dancers there was intimidating. I quickly realized just how little the classroom had taught me. Add to that my natural resistance to talking to strangers / fear of rejection, and the scene seemed downright hellish.
I was able to approach one girl who seemed closer to my own lack of expertise, and she was graciously willing to lend herself to me for one dance. But it became quite clear, less than halfway through the song, that I had run out of moves and didn't really know what I was doing. So after the song ended, she politely moved on to the more experienced dancers who were ready and willing to lead her, spin her, and dazzle her. That process taught me literally nothing -- besides the striking realization that I am not a talented salsa dancer. It was pretty discouraging and left me with little desire to ever go back (at least until I miraculously transform into a great, confident dancer with an endless repertoire of moves).
From what I've seen, experimenting with Java programming is a lot like that. If you aren't already an exceptionally talented and attractive programmer, no one's going to help you. The documentation sure won't. Or even if you do "get a dance" (i.e. you get some very simple piece of code to compile), you probably won't learn very much from it, and you certainly won't be made to feel very welcome. The learning curve is just too damn intense.
Whereas, my friend's perspective of going to a salsa dance club (as a girl) is probably a lot more akin to trying out PHP programming. In that case, all sorts of guys will probably come up to you, ask you to dance, and lead you on exactly how you should move. As long as you understand the basics, you'll do fine. That's PHP's documentation, in a nutshell. And if you make a mistake on the dance floor (or in your code), people will probably just laugh it off and tell you you're great anyway (or, your program will still run and the output will still be pretty close to what you're expecting).
Different programming languages fulfill different niches, some compete more directly with each other than others, and every language has its quirks. But at the end of the day, what really matters is how easy it is for newcomers to get on-board. In that regard, PHP does exceptionally well, while Java crashes and burns and dies a hundred fiery deaths.
Java is a discouraging language, mainly because of its poor documentation. I think most programming languages would be benefited by having the humility to admit just how much of a better job PHP does when it comes to documentation, and if they learned to model their own off of that. Languages borrow from each other all the time. And if languages like Java could start to borrow that from PHP, everyone would win.
Agree? Disagree? I'd love to hear from you in the comments. And if you'd like to read more on why PHP is actually pretty great, check out this article by Nikita Popov.