One-off code

One-off code is a computer program written for a specific purpose the programmer expects not to reuse.

For example, a person might need to categorize a set of text files according to some criteria. If there are hundreds of files and he knows a suitable programming language (e.g. Perl), he might write a program to automate the process, especially if he expects the effort spent on writing a computer program to do the task will be less than that required to categorize the files manually. Further, if he expects never to have to repeat the task, a different approach than that suitable to regular categorization tasks will be likely.

One-off code tasks may feature less formal code writing, a lack of in-code comments, and quick and dirty techniques. Conversely, a programmer expecting to have to do a given task regularly might spend more time on making the program parameterizeable, general, usable as a component or subroutine, and "presentable": suitable for publication under the programmer's name.

Historically, interpreted languages were geared towards such one-off coding, while compiled languages existed for programs of lasting value. Today, that difference has vanished for two reasons: many interpreted languages are used in large projects (Perl, Python, etc.), and, on the other hand, some compiled languages contain facilities specifically aimed at one-off programming. For example, the compiled programming language D employs very rapid compilation (comparable to the first phase of running a Perl program), and the compiler provides a "compile and run at once" switch,[1] many users use D for tasks where one would typically use Perl, Shell, or Python.

See also

References