Softcoding: Difference between revisions

Content deleted Content added
no longer Worse THan Failure
Robbak (talk | contribs)
I hope that reduces its tendency to confuse.
Line 1:
'''Softcoding''' is a [[computer programming|computer coding]] term that means abstracting a current or planned hard coded value or function into a container that is controllable external to the main function, thatlike coulda beconfiguration changedfile, withoutdatabase affectingtable, theor mainexternal functionregistry. ifThe requiredterm (maywas involvecoined recompileas butthe noopposite change toof the mainexisting codeterm, set)[[Hardcoding]].
{{Confusing|date=February 2009}}
 
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 Numbers]] in their code, to improve its readability, and assist maintenance. These practice are generally not referred to as 'softcoding'.
'''Softcoding''' is a [[computer programming|computer coding]] term that means abstracting a current or planned hard coded value or function into a container that is controllable external to the main function, that could be changed without affecting the main function if required (may involve recompile but no change to the main code set).
 
SoftcodingThe canterm alsois begenerally used where Softcoding becomes an [[anti-pattern]]. ifAbstracting abstractingtoo themany values introducesand features can introduce more complexity inand maintenance issues than justwould 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.