← Graph

Prefer delegation over inheritance

takeaway 1 connections

Drawn from Q&A. Chikahiro Tokoro agrees with Sandi Metz that inheritance is limited — textbook animal/cat/dog examples rarely map onto real business domains. Delegation, or extracting collaborating objects with concerns, usually models reality better and avoids accumulating behaviour in a parent God class.

type
recommendation
takeaway Prefer delegation over inheritance
from_talk
From Q&A about whether inheritance causes God objects.

Provenance