Component size
This chapter has a section on component size.
You would think that, all else being equal, the smaller the size of a component the better. (Ignoring the associated problem of too many components). But there is evidence that small is not better. Some measurements were made by Hatton. He found that very small components have more faults. If you measure the fault density - the number of faults per line of code (LOC), in real life software, you get a distribution as shown in figure 1. This shows a sweet spot, the optimum size of components of about 200 to 400 LOCs. Why should this be so? One explanation is that, if a component becomes very small, it has a large number of complicated connections (method calls) to other components and this increases the complexity, understandability and fault rate of the component.
Figure 1. Faults vs.
Component Size
Reference
IEEE Software. “Re-examining the Defect-Density versus Component Size Distribution”. March/April 1997.