Hardcoding
![]() |
Hardcoding is a practice in Software engineering in which items of data or of behaviour are built into the computer program instead of being loaded from a file or obtained from some other configuration mechanism.
Hardcoding is generally considered a bad practice because it denies end users the ability to change those data items in the future without having access to the source code of the program and the means to recompile it.
As an example, one might write a computer program to calculate the speed of sound in air at a range of altitudes. However, this calculation also requires the temperature of the air. If the program was written with a constant 10 decrees centigrade written into the program than the air temperature would be said to be 'Hard Coded'. It would perhaps have been better to allow the end user to choose the temperature instead.