Answer

  1. It is nice to be able to share code among different projects. Although you and I may both be working on different programs, there may be some functions that we both need to write and use. The proper approach is to write these functions, put them together in a single file, and then share the file between us. If we each insist upon putting our entire program into one file, then we will each have to make a copy of the ``shared'' functions.
  2. The problem with each of us having identical copies of the ``shared'' functions is that they will not be identical for long. If we are sharing one copy, then any improvements or additions that either of us make will be automatically shared between us.
  3. As we will see, when programs are divided into multiple files and one of the files changes, only the changed file must be recompiled. If all the files in a project are small, this means that a small change results in only a small amount of recompilation. This can result in a significant savings in time.

Return to lesson.