Considerations
You should keep in mind that the delegation pattern introduces a new level of indirection, which can increase code complexity and make the code more difficult to understand. We should consider some factors when deciding to use the delegation pattern.
First, how much code can you reuse from the existing component? Is it 20%, 50%, or 80%? This ought to be the very first question you ask before you consider reusing an existing component. Let's call the amount of reuse the utilization rate. Obviously, the higher the utilization rate, the better it is from a reuse perspective.
Second, how much development effort can be saved by reusing an existing component? If the cost of developing the same functionality is low, then it may not ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access