Sunday, 1 August 2010

The Polyglot Programmer - Forget Learning the Language, Visit the Country

I have recently started dabbling with Rails. While I am still (extremely) new with the framework, it has really sparked a new wave of thinking for me - which is great timing since I've been feeling like I am in a bit of a learning plateau.

This new wave of thinking is about the "Polyglot Programmer" and what it means to me.

What is a "Polyglot Programmer"?

"Polyglot Programming" in a traditional sense is simply combining multiple languages in application development. The idea being that some languages are "just better" for doing certain pieces of work. Having the ability to switch language to perform said pieces of work can obviously mean increased productivity and improved product output.

Therefore, a polyglot programmer is a programmer/developer that knows several languages, enabling them to switch language as required.

Problems I See

Well, as a concept, the above seems great. Anyone who knows me knows I am all about getting stuff done. However, I think there are several problems that actually prevent a "true" polyglot programmer. Let's think of our "core" language as our "native" language and other language(s) as foreign:

It takes time to learn, for little time used

For 95% of your work (maybe less, but unlikely) you are going to be in your native language. This is where you feel comfortable and most productive. So for just 5% of your work, you are learning a foreign language. Even if it is slightly harder to do something in your native language, it's likely hard to justify the learning required for relatively little usage.

You need to remember that you can switch

In the 5% of instances where a foreign language is appropriate, something needs to "flick a switch" in your brain to make you actually shell out to that language. Based on the fact that you use it less often, this may not happen. TBH, I think I would need to have a "library" of handy things in a foreign language. Almost treating it as a pattern/snippet repository.

The switch may not be so smooth

There may not be integrated IDE support for the foreign language. For example, in the .NET space integration of the dynamic "Iron*" language implementations (Ruby, Python etc) is still underway. Sure, it is being developed, but it's still overhead for the switch.

Your brain just doesn't play ball with the language

The real benefit is learning a language of a different type (e.g. static vs. dynamic, functional vs. OO). However, since you work in one "mode" most of the time, it's hard to let go of that way of thinking, and you end up shoe-horning a different development style into the language. For example, statically-typed peeps have a real hard time NOT putting type-checking into dynamic languages.

The Stack Change

As you probably guessed, I am advocating a stack change rather than "just" a language change. But why? Please note: I have been switching between Windows and C# ASP .NET development in Visual Studio to Ruby on Rails development in Redcar on Ubuntu. Therefore, some of the benefits realised may be simply to to this specific stack change.

You become the tourist

Why is this good? Like actual tourism, it is easier to learn a language when you are in a country that speaks the language you are interested in. If you are in an environment that is more at home with your language of choice, it will be easier to pick it up.

You truly adapt

When you are in a new (and perhaps scary) environment, you quickly learn to change your behaviour. Why? You need to survive of course. This behaviour change causes you to literally become more adaptable. The learning process required to do this is also highly portable and will enable you to think in a more generic way.

You get the full benefit of the language AND it's environment

One common reason Windows developers slam Ruby (and Rails) is because it is dog slow. And this is true. On Windows. When I first started tinkering with Rails it was naturally on Windows. Very soon, I started to get fed up with it, the simplest of code would take forever to run. Then I thought I would try it on Linux (and I wasn't optimistic). I was blown away by the performance difference. TBH, I don't think it runs any slower than .NET and it obviously starts faster (since no compilation is required). I would never have discovered this if I hadn't changed stack.

You get better tooling support

Some things you just have to get straight from the original source. I've been to several oriental restaurants in the UK (both Chinese and Japanese) where they don't serve food with chopsticks. Why? Because many Brits can't eat with them because we don't use them all the time. However, you go to China or Japan and the opposite is true. If you live and work in the environment native to your foreign language you naturally get a better ecosystem to work in.

You get different tools!

Having been a MS developer for years, I have been spending a rather large amount of time in Visual Studio for a long time. And it is a great IDE. However, I have obviously had several frustrations.. Some for years also - "Add Reference" anyone? (they STILL haven't got this right!). Working on a different stack forces you to use different IDE's and supporting toolsets. For example, with Rails, I have fell back in love with a simple notepad and the command line.. Now, I am looking for ways to develop C# ASP.NET apps in the same way, because I am quicker and feel more comfortable with less.

You do it "their" way

I did a fair bit of martial arts when I was growing up. One thing that continued to annoy me throughout this is the common lack of request for tradition in some schools. Some students would not bow, they would show disrespect to their fellow students and even their teacher. They would not do things like "Wai Kru" because they were just there to learn to fight. In the East, these things are the first things they are instilled into students. Discipline and respect breed a better mental environment for a fighter.

Similar to this, you get "the right way" of doing things in a different language and technology stack. Doing it the "right" way will help you realise all the benefits of the switch in the first place. For example, many .NET developers slam the Rails guys as being "stuck up their own ass" and "too opinionated". Frankly, this is true. But it works. "The Rails Way" simply says "look, 95% of the time you are going to want to work like this, so just work like this and you get X, Y and Z for free". Since most Rails guys work in Linux/Mac, it is a lot easier to find out how to do it their way.

You can travel more and feel at home

In time, I will be as good with Rails as I am with ASP.NET. This means that if I so desired, I could get a job working with Rails rather than ASP.NET. Now think, if I was to apply for a position as a Rails developer that can only use Windows with Rails I would get the position? I seriously doubt it. Changing stack to the native stack will simply make you more employable.

In summary...

I am really enjoying working with Rails. It's a fun and productive environment and a breath of fresh air. It is making me think differently about ALL the code I write (be it Ruby or C#), while making me demand more of my toolset and operating environment. All of which are good things. It allows me to pick the best tool for the job and use it in the best way (e.g. I have started a side project that is using both .NET and Rails).

So, if you want my advice:

  • Spin up a VM.
  • Install Linux.
  • Install Rails.
  • Get hacking! :)

I'll be sharing some more tips/links etc. soon, just wanted to get this out so any Ruby/Rails stuff wasn't a surprise. :)

No comments:

Post a Comment