ALERT

Cisco CloudCenter: Get the Hybrid IT Advantage

Write-Only Code

Definition - What does Write-Only Code mean?

Write-only code is a code that is difficult to read and interpret, and is therefore only understood by the code's author. Write-only code may be either poorly structured, or just a complicated written code.

Programming languages, like FORTRAN, APL, and C are fairly complex. When coding conventions are not followed, the code written in these languages becomes write-only code. Consequently, these languages are sometimes known as write-only languages.

Techopedia explains Write-Only Code

Coding conventions should be applied to prevent write only code generation, including:

  • Avoid single-letter variable names: Single letter variables, like a and b, do not define the purpose from the variable, computation, or result. Thus, only the author may interpret code containing single-letter variable names. More meaningful variable name selections are recommended.
  • Use meaningful phrases to define functions: A function printed on a screen may be named Display() or PrintScreen(). However, a name like RoutineX48() does not make sense. Thus, illogical naming practices should be avoided.
  • Variable Reuse: One of the most important defined language properties is the variable scope. Variables with identical names may exist outside relative scopes. Use variables with the same name to denote similar functions or computations. Ensure that the reused variable's scope definition does not interfere with the previous declaration.
  • Underscore: In many programming languages, a developer is not able to use space between different words when forming a variable. Underscore should be used to separate words, or each word's first letter should be capitalized to avoid write-only code.
Share this: