Quantcast
Channel: Open Source
Viewing all articles
Browse latest Browse all 6

Hard coding – the guide to hard coding

$
0
0

Hard coding(also, hard-coding or hardcoding)


Hard coding
(also, hard-coding or hardcoding) refers to the software development practice of embedding what may, perhaps only in retrospect, be considered an input or configuration data directly into the source code of a program or other executable object,
or fixed formatting of the data, instead of obtaining that data from external sources or generating data or formatting in the program itself with the given input.

Considered an anti-pattern, hard coding requires the program’s source code to be changed any time the input data or desired format changes, when it might be more convenient to the end user to change the detail by some means outside the program.

In computer programming or text markup, to hardcode (less frequently, hard code ) is to use an explicit rather than a symbolic name for something that is likely to chttps://en.wikipedia.org/wiki/Hard_codinghange at a later time. Such coding is sometimes known as hardcode (noun) and it is more difficult to change if it later becomes necessary.

Note that hard-coded entries often make coding pretty easy to read, but often very difficult to maintain.

References that are not hard coded add flexibility but add a level of abstraction that makes the program harder to read and debug (because you don’t know what a given variable contains without following through the logic of the code.)  This is where a skilled programmer can make an optimal program, but a beginner often makes something that runs slowly and is prone to errors

Very often, the processing is hard coded in the first release of an application and generalized later. The reason is simple. It is always easier to hard code a solution than to write a generalized routine that handles a variety of possibilities.  Hard coding is hard coding.

The post Hard coding – the guide to hard coding appeared first on Open Source.


Viewing all articles
Browse latest Browse all 6

Trending Articles