I stumbled across this blog post the other day on, once again, Ned Batchelder’s blog. It’s an interesting rant about how learning Python and Haskell have proved more frustrating than liberating because the author isn’t able to use Python or Haskell at work. When faced with a task at work which has to be done in C#, the author states that he thinks in Python (or Haskell) and has to translate it to C#.
The post came across as more of a “Why I’m More Frustrated by Knowing Python and Haskell” than “Why Python and Haskell Make You a Worse Programmer”. The frustration that this author describes is real. I’ve felt it many days when firing up Visual Studio to work on my at-work C# project. I would definitely prefer to code in Python than C#. And if I knew Haskell, I’d probably be saying the same about Haskell.
While most of what the author of the sited post was getting at was tongue-in-cheek/rant, he alluded to a potentially legitimate productivity penalty for knowing Python/Haskell. Many times, he would code up something in Python or Haskell to prove to himself that he could, in fact, accomplish the needed task more quickly and simply by using his preferred language. Even given the time “wasted” in such an exercise, I don’t consider his broader perspective necessarily a productivity hindrance. It would be extremely difficult to prove that writing a throwaway implementation of a task in the non-target language followed by a second implementation in the target language really costs more in the end than writing it only once in the target language. Is the second implementation in the target language more maintainable as a result of having written the throwaway? Did “practicing” with the non-target language help solve some specific problem more quickly later down the road? Does “playing” with the non-target language increase a programmer’s mental accuteness and clarity and allow easier, quicker thoughts when coding in the target language? I’m not asserting that this is the case. I’m just speculating. But I’m speculating that it’s likely the case. Specifically, I’m speculating that a broader perspective and regular exercise with a variety of technologies is beneficial in the long run.
Ned, in his typically Neddish manner, provided a number of excellent suggestions to alleviate said C#-frustration. Definitely check out Ned’s blog (linked to above). He doesn’t say, “Try to forget Python and Haskell.” He seems to be saying to embrace them, but sometimes work is, well, work. My conclusion is that if you know a language like Python or Haskell (or Perl or Ruby) and have to work on a language like C# or Java or C++, you’re probably going to be frustrated. But keep yourself well rounded. Keep working in your language of choice when you can, whether at work or home. Try to do things idiomatically within the limits of the language you’re working in. Don’t try to force fit ideas from your favorite language into a less favorite language. And read Ned’s blog. (Did I say that already? :-) He has some more tips on lowering the frustration level.