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.
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 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.
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)