Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

General Discussion

How do you remember the syntax and quirks of all the languages you work with? I get confused sometimes.

For example, I am studying Python (which rocks, BTW) and JavaScript and PHP. If I spend time working in Python and then switch to JavaScript, I sometimes forget that with the latter I need to use the var keyword to declare a variable. And when I write a JavaScript function I might by accident try to return multiple values, which isn't allowed in that language but is allowed in Python.

I am an experienced programmer but heretofore only had to deal with a couple of languages. Nowadays a developer must juggle perhaps a dozen different languages to get the job done. How do more modern programming professionals manage to switch from one language to another and not confuse syntax, style, capabilities etc.?

4 Answers

The best thing you can do is get a good code editor with syntax auto completion. I personally along with a bunch of other users use Sublime Text because its super fast and has endless features in its customization.

Most of the markup comes with repetitiveness. The more you code, the easier it will naturally become. You also want to get used to going through reference files online. I prefer reference books that i can carry around with me, but its whatever you feel is best for you.

I would check out python.org and get used to the online reference. Good luck!

Something that helps me is that I have a bunch of gists on github that remind me of helpful commands. I am always forgetting things about languages and having a little resource with useful snippets helps remind me how things are structured or helps me remember the function I'm looking for.

Personally, I think the solution is three-fold: It's important to type out your own code while following along with a video (which is why workspaces is so awesome). Doing so tends to work the same as taking notes in class. People remember what they actively write down, because they are employing more than one of the five senses.

The second key is documentation. I doubt there's a single programmer that has memorized every built-in function of their favorite language--PHP alone has thousands of built-in functions--but maybe I'm wrong. However, once you throw in the world of libraries, gems, packages, and plugins it becomes impossible to know everything.

The third key is focusing on programming concepts and practices. Every programming language I've learned so far uses the same concepts: foreach loops, if/else statements, object-oriented programming...If you're familiar with the kind of problems and solutions that you come across, then applying different types of code syntax becomes a lot less intimidating. You'll definitely make mistakes and get confused in the process. Different languages have different peculiarities.

Ken Alger
STAFF
Ken Alger
Treehouse Teacher

Adiv;

Great question! I would echo what David said and say that it is all about repetition in a particular language. Like he said, many concepts are the same, but the syntax is different. I can't tell you how many times I have written lines of code for a particular language and wound up using comment tags from another language. Can't tell you how exciting it is to see the smoke pour out of the Java compiler when it tries to compile Fortran comment tags.

In a nutshell, it comes down to practice and being comfortable. I would venture to guess that most programmers still "stumble" with their code on occasion either for a rarely used function. Even with specializing in a couple of languages instead of an entire array (no pun intended) of them, if you spend enough time in one things have the potential to get "foggy" in another for a short time during a transition.

Just my thoughts and happy coding,

Ken