Hand-written boilerplate a language feature writes (an __init__ that only stores its parameters)
Code nobody needs: one of the ways AI coding agents bloat software, from lessloc's pattern catalog. lessloc catches it as simpler.
What makes hand-written boilerplate a language feature writes a bad practice?
The standard that calls it a bad practice: PEP 557 (dataclasses).
What does lessloc do about hand-written boilerplate a language feature writes?
lessloc catches it as simpler.
simpler(tier 2): Brute-force code with a shorter idiom:== True, an if/else that returns the condition, an index loop that only readsxs[i],.filter(...).length > 0, a catch that only rethrows, a flag loop that isany(), a hand-built counter, an__init__that@dataclasswrites, a React Effect that only sets state. ruff and clippy add more.
Examples
Caught as simpler:
python
class Item:
def __init__(self, name, price, qty):
self.name = name
self.price = price
self.qty = qtyWritten well:
python
from dataclasses import dataclass
@dataclass
class Item:
name: str
price: float
qty: intRelated patterns
The other patterns in Code nobody needs:
- Options, flags, parameters or config for needs nobody named: lessloc gives every session a rule against it and catches it as
mode-flag. - An interface or abstract class with one implementation: lessloc catches it as
single-impl. - Wrappers that only forward; barrel files that only re-export: lessloc catches it as
wrapper. - A new function or import that nothing calls or tests: lessloc catches it as
unused(ruff adds unused variables). - Obsolete code kept behind a guard or flag instead of deleted: lessloc gives every session the rule: delete what the change makes dead.
- Tombstones: lessloc catches it as
history. - Stubs and fake success: lessloc catches it as
stub; it asks to finish the code or to tell the user what is not real yet. - Placeholders: # ... existing code ..., "your code here": lessloc catches it as
placeholderand refuses it before it lands. - Commented-out code: lessloc catches it as
commented-outand refuses it before it lands. - Debug leftovers: lessloc catches it as
debug-leftover. - A demo __main__ block or demo folder nobody asked for: lessloc catches it as
demo-codeandnew-folder. - A one-line helper used once: lessloc catches it as
single-use. - TODO and FIXME left behind: lessloc catches it as
todo; it asks to finish the work, or to record known debt asshortcut:and tell the user.

