Programming Idioms
Programming Idioms
A Programming Idiom is a conventional way to write relatively small code constructs within a specific programming language or programming context. In Korean, it is commonly translated as ๊ด์ฉ๊ตฌ (idiomatic expression).
An idiom is not part of the language definition itself, but forms within the range of expressions the language permits. This mirrors the structure of linguistic idioms, which exist within the rules of words and grammar yet cannot be derived from those rules alone.1
Code that conforms to idioms is called idiomatic, while code that deviates from them is called idiosyncratic. Idiosyncratic code may be grammatically correct but reads as unnatural to someone familiar with the language.
ํจ๋ฌ๋ค์ = ํ๋ก๊ทธ๋จ์ ๋ฐ๋ผ๋ณด๋ ์ฌ๊ณ ๋ฐฉ์
์์น = ํ๋จ์ ์ด๋๋ ์ถ์ ๊ท์น
ํจํด = ๋ฐ๋ณต๋๋ ์ค๊ณ ๋ฌธ์ ์ ์ฌ์ฌ์ฉ ๊ฐ๋ฅ ํด๋ฒ
์ด๋์ = ๊ทธ ์ธ์ด/๋งฅ๋ฝ์์ ์์ฐ์ค๋ฌ์ด ์์ ํํ ๋ฐฉ์
๋ฌธ๋ฒ = ์ธ์ด๊ฐ ํ์ฉํ๋ ํํ ๊ท์น
The five levels above represent an abstraction hierarchy from thought to expression. Idioms apply at a smaller unit than patterns and are more abstract than syntax.
Core Definition
A Programming Idiom satisfies the following conditions.
1. ํน์ ์ธ์ด/์ํ๊ณ/ํ๋ ์์ํฌ์ ๊ฐํ๊ฒ ๋ฌถ์ฌ ์๋ค.
2. ๋น๊ต์ ์์ ์ฝ๋ ๊ตฌ์ฑ์์(ํ ์ค์์ ์์ญ ์ค ์์ค)์ ์ ์ฉ๋๋ค.
3. ๋ฌธ์ ์์ฒด๋ณด๋ค ํํ ๋ฐฉ์์ ๊ฐ๊น๋ค.
4. ์ฝ๋ ์ฝ๊ธฐ์ ์ ์ง๋ณด์์ ๊ธฐ๋๊ฐ์ ๋ง๋ ๋ค.
5. ๋ฌธ๋ฒ์ ์ผ๋ก ํ์๋ ์๋์ง๋ง, ์ค๋ฌด์ ์ผ๋ก๋ ์ฌ์ค์ ํ์ค์ฒ๋ผ ์๋ํ๋ค.
In terms of scale, idioms are smaller than Design Patterns. Both are templates to follow rather than code to copy and paste, but Design Patterns typically deal with the interactions of multiple objects or modules, whereas idioms address expression at the level of one to a few dozen lines.[1] For example, the Singleton pattern is a Design Pattern, while releasing resources via a using block in C# is an idiom.
Why It Matters
The value of idioms is most clearly apparent in team settings. When multiple expressions are possible for the same task in a given language, following the idiomatic expression reduces the cognitive load on the reader.[1] It takes less time to read the code, there is no need to infer intent, and unexpected behavior can be ruled out more quickly.
Without knowing the idioms:
- ๋ฌธ๋ฒ์ ๋ง์ง๋ง ์ด์ํ ์ฝ๋๊ฐ ๋์จ๋ค.
- ์ํ๊ณ์ ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์ถฉ๋ํ๋ค.
- ๋ค๋ฅธ ๊ฐ๋ฐ์๊ฐ ์ฝ๋๋ฅผ ์ฝ์ ๋ ์๋๋ฅผ ์ถ๋ก ํด์ผ ํ๋ค.
- ์ธ์ด๊ฐ ์ ๊ณตํ๋ ์์ ์ฅ์น์ ์ต์ ํ ๊ฒฝ๋ก๋ฅผ ๋์น๋ค.
- ์ฝ๋ ๋ฆฌ๋ทฐ์์ ์ง์์ ์ผ๋ก ๊ฐ์ ์ง์ ์ ๋ฐ๋๋ค.
Conversely, when you know the idioms:
- ์ฝ๋์ ์๋๊ฐ ๋นจ๋ฆฌ ์ฝํ๋ค.
- ์ธ์ด์ ๊ธฐ๋ณธ ์ ์ฝ์ ๊ฑฐ์ค๋ฅด์ง ์๋๋ค.
- ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ๋๊ตฌ๊ฐ ๊ธฐ๋ํ๋ ํํ์ ๋ง๋๋ค.
- ๋ฒ๊ทธ๋ฅผ ๋ง๋ ๊ด๋ก๋ฅผ ์๋์ผ๋ก ๋ฐ๋ฅธ๋ค.
- ํ์
๋น์ฉ์ด ์ค์ด๋ ๋ค.
Code frequently shared in crowdsourced environments such as StackOverflow and GitHub effectively becomes the medium through which idioms are learned, and this is known to play a key role in helping developers cross language barriers.2
Personal note: In that sense, being Korean is itself a kind of curse as a programmer. The gap between not being a native English speaker and thinking in Korean is significant.
Idioms vs. Design Patterns
Design Patterns address recurring design problems that transcend any particular language, while idioms are closer to the expressive conventions of a specific language. That said, the two form a continuous spectrum, and idioms can reasonably be viewed as small patterns.
๋์์ธ ํจํด:
๋ฐ๋ณต๋๋ ์ค๊ณ ๋ฌธ์ ์ ๋ํ ์ถ์์ ํด๊ฒฐ ๊ตฌ์กฐ
์ฌ๋ฌ ๊ฐ์ฒด/๋ชจ๋์ ์ํธ์์ฉ ์์ค
์ธ์ด ๋
๋ฆฝ์ (๊ตฌํ ํํ๋ ์ธ์ด๋ณ๋ก ๋ณํ)
ํ๋ก๊ทธ๋๋ฐ ์ด๋์:
ํน์ ์ธ์ด์์ ์์ฐ์ค๋ฝ๊ณ ๊ด๋ก์ ์ธ ๊ตฌํ ๋ฐฉ์
ํ ์ค์์ ์์ญ ์ค ์์ค์ ํํ
์ธ์ด ์ข
์์
For example, the Strategy pattern can be implemented in many languages, but the form of the implementation varies from language to language.
Java: interface + class
Python: callable / duck typing
JavaScript: function object
C#: interface / delegate
Rust: trait / enum dispatch
Haskell: ํจ์ ์ธ์๋ก ์ ๋ฌ, ๋๋ type class
Even the same pattern must be expressed in a way that fits each language's idioms. Directly transcribing the UML structure from a pattern book may be grammatically correct but can produce code that feels awkward in the target language.
Idioms vs. Paradigms
A Programming Paradigm is a broad way of thinking about programs. Object-oriented programming, functional programming, and procedural programming all fall into this category.
Idioms are smaller in scope. If a paradigm addresses "how to think," an idiom is closer to "how to naturally express that thinking in this particular language."
Summarized as five levels of abstraction, they are as follows.
[ํฐ ์ถ์]
ํจ๋ฌ๋ค์ : ์ฌ๊ณ ๋ฐฉ์ (๊ฐ์ฒด์งํฅ, ํจ์ํ, ์ ์ฐจ์ )
์์น : ํ๋จ ๊ธฐ์ค (SOLID, DRY, KISS, YAGNI)
ํจํด : ๋ฐ๋ณต ๋ฌธ์ ์ ํด๋ฒ (์ ๋ต, ์ต์ ๋ฒ, ํฉํ ๋ฆฌ)
์ด๋์ : ์ธ์ด๊ถ์ ์์ฐ ํํ (RAII, list comprehension)
๋ฌธ๋ฒ : ๊ฐ๋ฅํ ํํ ๊ท์น (if, for, class ์ ์ธ)
[์์ ๋จ์]
Moving from top to bottom, language dependency increases and the unit of application becomes smaller.
Language-Specific Examples
Python
Python's idioms are commonly referred to as Pythonic.
# Less Pythonic
result = []
for i in range(len(items)):
result.append(items[i].name)
# More Pythonic
result = [item.name for item in items]
Representative Python Idioms:
list / dict / set comprehension
context manager (
with)iterator / generator
enumerate,zipEAFP (Easier to Ask Forgiveness than Permission): exception-based control flow
The contrasting concept, LBYL (Look Before You Leap): pre-check-based control flow. In Python, EAFP is considered more idiomatic.
duck typing
__init__.py-based module boundaries
with open("data.txt", "r", encoding="utf-8") as file:
text = file.read()
The code above never calls file close directly. Having the with statement guarantee resource release is the standard idiom in the Python ecosystem.
C++
The defining idiom of C++ is RAII.
{
std::lock_guard<std::mutex> lock(mutex);
// critical section
}
Lock acquisition and release are tied to the object's lifetime. This approach guarantees that the lock is released even if an exception is thrown or an early return occurs.
Representative C++ Idioms:
Category | Idiom |
|---|---|
Resource Management | RAII, Rule of Zero/Three/Five, Smart pointer ownership, copy-and-swap |
Encapsulation | Pimpl, NVI |
Type Representation | std::optional, std::variant + std::visit |
Compile-Time | CRTP, Type erasure, EBO |
STL | Erase-remove |
(Language Feature) | range-based for, move semantics |
Idioms are especially important in C++. Because the language provides many powerful but dangerous low-level features, idioms effectively serve as safety mechanisms.
For detailed C++ idioms, see here.
Personal note: Personally, I think C++'s biggest problem is that there are too many versions and it is heavily fragmented. I enjoy using programs written in C++, but I'd rather not encounter it in codebases I have to work on.
JavaScript / TypeScript
In JavaScript and TypeScript, asynchronous handling and object composition patterns are important idioms.
// Less idiomatic
fetch(url)
.then((response) => response.json())
.then((data) => {
console.log(data);
});
// More common form in modern TypeScript
const response = await fetch(url);
const data = await response.json();
console.log(data);
Representative JS/TS Idioms:
async/awaitobject destructuring, spread/rest
immutable update
discriminated union
type guard
optional chaining (
?.)nullish coalescing (
??)module boundary-centered design
In TypeScript, rather than simply attaching types, what matters is making types describe the runtime structure.
type Result<T> =
| { ok: true; value: T }
| { ok: false; error: string };
function handle(result: Result<number>) {
if (result.ok) {
return result.value;
}
throw new Error(result.error);
}
This kind of discriminated union is the representative TypeScript idiom for explicitly expressing error paths.
C#
In C#, LINQ, using, async/await, properties, and dependency injection all function as strong idioms.
using var stream = File.OpenRead(path);
Delegating the lifetime of IDisposable resources to using is the C# way.
Representative C# idioms:
using/IDisposableLINQ
property
async/await +
Task<T>extension method
nullable reference type (
string?)dependency injection
record type
pattern matching (
switchexpression)
Go
Go's idioms place a strong emphasis on explicitness and simplicity.
result, err := doSomething()
if err != nil {
return fmt.Errorf("doing something: %w", err)
}
Representative Go idioms:
explicit error return +
err != nilcheckerror wrapping with
fmt.Errorf+%wgoroutine + channel-based concurrency
resource release scheduling with
deferimplicit interface satisfaction (in contrast to explicit declaration in Java/C#)
preference for small interfaces (
io.Reader,io.Writer)simple import paths matching the package name
type Reader interface {
Read(p []byte) (n int, err error)
}
Keeping interfaces small and letting implementations satisfy them implicitly reflects Go's expressive philosophy.
Rust
Rust's idioms are shaped around the ownership model and explicit error handling.
fn read_config(path: &Path) -> Result<Config, ConfigError> {
let contents = fs::read_to_string(path)?;
let config: Config = toml::from_str(&contents)?;
Ok(config)
}
Representative Rust idioms:
Result<T, E>+?operatorOption<T>+ pattern matchingownership transfer (
move) vs. borrowing (&,&mut)trait-based abstraction
matchwith exhaustiveness checkingbuilder pattern (
StructBuilder::new().with_x().build())newtype wrapper for semantic separation
avoiding gratuitous
.clone()calls
match value {
Some(x) if x > 0 => println!("positive: {}", x),
Some(_) => println!("non-positive"),
None => println!("missing"),
}
What reflects Rust's expressive sensibility is that pattern matching is used not merely as branching, but as a direct query against data structure.
Haskell
Haskell's idioms center on function composition and leveraging the type system.
processItems :: [RawData] -> [Result]
processItems = map transform . filter isValid
Representative Haskell idioms:
function composition (
.) and point-free styleexpressing monadic computation with do-notation
ad-hoc polymorphism via type classes
Maybe/Eitherfor representing absence and failurepattern matching + guards
infinite data structures leveraging lazy evaluation
Functor / Applicative / Monad abstractions
readConfig :: FilePath -> IO (Either String Config)
readConfig path = do
contents <- readFile path
return (parseConfig contents)
In Haskell, idioms are often directly tied to mathematical abstractions such as monads and functors, making this the area where the most is lost in translation to other languages.
Anti-idioms: Expressions to Explicitly Avoid
Negative examples are often more effective than positive ones when teaching idioms. Each language ecosystem has a catalog of anti-idioms that are explicitly considered "do not write it this way."
Python:
- mutable default argument: def f(x=[]):
- bare except ์ : except: (์์ธ ์ข
๋ฅ ๋ช
์ ์์ด)
- ์ ์ญ ๋ณ์ ๋ณ๊ฒฝ (global ํค์๋)
- type hint ์๋ ๊ณต๊ฐ API
C++:
- ํค๋์ using namespace std;
- raw new / delete (์ค๋งํธ ํฌ์ธํฐ ๋์ )
- C ์คํ์ผ ์บ์คํธ ((int)x)
- ๊ฐ์ ์๋ฉธ์ ์๋ ๋คํ์ฑ ํด๋์ค
JavaScript / TypeScript:
- == (๋์จํ ๋น๊ต, === ์ฌ์ฉ)
- var (let / const ์ฌ์ฉ)
- any๋ก ํ์
์์คํ
์ฐํ (TypeScript)
- ์ง์ mutation์ผ๋ก React ์ํ ๋ณ๊ฒฝ
C#:
- async void (์ด๋ฒคํธ ํธ๋ค๋ฌ ์ ์ธ)
- .Result / .Wait() ๋๊ธฐ ์ฐจ๋จ
- ๋น catch ๋ธ๋ก
- IDisposable์ using ์์ด ์ฌ์ฉ
Go:
- ์๋ฌ ๋ฌด์ (_ = err)
- nil ์ฑ๋/์ฌ๋ผ์ด์ค์ ๋ํ ๊ฐ์
- goroutine ๋์ (context ์์ด ๋ฌดํ ๋๊ธฐ)
- panic์ ์ผ๋ฐ ์๋ฌ ํ๋ฆ์ ์ฌ์ฉ
Rust:
- ๋ฌด๋ถ๋ณํ .clone()์ผ๋ก borrow checker ์ฐํ
- unwrap() ๋จ์ฉ (Result/Option ์ง์ ์ฒ๋ฆฌ)
- unsafe ๋ธ๋ก ๋จ์ฉ
- ํฐ enum variant๋ฅผ Box ์์ด ์ฌ์ฉ
Anti-idioms are not merely style issues. Most have real impact on safety or performance, and they are actively detected by linters and static analysis tools.
The Temporal Nature of Idioms
Idioms are not fixed constants. They change across generations as language standards are revised, standard libraries evolve, and community consensus shifts. Therefore, when discussing idioms, a temporal coordinate of "which era's idioms" is needed alongside the discussion.
Generational Changes in C++
C++98 ์๋:
- std::auto_ptr
- raw new / delete
- ์ง์ ์์ฑํ ์ปจํ
์ด๋ ์ํ
C++11 ์ดํ:
- std::unique_ptr / std::shared_ptr
- range-based for
- auto, lambda, move semantics
C++17 / C++20 ์ดํ:
- std::optional, std::variant
- structured bindings
- ์ปจ์
(concepts), ๋ชจ๋, ์ฝ๋ฃจํด
C++98 code still works if left as-is, but from a modern C++ perspective, it is no longer idiomatic.
Generational Changes in Python
Python 2:
- print ๋ฌธ, unicode ๋ช
์ (u"...")
- xrange / range ๊ตฌ๋ถ
- new-style class ๋ old-style class
Python 3:
- print ํจ์, ๋ฌธ์์ด = unicode ๊ธฐ๋ณธ
- f-string (3.6+)
- type hint (3.5+, 3.10+์์ |๋ก union)
- dataclass, asyncio
- ๊ตฌ์กฐ ๋ถํด์ match-case (3.10+)
Generational Changes in JavaScript
ES5 ์๋:
- var, function ์ ์ธ
- prototype ๊ธฐ๋ฐ ์์
- callback hell
ES6 ์ดํ:
- let / const, arrow function
- class ํค์๋, ๋ชจ๋ import/export
- Promise, async/await
- destructuring, spread/rest
- optional chaining, nullish coalescing (ES2020)
Even within the same language, when writing or reviewing code, one should be conscious of "which generation's idioms this belongs to." When maintaining an older codebase, consistently preserving the idioms of that era may be preferable to mixing in newer-generation idioms.
Sources and Authority of Idioms
Who decides idioms? There is no single authority; they emerge from the interaction of multiple sources.
1. ์ธ์ด ์ค๊ณ์ / ๊ณต์ ์ ์
- Python์ PEP, Rust์ RFC, JS์ TC39 proposal
- ๊ณต์ ๊ถ์ฅ ์ฌํญ์ด ์ด๋์์ ์ถ๋ฐ์
2. ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ์ ์๊ธฐ ์ฌ์ฉ ๋ฐฉ์
- ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ๊ฐ ์๊ธฐ API๋ฅผ ์ด๋ป๊ฒ ์ฐ๋์ง๊ฐ ์ฌ์ค์ ํ์ค
- Python์ itertools, Go์ io ํจํค์ง, Rust์ std ๋ชจ๋
3. ๋ฆฐํฐ / ํฌ๋งคํฐ์ ๊ธฐ๋ณธ ๊ท์น
- rustfmt, gofmt, prettier, eslint, ruff, pylint
- ์๋ ์ ์ฉ๋๋ฏ๋ก ์ฌ์ค์ ๊ฐ์ฅ ๊ฐํ ๊ฐ์ ๋ ฅ
4. ์ ๋ช
์คํ์์ค์ ์ฌ์ค์ ํ์ค
- React ์ฝ๋๋ฒ ์ด์ค, Django ํ๋ก์ ํธ, Kubernetes ์์ค
- ํฐ ํ๋ก์ ํธ์ ๊ด๋ก๊ฐ ์ปค๋ฎค๋ํฐ ์ ์ฒด๋ก ํ์ฐ
5. ๊ถ์ ์๋ ์ฑ
๊ณผ ๊ฐ์ด๋
- Effective C++, Effective Java, Fluent Python
- The Rust Book, Real World Haskell
- Google Style Guide
When these sources conflict (for example, when the style recommended by rustfmt differs from community practice), deciding which to follow is a matter of practical judgment. Generally, (3) linters/formatters > (2) standard library > (1) official proposals carry stronger enforcement, while the weight of (4) and (5) varies by context.
Idioms Reveal a Language's Philosophy
The reason idioms differ across languages is not merely that the syntax differs; it is that the mindset each language encourages is different.
Python: ๋ช
ํํจ, ๊ฐ๊ฒฐํจ, ๋์ ํ๋กํ ์ฝ
C++: ์์ ์๋ช
, ๊ฐ ์๋ฏธ, ๋น์ฉ ๋ชจ๋ธ
Java: ๋ช
์์ ํ์
, ์ธํฐํ์ด์ค, ๊ฐ์ฒด ๋ชจ๋ธ
JavaScript: ํจ์ ๊ฐ, ๋น๋๊ธฐ ์ด๋ฒคํธ, ๊ฐ์ฒด ๋ฆฌํฐ๋ด
Rust: ์์ ๊ถ, ๋น๋ฆผ, ๋ช
์์ ์ค๋ฅ ์ฒ๋ฆฌ
Go: ๋จ์ํ ์ ์ด ํ๋ฆ, ๋ช
์์ ์๋ฌ ๋ฐํ
Haskell: ์์์ฑ, ํ์
, ํฉ์ฑ
As a result, directly transplanting the idioms of one language into another produces awkward code.
Java์ class hierarchy๋ฅผ Python์ ๊ทธ๋๋ก ์ฎ๊ธฐ๋ฉด ๊ณผํ๊ฒ ๋ฌด๊ฒ๋ค.
Python์ duck typing์ Java์ ๊ทธ๋๋ก ์ฎ๊ธฐ๋ฉด ํ์
์์คํ
๊ณผ ์ถฉ๋ํ๋ค.
C++์ ์๋ช
์ ์ด ๊ฐ๊ฐ ์์ด C++ ์ฝ๋๋ฅผ ์ฐ๋ฉด ์์ ๋์๊ฐ ๋๋ค.
JavaScript์ ๋์ ๊ฐ์ฒด ๊ฐ๊ฐ์ Rust์ ๊ทธ๋๋ก ๊ฐ์ ธ์ค๋ฉด ์์ ๊ถ ๋ชจ๋ธ๊ณผ ์ถฉ๋ํ๋ค.
Haskell์ ํจ์ ํฉ์ฑ์ Java์ ๊ทธ๋๋ก ์ฎ๊ธฐ๋ฉด ์ด์ํ functional interface ํญ์ฆ์ผ๋ก ๋๋๋ค.
What Makes a Good Idiom
A good idiom is not simply short code.
์ข์ ์ด๋์ =
์ธ์ด๊ฐ ์ ๊ณตํ๋ ์์ ์ฅ์น๋ฅผ ํ์ฉํ๊ณ
์ํ๊ณ๊ฐ ๊ธฐ๋ํ๋ ํํ๋ฅผ ๋ฐ๋ฅด๋ฉฐ
์ฝ๋์ ์๋๋ฅผ ๋น ๋ฅด๊ฒ ๋๋ฌ๋ด๋ ํํ
A good idiom has the following properties.
The reader can immediately grasp the intent.
It fits well with the standard library.
It reduces hazardous points such as exceptions, resource release, and concurrency.
It works well with tools, linters, type checkers, and formatters.
It does not create unnecessary abstractions.
How to Learn Idioms
Idioms are difficult to learn from a grammar book alone. You need to read the standard code of the actual ecosystem and ask questions actively.
1. ๊ณต์ ๋ฌธ์์ ์์ ์ ์๊ธฐ ์ฌ์ฉ ๋ฐฉ์ ๋ณด๊ธฐ
2. ํ์ค ๋ผ์ด๋ธ๋ฌ๋ฆฌ ์ฌ์ฉ ํจํด ๋ถ์
3. ์ ๋ช
์คํ์์ค์ ์์ ๋ชจ๋ ์ฝ๊ธฐ
4. ๋ฆฐํฐ์ ํฌ๋งคํฐ๊ฐ ๊ถ์ฅํ๋ ํํ ํ์ธ
5. Effective X, The * Book๋ฅ ๊ถ์ ์๋ ๊ฐ์ด๋ ์ฝ๊ธฐ
6. "Why Do We Write It This Way in This Language?"๋ฅผ ํญ์ ์ง๋ฌธํ๊ธฐ
Key questions when learning idioms:
์ด ์ธ์ด์์๋ ์์ ์๋ช
์ ์ด๋ป๊ฒ ํํํ๋๊ฐ?
์ค๋ฅ๋ฅผ ์ด๋ป๊ฒ ํํํ๋๊ฐ? (์์ธ, Result, errno, panic)
๋ฐ๋ณต๊ณผ ์ปฌ๋ ์
์ฒ๋ฆฌ๋ ์ด๋ป๊ฒ ์ฐ๋๊ฐ?
์ถ์ํ ๋จ์๋ ํจ์์ธ๊ฐ, ๊ฐ์ฒด์ธ๊ฐ, trait์ธ๊ฐ, interface์ธ๊ฐ?
๋์์ฑ๊ณผ ๋น๋๊ธฐ๋ ์ด๋ค ๋ฐฉ์์ด ์์ฐ์ค๋ฌ์ด๊ฐ?
๋ชจ๋ ๊ฒฝ๊ณ๋ ์ด๋์ ๊ทธ์ด์ง๋๊ฐ?
Consistently applying these questions lets you absorb the idioms of a new language quickly.
Research Trends
Idioms are a qualitative concept, but recent efforts have attempted to extract them quantitatively through source code mining. Allamanis and Sutton (2014) published research on automatically extracting repeatedly occurring pattern fragments from large GitHub codebases using statistical methods, naming the approach "mining idioms from source code."[1]
Such automated extraction can be used to quickly identify idiomatic expressions in a language being newly learned, or as the basis for code review tools that detect anti-idioms. However, statistically frequent expressions cannot be assumed to be idiomatic without cross-validation against authoritative sources.
Cognitive research has also been conducted on how barriers to idiom learning operate in crowdsourced development environments.[2]
Summary
A Programming Idiom is a small code expression convention considered natural in a specific language.
ํจ๋ฌ๋ค์์ ์ฌ๊ณ ๋ฐฉ์์ ์ ํ๋ค.
์์น์ ํ๋จ ๊ธฐ์ค์ ์ ํ๋ค.
ํจํด์ ๋ฐ๋ณต ๋ฌธ์ ์ ํด๋ฒ์ ์ ํ๋ค.
์ด๋์์ ์์ฐ์ค๋ฌ์ด ํํ์ ์ ํ๋ค.
๋ฌธ๋ฒ์ ๊ฐ๋ฅํ ํํ ๊ท์น์ ์ ํ๋ค.
A good developer is not simply someone who knows the syntax, but someone who can naturally express problems through the idioms of the language. Idioms change over time, their sources are distributed, and they are paired with explicit negative examples (anti-idioms). Being conscious of all three dimensions significantly accelerates adaptation when encountering a new language.
See Also
Design Pattern
Software Design Patterns
Programming Paradigm
Functional Programming
RAII
Standard Idioms
Idiomatic Code
Pythonic
Modern C++
Idiomatic Rust
Composition over Inheritance
Linguistic Idioms
Cognitive Load
Algorithm Skeleton
Embedded SQL
External Links
Programming-Idioms.org - A comparative database of idioms by language
Categories: Programming | Programming Languages | Software Engineering | WIKI
Footnotes
- Allamanis, Miltiadis; Sutton, Charles (2014). "Mining idioms from source code". Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. pp. 472โ483. arXiv:1404.0417. doi:10.1145/2635868.2635901.Allamanis, Miltiadis; Sutton, Charles (2014). "Mining idioms from source code". Proceedings of the 22nd ACM SIGSOFT International Symposium on Foundations of Software Engineering. pp. 472โ483. arXiv:1404.0417. doi:10.1145/2635868.2635901. โฉ
- Samudio, David I.; Latoza, Thomas D. (2022). "Barriers in Front-End Web Development". 2022 IEEE Symposium on Visual Languages and Human-Centric Computing (VL/HCC). pp. 1โ11. doi:10.1109/VL/HCC53370.2022.9833127. โฉ