Some of the statements about separate compilation follow. Which are correct? Comment on all the answers in the explanation section, including the ones that are wrong.
a. Separate files are a big bother. There is no compelling advantage to separate files.
b. Placing client and class implementations in separate files enhances project development. How?
c. Separate files for interface and implementation enhance reuse. How?
d. Separating interface and implementation can save considerable time. How?
b) c) d) are correct.
Explanation:
a) There is a grain of truth here, but it is basically incorrect. For small programs, placing all the code in a single file makes the program easier to understand, edit, compile and use. On the other hand, reuse is made much more difficult. This practice exposes the client programmer to the implementation details and the class author to the details of the client’s use. Changing anything will be hard.
b) Separate files: Changing the implementation of either the class or the client code does not require a change in the implementation of the other, so long as the interface stays the same. The client and class development can proceed in parallel.
c) The implementation file needs to be compiled only once. A program that uses the class can #include the interface, compile and link to the precompiled implementation file.
d) You can use the class in other programs without needing to rewrite the class definition or implementation. Unchanged files do not require recompilation. They need only to be relinked. For programs of moderate size, the saving in rewriting time exceeds saving in recompilation time. (For very large programs the reverse may well true. Some Linux kernels (12 MB of source code) on some machines can take overnight to compile completely, but only a few minutes to recompile a small file and link.)
You might also like to view...
A distributed denial-of-service attack requires zombies running on numerous machines to perform part of the attack simultaneously. If you were a system administrator looking for zombies on your network, what would you look for?
What will be an ideal response?
C# has more than 100 defined Exception subclasses.
Answer the following statement true (T) or false (F)