hard code

hard code

[′härd ′kōd]
(computer science)
Program statements that are written into the computer program itself, in contrast to external tables and files to hold values and parameters used by the program.
McGraw-Hill Dictionary of Scientific & Technical Terms, 6E, Copyright © 2003 by The McGraw-Hill Companies, Inc.

hard coded

(1) A part of a program that has been declared as unchanging. For example, a constant is hard coded and remains the same throughout the execution of the program.

(2) Programming code that solves a problem but offers less flexibility for future changes. Hard coding may get the job done, but it can be thought of as "brute force" programming. The degree to which a program is hard coded determines how difficult it will be to modify later when new types of data are introduced or new functions are added.

Easier and Faster
Very often, an application is hard coded first and generalized later. The reason is simple. It is always easier and faster to hard code a solution than to write a generalized routine that handles a variety of possibilities.

Hard Coding vs. Hand Coding
Hard coding and "hand coding" are not the same thing. Hard coding refers to writing a fixed solution. Hand coding means writing individual statements in a programming language rather than using a preprogrammed routine. See hardwired, hand coding, generalized program and data independence.

Fixed vs. Variable Example
In the following pseudocode example, it takes half as many lines to hard code bouncing a ball 10 times rather than a variable number of times. See pseudocode.

Hard Coded (fixed number)

  1    ballCount = 0
  2    bounce ball
  3    add 1 to ballCount
  4    if ballCount = 10
  5       stop
  6    goto loop

   Generalized Code (variable number)

  1    display "Enter Bounce Count"
  2    input to maxCount
  3    if maxCount not an integer
  4       display "Not a valid number."
  5       goto start
  6       ballCount = 0
  7    if ballCount not = maxCount
  8       bounce ball
  9       add 1 to ballCount
 10       goto loop
 11    else
 12       stop
Copyright © 1981-2019 by The Computer Language Company Inc. All Rights reserved. THIS DEFINITION IS FOR PERSONAL USE ONLY. All other reproduction is strictly prohibited without permission from the publisher.
References in periodicals archive ?
WRIGHT'S "HARD CODE": A DECADE OF HARD-WON LESSONS FROM MICROSOFT (9780735661707, $44.99) appears in its second updated edition to provide insights on how to increase software value and reliability.
Canon Jeremy Duff supporting the launch of DontDrainUS.org Pictures: JASON ROBERTS/jr290109water-3; Churches, charities and clubs will be hit hard Code: jr290109water-1
Brechner collects 49 "Hard Code" columns written by his alter ego I.M.
There is no processing limit and no need for the user agents to hard code a carrier's proxy address into their network configuration schemas.
Features include enumerated types that avoid the need to hard code instructions, like using numbers to specific a color.
"There are experienced operators that are good enough to do our type of work with old hard code," says Knapke.
Technically, the Lotus software deals with making full-screen apps suitable for viewing on restricted screen size mobile phones either by rendering standard code into wireless markup language or allowing developers to hard code applications in WML.
"Column width is a hard code in classified pagination," he said, explaining that with older systems, it is harder to change column widths.