Write-Only Code

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.

Related Terms

Margaret Rouse

Margaret is an award-winning technical writer and teacher known for her ability to explain complex technical subjects to a non-technical business audience. Over the past twenty years, her IT definitions have been published by Que in an encyclopedia of technology terms and cited in articles by the New York Times, Time Magazine, USA Today, ZDNet, PC Magazine, and Discovery Magazine. She joined Techopedia in 2011. Margaret's idea of a fun day is helping IT and business professionals learn to speak each other’s highly specialized languages.