What it is not so good for

The composite design pattern pattern does not have any major drawbacks. It really is applicable in specific cases. One thing developers should be careful about is when they deal with massive hierarchies. The reason is that in such cases, we could have really deeply recursive nested items and this could cause stack overflow issues.

Get Scala Design Patterns - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.