Programming idiom
In programming and in code, an idiom describes a commonly-used way to code a relatively small construct in a particular programming context (i.e. programming language). Many such constructs are found in multiple programming contexts yet tend to vary by context. Like a linguistic idiom, a programming idiom is a commonly-used way to express a concept in a language that exists outside the definition of the language yet is constrained by it. Similar to a software design pattern, an idiom is a template to be followed, not code that can be copy-and-pasted into a codebase. In this sense, an idiom is a pattern, yet software design pattern is a classification reserved for significantly larger-scale functionality; usually involving the interaction of multiple objects. Using the idioms for a programming context (instead of using idiosyncratic constructs) helps a team work together since they lower the cognitive load of the resulting code. Such idiomatic use is common in crowdsourced repositories to help developers overcome programming barriers.
In programming and in code, an idiom describes a commonly-used way to code a relatively small construct in a particular programming context (i.e. programming language). Many such constructs are found in multiple programming contexts yet tend to vary by context. Like a linguistic idiom, a programming idiom is a commonly-used way to express a concept in a language that exists outside the definition of the language yet is constrained by it. Similar to a software design pattern, an idiom is a template to be followed, not code that can be copy-and-pasted into a codebase. In this sense, an idiom is a pattern, yet software design pattern is a classification reserved for significantly larger-scale functionality; usually involving the interaction of multiple objects. Using the idioms for a programming context (instead of using idiosyncratic constructs) helps a team work together since they lower the cognitive load of the resulting code. Such idiomatic use is common in crowdsourced repositories to help developers overcome programming barriers. ==Examples== ===Writing to standard output=== Writing to standard output is generally something covered early when learning a language; it is often presented through the task of writing a hello world program. A common idiom in C++ like: std::println("Hello World"); For Java: System.out.println("Hello World"); For Rust: println!("Hello World"); For Python: print("Hello, World") ===Using dynamic memory=== In C, use the C dynamic memory allocation functions such as malloc() and free() . In C++, use the and operators. The C dynamic memory allocation functions are usable in C++, but would generally be considered idiosyncratic. ==References==
References
- Mining idioms from source code · retrieved 2026-11-17 · rev 1366937918
Cite this reference
MLA "Mining idioms from source code." Allamanis, Miltiadis; Sutton, Charles (2014). 2026-11-17. https://en.wikipedia.org/wiki/ArXiv_(identifier). Accessed 24 November 2026.
Chicago "Mining idioms from source code." Allamanis, Miltiadis; Sutton, Charles (2014). 2026-11-17. https://en.wikipedia.org/wiki/ArXiv_(identifier).
APA Allamanis, Miltiadis; Sutton, Charles (2014). (2026). Mining idioms from source code. Retrieved November 24, 2026, from https://en.wikipedia.org/wiki/ArXiv_(identifier)
- Barriers in Front-End Web Development · retrieved 2026-11-17 · rev 1366937918
Cite this reference
MLA "Barriers in Front-End Web Development." Samudio, David I. 2026-11-17. https://cs.gmu.edu/~tlatoza/papers/BarriersInFrontendWebDevelopment.pdf. Accessed 24 November 2026.
Chicago "Barriers in Front-End Web Development." Samudio, David I. 2026-11-17. https://cs.gmu.edu/~tlatoza/papers/BarriersInFrontendWebDevelopment.pdf.
APA Samudio, David I. (2026). Barriers in Front-End Web Development. Retrieved November 24, 2026, from https://cs.gmu.edu/~tlatoza/papers/BarriersInFrontendWebDevelopment.pdf
- Print Hello World · retrieved 2026-11-17 · rev 1366937918
Cite this reference
MLA "Print Hello World." 2026-11-17. http://www.programming-idioms.org/idiom/1/print-hello-world. Accessed 24 November 2026.
Chicago "Print Hello World." 2026-11-17. http://www.programming-idioms.org/idiom/1/print-hello-world.
APA encyclopegia.org. (2026). Print Hello World. Retrieved November 24, 2026, from http://www.programming-idioms.org/idiom/1/print-hello-world
Cite this article
MLA
"Programming idiom." encyclopegia.org, 2026, https://encyclopegia.org/wiki/programming-idiom. Accessed 24 November 2026.
Chicago
"Programming idiom." encyclopegia.org. Accessed November 24, 2026. https://encyclopegia.org/wiki/programming-idiom.
APA
encyclopegia.org. (2026). Programming idiom. Retrieved November 24, 2026, from https://encyclopegia.org/wiki/programming-idiom
Accessed November 24, 2026 · CC BY-SA 4.0 · citation page · JSON