Something is said to be hard-coded if the end-user cannot change it without editing your code.
This can include:
- a dependency on a specific module or library
- the behaviour of your code (ie its logic or algorithm)
Hard-coding something isn't always a bad thing. Functions with hard-coded dependencies and logic are necessary to avoid repeating code across an application.
As a rule of thumb, we prefer to create:
- general functions that support dependency injection, and
- specific functions that pass hard-coded dependencies into the underlying general function.