Softcoding: Difference between revisions

Content deleted Content added
Robbak (talk | contribs)
I hope that reduces its tendency to confuse.
Robbak (talk | contribs)
m Correcting 'magic numbers' link
Line 1:
'''Softcoding''' is a [[computer programming|computer coding]] term that means abstracting a value or function into a container that is controllable external to the main function, like a configuration file, database table, or external registry. The term was coined as the opposite of the existing term, [[Hardcoding]].
 
Avoiding hard-coding of commonly altered values is a good programming practice. Users of the software should be able to customize it to their needs, within reason, without having to edit the program's source code. Similarly, careful programmers avoid [[Magic number (programming)#Unnamed numerical constants|Magic Numbers]] in their code, to improve its readability, and assist maintenance. These practice are generally not referred to as 'softcoding'.
 
The term is generally used where Softcoding becomes an [[anti-pattern]]. Abstracting too many values and features can introduce more complexity and maintenance issues than would be experienced with changing the code when required. Softcoding, in this sense, was featured in an article on [[The Daily WTF]].<ref>[http://worsethanfailure.com/Articles/Soft_Coding.aspx Softcoding] from [[The Daily WTF]]</ref>.