> [!quote] [Wikipedia](https://en.wikipedia.org/wiki/Convention_over_configuration)
> Convention over configuration is a software design paradigm used by frameworks that attempts to decrease the number of decisions that a developer using the framework is required to make *without necessarily losing flexibility* and *Don't Repeat Yourself* ([[DRY and KISS|DRY]]) principles
*Convention over Configuration* really depends on whether:
- a technology is meant to be used as a [[Day 1 stack]], or;
- a technology is meant to be adopted in an existing system.
For the [[Day 1 stack]], there's no *existing convention* in conflict with the convention of a particular framework or ecosystem; thus one can go 100% on-board from the beginning. However, for an existing established codebase, this may not be feasilbe or impossible:
- Cost of migrating to the new *convention*.
- Difficulty of *incrementally* migrating to the new convention.
- Possibility of multiple *conventions* contradicting each other.
- Existing codebase may simply be incompatible / too nuanced for the convention. If the codebase started with such a convention, it would've evolved around the convention's limitation. However, post-hoc attempt to mold the codebase into convention may be too difficult.
# Instances
- directory structure
- Various dotfiles, config files, rcfiles that many project assume on the top level directory
- [[NextJS]]'s directory-based router.
- [[Go]]'s `internal` package.
- naming schemes
- [[Go]]'s casing-based visibility
- [[Java]]'s JavaBeans - getters and setters
- default behaviors
- [[Active Record]]'s table naming behavior (pluralizing class names into table names).
- Many [[ORM]]'s assumption of auto-incrementing integer primary keys.
- Go's `gofmt` and other gofmt-inspired formatters with very few knobs.
- [[Code Organization Structure]]
# Soft versus Hard *Convention over Configuration*
The Wikipedia definition has *without necessarily losing flexibility*, but some are seeing this as a feature.
Soft - convention can be configured over
Hard - convention is hard-coded and it cannot be overriden.
- [[Go]] is prime example of this; a lot of go's convention cannot be overriden.