The key idea behind working with any type of procedure is to break down your program into a series of smaller tasks. Each of these tasks can then be encapsulated in a procedure, function, or possibly a class. (Classes are discussed in Chapter 9, “Creating Code Components.”) Programming in this manner presents several advantages:
You can test each task individually. The smaller amount of code in a procedure makes debugging easier and makes working on the same project with other developers easier.
You can eliminate redundant code by calling a procedure each time a task needs to be performed instead of repeating the program code.
You can create a library of procedures that can be used in more than one program, saving yourself ...