Get the Powers to Act from Fresh Ideas



January 16, 2013

Polyglot Programming, Toolbox Programming

This is , in part, in response to the comments for our Ruby Tutor's Ruby Meta-programming series. Many commentators have suggested that we also try out their favorite programming languages such as Lisp, F#, Scala, Clojure etc.

Polyglot Programming


When you are in Munich, speak German.
When you are in Paris, speak French.
When you are in Osaka, speak Japanese.

All very fine. We have no qualms about switching languages provided we have fluency in those languages.

Does the parallel hold in software?

Write PL/SQL here, code in SQL-92 here, use hibernate here, employ iBatis here.
Use Java there, code in C here, write PHP there, write Ruby here.
Does the parallel really hold in software? I don't think so and here are my reasons.

  1. Our attachments to our chosen programming language is far stronger than our attachments to our mother tongues. We switch our human languages depending on who we are talking to. We do so without second thoughts, without hesitation, without discomfort.
  2. We are more rational about the human languages than about the programming languages.

Andy Hunt and Dave Thomas of Pragmatic Programmers have suggested a practical solution to this over-attachment: Learn a new programming language every month. My solution is an easier variation of that.

Toolbox Programming


In my method, there is no need to pick up a new language every month, year, or even every decade.
But when you pick up new ones, don't limit yourself to one, pick up as many new ones as you can.

When do you need to pick up new languages?
  1. When your guy/gal is giving you trouble, when you start to feel pain. Example: the language is beautiful, the framework is beautiful, but you cannot deploy your app using them. Don't suffer the pain, switch.
  2. When you decide that your guy/gal is perfect and that you cannot imagine your life without him/her. No one is perfect and s/he will forsake you someday and thus you'd better start finding some substitutes now.

What new languages do you pick up?
Since you are head over heel in love with this particular language, find as many languages similar to that one as you can.

You love it because it is a Functional language? Find 3 or 4 other Functional languages.

You love it because it enables you to write very small, compact programs. Find 3 or 4 other languages with such concise syntax and conventions.

You love it because it runs on JVM? Fine 3 or 4 other languages that can run on JVM as well.

Conclusion


Just after a few days each with Scala and Clojure, our Ruby Tutor has cured himself of his severe case of Ruby infatuation. Of course, he won't start using Scala or Clojure next week or month. He may not even use them at all. But he now knows he can hope for something Ruby-like if Ruby and its frameworks really prove nasty and stubborn. He won't grovel, kowtow, degrade himself, but switch, or wait, or both, or something else.

Fall in love, it's a fine noble sentiment. But not madly, not with the wrong types.

Once you find you are thinking it will be the end of the world to lose, or break up with that language,

Well, go ahead and pick up at least 3 new tools!

No comments:

Post a Comment