The term "ad hoc" is used in programming. What exactly does it mean?
10 Answers
"Ad hoc" is a Latin phrase that can apply to anything, not just programming specifically.
It means something that was made up on the fly just to deal with a particular situation, as opposed to some systematic approach to solving problems.
Regarding programming specifically, it's probably similar to what Joel Spolsky recently called duct tape programming.

- 4,503
- 4
- 21
- 42

- 52,325
- 13
- 128
- 140
-
3And the literal translation is *"to this/for this/for that purpose"*, or along those lines. – keyser Aug 12 '14 at 17:33
-
I always think of it as the opposite of "generic solution" – Pithikos May 11 '16 at 09:46
It basically means writing some quick and dirty code without the intention of reuse. User-entered queries are usually the main example. Another common occurrence is a utility to convert data sets from 1 form to another, which will have no use when the conversion is done.

- 51,193
- 8
- 108
- 113
-
4This is very true about using Ad-hoc. Ad hoc queries is a common term in data base programming. – siamak Apr 02 '15 at 16:34
Formed temporarily for a specific, non-continuing purpose, as an ad hoc committee on ice removal.
Impromptu, not planned, improvised, as an ad hoc attempt to remove the ice with a screw-driver.

- 143,358
- 22
- 150
- 216
Generally meaning improvised / impromtu / made up on the fly, such as ad-hoc reports or queries. Not pre-determind / pre-meditated

- 26,629
- 5
- 63
- 86
ad hoc means for one specific cause or approaching a solution in an unplanned way. In ad hoc we don't have any plan but have the deadline to finish the work. Ad hoc exists in different areas like programming, testing etc. In testing if perform ad hoc if the time assigned is very less and have to deliver the kit within that min amount of time then we will go for ad hoc.
In programming, it is basically that the developer is not working according to the plan but he is working bits and pieces from the whole code. Let me describe it.. there are 2 developers 1 and 2. they have to complete 3 module say A, B, C. If there is a plan then they can decide on which module they are going to work on it. but in ad hoc they can approach any of the modules in an unplanned manner.

- 625
- 3
- 12
- 24
The antithesis of "ad hoc" (which means, "specifically for this") might be "commercial off-the-shelf" (COTS) software, which is written to solve a general category of problem (e.g. word-processing or book-keeping) for several possible customers.

- 54,973
- 13
- 116
- 224
In the context of programming and software applications, ad hoc is typically used to signify that
some coding (or more generically, some definition/specification) is done at run-time,
rather than pre-defined and encaspsulated in the application.
Ad hoc items have the characteristic of being done to serve a particular purpose rather than a generic or pre-defined one.
Examples
One may run some ad-hoc queries in SQL to familarize oneself with the the database content. (Equvalent expression would be "writing queries on the fly"). This differs from one's writing queries in the context of a program whereby the list of columns to get, the filters to apply etc. are driven by the application's specifications.
In a very similar usage, and end-user may request the ability to run ad-hoc reports (equivalent expression/underlying concept: "a custom report feature"), which indicates the need for the application to allow end users to decide, at run time, which elements of the report they wish to see (possibly in which specific order etc.).
One may also [typically] quickly "whip-up" a small program for to serve a particular purpose, such as say to parse some input for loading a database (Possible equivalent: "Throw-away code"). Such ad-hoc programs are expected to be used once or a few times, and in the limited timeframe which surrounds the a particular task. The opposite would be to write a generic import utility which may be reused in similar but different contexts (and be use/reused over time).

- 73,152
- 14
- 113
- 156
Programming for a specific purpose, usually without any planning. An example would be a macro or something which is designed to do a single task and nothing else.

- 593
- 1
- 5
- 15
-
-
@Chuck: In this context, "designed to do a single task and nothing else" is being used to refer to an entire small program, not to the the components of a larger program. – Jeanne Pindar Nov 24 '09 at 00:19
I've heard it used in reporting, where I take it to mean letting the user choose what columns, grouping, and aggregate functions to put into a report,

- 3,399
- 1
- 23
- 24