I know Java, C#, C++. I have used Perl, and am picking up Python and Actionscript 3.
This is certainly a path others have trodden, so I am asking how do you keep all these languages straight in your head?
Software Engineering Stack Exchange is a question and answer site for professionals, academics, and students working within the systems development life cycle. It only takes a minute to sign up.
Sign up to join this communityI know Java, C#, C++. I have used Perl, and am picking up Python and Actionscript 3.
This is certainly a path others have trodden, so I am asking how do you keep all these languages straight in your head?
Your brain only remembers what it considers important, with heavy bias towards the recent. So, just rotate pet projects in those languages and you'll be alright. Just like spoken languages, you'll do better if you: start early and keep your use active.
I used to post a 1-sheet railroad-style syntax diagram plus quick reference for each language on the wall until my memory kicked in sufficiently.
Still have to do that for any programming languages I haven't used in many months.
Have you looked into cheat-sheets for the languages and libraries you use regularly? I have a couple on my wall here, one for VIM and one for PL/SQL. This website: http://devcheatsheet.com/ seems to have many cheatsheets.
I suggest cheat-sheets because there's only so much the brain can easily remember. A language you use on a daily basis will become very easy to remember. Syntax and later certain libraries and functions and frameworks if you use them often enough and you won't need to look anything up in any reference material. The less you use something, the harder it is to remember, though you'll usually be able to regain your former abilities with a little practice. Which is why I keep some cheat-sheets up on my wall: for the functions/features I don't use often enough to remember quickly.
The human brain is an amazing thing. If you learn each one well enough, you should be able to look at code, recognize the language, and ramp back up to speed fairly quickly. It's never been a problem for me... but it does take time to ramp back up to speed.
I have little trouble separating languages in my head, apart from a few typing automatisms (such as having to suppress the end-of-line semicolon in Python or VB).
I guess the thing that helps me the most is that whenever I learn a language (programming or human), I also try to pick up and embrace the culture and ecosystem into which it is embedded. I'm not merely switching languages, I'm switching mindsets (something along the lines of the popular 'wearing the X hat' metaphor).
It helps that all the languages you mention are relatively similar (ie imperative).
If you are just learning to use these languages they are all very similar. They basically all have the same features and all you are learning is a slightly different syntax.
Now when you come to learn the usage (not just the syntax) then it becomes way harder. Learning to use Java like a Java Programmer is not that simple for a C++ programmer (the syntax is easy the usage idioms are difficult).
Now if you had listed different styles of language (declarative/functional/logical) then I would be more sympathetic. As moving between languages were the paradigm completely shifts becomes a lot harder.
But using a language is the key. If you use a language everyday then you will not have a problem. Stop using a language and it will fade (not fast at first). But the further the language is from the language you use daily the faster it will fade. The secret is to keep practicing the languages you like (stop using the ones you dislike your brain will make room for other stuff).
That's were the IDEs come for a rescue ;-) only thing changes in all these languages is to either have a 'if-then-else' or a 'if-else'. some will have '(' and some won't. Its as simple as that :)
All we care is the logic and the easiest readable implementation.
I don't. I confuse them all the time, so I've worked out a set of compensating behaviors and tools.
One way would be to use a distinct style for each language in which you write. By loose analogy, in speaking Spanish or French, one might try to emulate the inflection of a native speaker.
I've seen people that will maintain a distinct bracing, indentation, etc., for each language to help their brain "shift gears" properly when switching between them
Think of it like music. The languages you learn are just different instruments in an orchestra that ultimately produce the same notes. Remembering how to play the instruments takes practice, but eventually you'll be able to pick one up you haven't played in a while and like magic the notes just fall into place. Similarly, as you continue to broaden your knowledge of music (programming), picking up a new instrument and learning to play it becomes easier and easier each time.
Cheesy analogy, but at the end of the day, practice makes perfect. Spend some time with each instrument in that orchestra every now and then so that your ability to play the notes doesn't fade.
I'm mainly a PHP developer. So forgive my biased opinion.
I have recently discovered just how similar C code is to PHP (Or the other way around depending on how you feel ;) )
My suggestion would be to perhaps stick to a family of languages (if they apply to your work or projects) and as you develop your skills further then branch off and learn new things.
i'am using javascript and HTML/CSS mainly also i love c++ when i need a little helping tool with using QT and i use VB and f# sometimes i know it's a little bit crazy but when i feel that i started to lose a language of those especially when thay have different syntax (VB and F# and c++/javascript) so i get my brother and told him that i am gonna teach him then i just start making examples from scratch and when i find that i dont remember how exactly to do something(once i forgot how to do IF ELSE in VB)i just google it;
Lately, I've been using google codesearch a lot. I go there and type in a regular expression that loosely describes what I'm trying to do and find dozens of examples of production code. When I forget a language's syntax, this is the fastest way for me to get answers.
This approach becomes even more powerful if you're good with regular expressions. Note: This is a great resource to refresh regex skills.
Actually: I don't worry much about explicitely trying to build any kind of structure within my head.
This doesn't differ a lot from other scenarios in daily life. I have to remember how to drive a car, how to read a book, how to play tennis, and so on. Just trust your brain and don't think a lot on the metalevel.