Information Technology Reference
In-Depth Information
Comparing the Generic and Non-Generic Stack
Table 19-1 summarizes some of the differences between the initial non-generic version of the
stack and the final generic version of the stack. Figure 19-8 illustrates some of these differences.
Table 19-1. Differences Between the Non-Generic and Generic Stacks
Non-Generic
Generic
Source Code Size
Larger: you need a new imple-
mentation for each type.
Smaller: you only need one imple-
mentation regardless of the
number of constructed types.
Executable Size
The compiled version of each
stack will be present, regardless of
whether it is used.
Only types for which there is a
constructed type are present in
the executable.
Ease of Writing
Easier to write.
Harder to write.
Difficulty to Maintain
More error-prone to maintain,
since all changes need to be
applied for each applicable type.
Easier to maintain, because modi-
fications are only needed in one
place.
Figure 19-8. Non-generic stack versus generic stack
Search WWH ::




Custom Search