Learning a New Language: Tips for Software Professionals

August 3, 2012 | by | Category:

In your career as a programmer you are likely to work with systems written in a variety of programming languages, often many at once. Perhaps your front-end is written in Ruby, your backend in Java, and your administration scripts in bash. Whatever the case may be, it’s your duty to learn and produce code in those languages and your responsibility to do a quality job of it.

The trouble is that no language environment is ever the same as another. Best practices that you employ in Java may not translate to Ruby or Python and vice versa. So while you’re learning a new language, what can you do to make sure you’re learning to write it in the best possible way? Here are three tips:

Read Someone Else’s Code

If I have seen further it is by standing on the shoulders of giants. — Isaac Newton

There are millions of interesting open source projects on the web. With sites like GitHub, Google Code, and SourceForge it is simple to find and study popular projects. You can even contribute to them and have other developers provide feedback on your additions.

Use a Static Analyzer

Just what do you think you’re doing, Dave? — HAL 9000

Static analysis tools like JSLint (JavaScript) or FindBugs (Java) will scan your source code and provide useful feedback about potential bugs or problems. Check out Wikipedia for tools available for your language.

Write Unit Tests

Virtue never tested is no virtue at all — Billy Bragg

I can already hear a collective groan. I get it — nobody likes writing tests. Whether you love or hate them, writing unit tests will force you to write code that is modular and can stand independently. As an added benefit it might even expose a few bugs in your code.

Before I sign off, I’d like to point out that the inspiration for this post came from a real place. As we release more API clients for the Optify API, we have often ventured into unfamiliar territory. To date we have bindings for Java, Ruby, Python, and PHP. Studying other open source projects, using static analyzers, and writing tests helped us to ensure that the packages we have provided to the community are of the highest quality. Why don’t you check them out for yourself and send us your feedback!

Links