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.)

Computer Science & Information Technology

You might also like to view...

Assuming that x = 2 and y = 3, what does each of the following statements display?

``` a) System.out.printf("x = %d%n", x); b) System.out.printf("Value of %d + %d is %d%n", x, x, (x + x)); c) System.out.printf("x ="); d) System.out.printf("%d = %d%n", (x + y), (y + x)); ```

Computer Science & Information Technology

When using the IaaS model, as applications require greater computing power, what happens?

A. additional CPUs are added to the host B. additional virtual machines are deployed C. faster virtual CPUs are installed D. faster virtual disks are configured

Computer Science & Information Technology

A digital signature is a code attached to a file that verifies the identity of the creator of the file.

Answer the following statement true (T) or false (F)

Computer Science & Information Technology

If you encounter a class with a large responsibility (large class size or CS value) you should consider

A. making it a base class  B. partitioning the class C. starting a new class hierarchy D. making it a subclass

Computer Science & Information Technology