One of the great joys of programming is exploring different approaches to problem solving. From domain-specific algorithms to more general concepts and design patterns. Programming languages follow different paradigms (see this list) and are usually implemented independent of one another. Although many languages share common syntactic traits amongst themselves, their architecture, implementation and intent of use may vary vastly. Consequently, each language naturally evolves best practices for developers to use - whether driven by philosophy, constraints and/or strong community influence.
This repository gathers resources to get a quick overview of idioms in different programming languages.
But, what is an idiom?
"A programming idiom is a means of expressing a recurring construct in one or more programming languages. Generally speaking, a programming idiom is an expression of a simple task, algorithm, or data structure that is not a built-in feature in the programming language being used, or, conversely, the use of an unusual or notable feature that is built into a programming language." Source
or as Mr. Joel Kemp describes in a more practical context:
"...I only knew C++. I used it for schoolwork and to build games. I (embarrassingly in hindsight) thought it was the only language worth knowing. Then I was forced to learn Java, coded in Visual Basic for a Summer gig, built an app and game with C#, and dabbled in some web languages like PHP. While it was great to learn new languages, I coded every single one like C++. This was not programming idiomatically. This is a common mistake amongst programmers (across all skill levels really)..." Source
StackExchange discussion on idioms versus design patterns here.
Further reasoning:
What's the difference between an idiom and a pattern? I have a hypothesis that:
- idioms are smaller
- idioms are language-specific