Write-Only Code

Why Trust Techopedia

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.

Advertisements

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.
Advertisements

Related Terms

Margaret Rouse
Technology Specialist
Margaret Rouse
Technology Specialist

Margaret is an award-winning writer and educator known for her ability to explain complex technical topics 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 in 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 to help IT and business professionals to learn to speak each other’s highly specialized languages.