
Keeping multiple programming languages straight — The Endeavour - prajjwal
http://www.johndcook.com/blog/2012/07/27/multiple-programming-languages/
======
hackinthebochs
I've never had trouble keeping multiple programming languages straight in my
head. To me, its really just a matter of "context switching" much in the same
way that a multilingual person can switch between various languages on the
spot. If the context calls for a specific language, then its that language
that naturally arises.

It goes even further than that. When I code I instinctively take on the
"mannerisms" of the surrounding code. Brace style, indentation, alignment,
etc. This is all part of the same mechanism that helps one use the appropriate
idioms in the right context.

~~~
georgemcbay
The more similar the languages (which he addresses in the article), the more
small issues I run into. The biggest issue I've be running into lately is that
I do a lot of Go code in my free time but mostly C#/C/C++/Java for job stuff
and I find myself pretty frequently not adding semi-colons to the end of lines
even when not in Go.

Generally no big deal, the compiler picks this up easily enough, but in some
languages (eg. Javascript) this could be an issue due to optional semicolons
but with sometimes unexpected side-effects. Though when forced to write
JavaScript I religiously JSLint for my own sanity, so I'd still be okay there.

------
invalidOrTaken
Keeping languages of different paradigms or whitespace conventions straight is
pretty easy.

I echo the article, though, on the perils of using similar languages in the
same niche. I love using regular expressions; I hate that every language's
regex engine has slightly different syntax and features. So a bell went off in
my head when I saw that was one of the topics he found appropriate to take
notes on.

------
freditup
I think the point about similar languages is important. After using a Java-
like language where == can compare Strings, chances are you will use ==
instead of .equals() when working in Java.

Also, when switching between languages like JS, Ruby,and C#, I can't
automatically type semicolons and the process involves a quick delay when I
have to think about whether there should be a semicolon or not.

------
lawn
This is something I can't really relate to. Sure you have a small "switching"
period when you're jumping between languages but that's it basically.

> 1\. Try not to use similar languages in the same niche.

On the other hand I find it really simple to use similar languages, you don't
even need to change how you think! It's just a change of syntax very similar
to how I can switch between English and Swedish. The problem is when you want
to use a language you haven't used in a while, but that too will mostly be a
case of syntax issues ('How do I do X in Y').

> 2\. Try to use one language at a time.

I partially agree with this - it's easier to only use one language than
switching and this is certainly the thing you should be focusing on if you're
having problem with 'too many languages'.

With that said I have never had a problem wih switching from say Perl to
Javascript to SQL and back again in a short period of time. I find it easy to
look at the surrounding code and just do the same.

> 3\. Keep notes and save sample code.

I have yet to keep any notes for a specific language - I tried but never used
it - but I do agree that cookbooks can be very useful. Otherwise reading code
is always a _great_ thing to do regardless.

------
tomku
As a shameless polyglot, I've found editor snippets to be very helpful for
this kind of thing, particularly if your editor lets you put in helpful
placeholder text in fields.

------
nicholassmith
I have a slightly weird method for doing it, for each specific language I'm
working in I use a slightly different theme for my text editor, it provides a
small cognitive differentiator that seems to trigger the right parts of my
memory.

