Skip to main content

Sign in to CleanKata

Track your progress, earn XP, and unlock every lesson.

By signing in you agree to our Terms of Use and Privacy Policy.

Object Calisthenics60 XP6 min

Keep All Entities Small

No class over 50 lines, no package over 10 files β€” small classes fit on one screen, force focus, and naturally organize into cohesive packages.

Why this matters

A class that doesn't fit on one screen is a class with too many secrets. You cannot hold its entire behavior in your head at once, which means you cannot reason about it, test it, or change it with confidence. The 50-line limit is not arbitrary β€” it is the forcing function that makes you extract responsibilities before they grow into unmanageable masses. The same logic applies to packages: 10 files per package means each package has a clear, singular purpose that you can describe in one sentence.

Code Challenge

Study the messy code, try to refactor it, then reveal the clean version.

πŸ’‘Key takeaway

A class that doesn't fit on one screen is a class that has too many secrets. Break it up until everything is visible β€” 50 lines per class, 10 files per package forces the discipline that makes code navigable and changeable.

πŸ”§ Some exercises may still have errors. If something seems wrong, use the Feedback button (bottom-right of the page) to report it β€” it helps us fix it fast.

Hint: A class that doesn't fit on one screen is a class that has too many secrets. Break it up until everything is visible.

βœ— Your version

Keep All Entities Small β€” CleanKata β€” CleanKata