One-off code
| This article is an orphan, as few or no other articles link to it. Please introduce links to this page from related articles; suggestions may be available. (December 2008) |
| This article relies largely or entirely upon a single source. Please help improve this article by introducing citations to additional sources. Discussion about the problems with the sole source used may be found on the talk page. (December 2008) |
One-off code refers to computer programs that are typically written for some specific purpose that the programmer expects to need only once.
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.