Developers trying to jump from one language to another often hit the same wall: How do I do this? They can do it in their base language, but introduce them to a strange new world, and the going gets rough.

Programmers in this sticky position often benefit from seeing how the same concepts, designs, and algorithms can be implemented in parallel across multiple languages. Here are five sites that feature examples of how the most popular languages -- and a few you might not know -- tackle the same commands so very differently.

Rosetta Code

Easily the largest, most robustly annotated, and consistently useful site of its kind, Rosetta Code is described as a "programming chrestomathy" -- a repository of examples for how to accomplish the same tasks in many programming languages. Most remarkable about Rosetta Code is not the sheer size of the site and the number of examples, but the granularity of the examples. Creating a window in a GUI, for instance, isn't annotated by language, but by specific toolkits within that language; take Python, with examples for Tkinter, PyGTK, Pythonwin, wxPython, and many other libraries.

Eqcode

Eqcode aims to show "equivalent codes for all languages," so it provides an index of common languages with drill-downs to specific concepts or tasks, such as removing a specific element from an array or constructing a regex to match an email address. The breadth of languages is decent, but the concepts addressed are somewhat scattershot, and it isn't updated often; the last updates were in April 2014.

CrossWise

Like the other sites here, CrossWise lets you see how multiple languages -- in this case, JavaScript, PHP, Ruby, and Python -- implement the same concepts. But the site design is undeniably ingenious: The comparisons are placed side by side in two columns, and you can choose which language examples to place in what column. CrossWise covers such details as how Boolean logic (the concepts of truth or falsehood) are implemented in each, or error handling and exceptions.

AlgPedia

An ambitious project created by Universidade Federal do Rio de Janerio in Brazil, AlgPedia is a collaborate encyclopedia that focuses on implementations of algorithms. Sorting, checksumming, arbitrary precision, data mining, pattern matching, and many other categories of algorithms are all included. The project is still in its early stages, so the coverage of algorithms and the types of examples provided are somewhat incomplete; most of them have only one or two examples.

PLEAC (Programming Language Examples Alike Cookbook)

Perl is noted for the Perl Cookbook, which documents common programming problems and their solutions for the language. PLEAC is an attempt to take the problems posed in the Cookbook and produce solutions for them in nearly every other language in use. Perl, Groovy, Python, OCaml, and Ruby have the best coverage of solutions so far, but stubs and partial entries for lots of other languages are also included. Interestingly, JavaScript is not among them, but a stub entry for CoffeeScript is. As with many of the others here, you're welcome to contribute if your favorite language is underrepresented.

This story, "Learning a second programming language? Try these 5 sites" was originally published by
InfoWorld.