Softcoding: Difference between revisions

Content deleted Content added
Robbak (talk | contribs)
m Correcting 'magic numbers' link
Changed redirect target from Hard coding to Hard coding#Softcoding
Tag: Redirect target changed
 
(38 intermediate revisions by 26 users not shown)
Line 1:
#REDIRECT [[Hard coding#Softcoding]]
'''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]].
 
{{R from merge}}
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>.
 
At the extreme end, soft-coded programs develop their own poorly-designed and implemented scripting languages, and configuration files that require advanced programming skills to edit. This can lead to the production of utilities to assist in configuring the original program, and these utilities often end up being 'softcoded' themselves.
 
To avoid 'softcoding', consider the value to the end user of any additional flexibility you provide, and compare it with the increased complexity and related ongoing maintenance costs the added configurability involves.
 
In [[feature design]], softcoding has other meanings.
* [[Hardcoding]]: feature is coded to the system not allowing for configuration
* [[Parametric]]: feature is configurable via table driven, or properties files with limited parametric values
* Softcoding: feature uses “engines” that derive results based on any number of parametric values (i.e. business rules in BRE); rules are coded but exist as parameters in system,written in script form
 
==References==
{{reflist}}
 
[[Category:Software development]]
[[Category:Anti-patterns]]
 
 
{{Soft-eng-stub}}