Stubs are simply functions or procedures that do not have a body to them. In other words, they are empty. They are good in a menu driven, or event driven for that matter, programming language because they help provide a rough structure of the program. Think of it as the wood framing of a house. Nothing inside them yet, but it gives you an idea of what the house will look like, structure wise, when it is complete.
And like the framing of a house, it also helps the builder (in our case programmer) make sure that all the walls meet together nicely, and can efficiently hold up the rest of the program by making it modularized, readable, and more easily maintained.
You will often hear in the industry as "stubbing out" a program where the programmer puts several of these empty functions together in order to fill out what the program will look like. Then after everything is in place, the programmer can go back and fill in each function/sub procedure with code. This is known as "fleshing" it out.
Studies have shown that programmers who stub out a program before jumping into the specifics have better structure and better overal design.
Hope this helps you out. Enjoy!
2006-10-18 10:16:17
·
answer #1
·
answered by Martyr2 7
·
2⤊
0⤋