What is meaning of "on the fly" in computer science? [closed]
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?
e.g.:
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.
update:
The paragraph above is from here. In the chapter named "When Is This Ever Useful?".Solution 1:
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.
Solution 2:
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.