I am not native English speakers, I often see " on the fly " in some program docs or blogs. I don't know the exact meaning of it. Is it a idiom?


Since sandman doesn't have any advanced knowledge of the database structure, it can't rely on pre-made model classes to register tables. Rather, it needs to introspect the database and create these classes on the fly.


The paragraph above is from here. In the chapter named "When Is This Ever Useful?".

closed as off-topic by tchrist, FumbleFingers, Matt E. Эллен, choster, aedia λ Jan 3 '14 at 18:22

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions that can be answered using commonly-available references are off-topic. A list of these references can be found here: List of general references" – tchrist, FumbleFingers, Matt E. Эллен, choster, aedia λ
If this question can be reworded to fit the rules in the help center, please edit the question.

  • I think it means unprepared. – tipsywacky Jan 3 '14 at 1:56
  • 1
    @tipsywacky: In principle, yes. But unprepared normally implies being caught unawares, having failed to make the necessary preparations. Whereas people who do things on the fly are usually in complete control (often because they know they're good enough to handle whatever crops up as it arises). – FumbleFingers Jan 3 '14 at 2:56
  • @atupal: I think your particular source is somewhat suspect. So far as I know, introspect is just a rare archaic version of inspect. Google Books has just 6 instances of introspect the database, but hundreds of inspect the database. But even if we allow the cited usage, it's completely at odds with the informal register of "doesn't" and "on the fly". – FumbleFingers Jan 3 '14 at 3:05
  • 1
    @FumbleFingers You are right. I used to do magic, and we say performing "on the fly" when we haven't prepared to do any tricks. The implication is that we have already practiced many times and we are able to perform unprepared and would still be able to show some good tricks. – tipsywacky Jan 3 '14 at 5:56
  • @FumbleFingers Thanks for point out that. Thw source is here, In the chapter named "When Is This Ever Useful?". – atupal Jan 3 '14 at 6:03

We computer folks don't really use it as jargon; it means the same thing it does in standard English.

Its possible the term came from Baseball, as that's the only other place I can dig it up. For example, here's a story about players hitting a ball into nearby river "on the fly" (in this context that means, without it hitting the ground). It is also used in that game to indicate a throw that someone makes immediately after a catch without stopping to make a separate throwing motion.

The general gist in a program is that it is an activity that is done when needed, rather than being done in a separate execution (typically beforehand). So in the computer sense, that means the work is done while the program is executing, rather than doing it "offline", or once before any program is run and reused every run.

The advantage of creating something "on the fly" is that you can create it based on the very latest information. The disadvantage is that you may end up doing a lot of work to create the same thing multiple times.

  • 1
    OED has 1851 H. Mayhew London Labour II. 51/2 Taking them on the fly; which means meeting the gentry on their walks, and beseeching or at times menacing them till something is given. That's in the UK, some years before their first "baseball-related" citation, so I don't think we can really say it "came" from baseball. Arguably the baseball usage is more "literal" anyway. At least London's gentry could be "taken on the fly" even while sitting down on a park bench mid-walk, but there's always physical motion in the baseball sense. – FumbleFingers Jan 3 '14 at 2:50
  • @FumbleFingers - Good find. But by "came from" I meant a bit more directly than that. Is there any other realm other than CS and Baseball that still uses this term? It seems to me there ought to be, but I can't think of or find any. – T.E.D. Jan 3 '14 at 15:40
  • I took your means the same thing it does in standard English to imply the term is used in many other contexts besides CS and Baseball. That's certainly how I see it (as presumably does @tipsywacky, from comments to the question). But I must admit I'm a bit disappointed Entomologists do it on the fly didn't find any hits in Google (perhaps if someone else thinks of that one again sometime in the future, Google will point them to this very comment! :) – FumbleFingers Jan 3 '14 at 16:34

It means as-needed. Things created on the fly are not programmed at compile time, they are generated at runtime, or even on-demand (when they are first used). In your example, Classes are usually completely written and implemented in code that is compiled and later run, but in this case the class definitions and implementations are created when the app reads the database, at runtime.

Not the answer you're looking for? Browse other questions tagged or ask your own question.