PehromGroup
A file you can read in one sitting
A limit on file size looks like a style rule. It is not. It is the cheapest test we have for a file that has quietly taken on a second job, and the second job is always the part nobody can find when something breaks.
Published 18 November 2026
What a large file hides
A file grows past its size because a screen learned to validate, then to call the network, then to format a date, then to decide a permission. None of those steps felt wrong. Together they made one place where a fault could come from four directions, and a change for one of them can break the other three without the diff showing it.
The owner of a fact gets blurred the same way. If the rule for a permitted action lives in a component, a service and a test, the three will disagree and only one of them will be read. A file that holds one capability has one place to look, and that is the property the limit is really protecting.
The limit is a signal, not the decision
The numbers here are 250 lines for hand-written executable source, 500 for data and configuration, and no limit for documentation. Three questions run before the count matters: does this file do one thing, can it be read end to end without remembering an earlier file, and does understanding one function need two scrolls. A 400-line file that does one clean thing is accepted; a 150-line file doing three things is split.
Crossing the number is allowed, but only with a written reason and a reason class beside it, so the exception is visible in review instead of remembered by whoever wrote it. An exception nobody can see becomes the rule within a month.
Splitting by capability, not by line number
A file is split where a behaviour ends, never at an arbitrary line, and never into numbered fragments that only make sense together. The rule for a split is that each piece should be able to say what it owns in one sentence: the form, the calculation, the request, the words. If a piece cannot say that sentence, the split was cosmetic.
Language changes follow the same shape. A screen’s words live in the catalogue for that language, so an English and a Hindi sentence are written in the same change and neither is pasted into the other. A file that holds logic and its sentences together will be updated in one language and shipped in two.
What it costs
More files, more names and more imports. A change that used to be one edit becomes three, and the first afternoon of a new feature is spent deciding where its parts belong. That is a real cost and it is paid in the same currency as every other: attention.
What it buys is a review that can be finished, a fault that points at one place, and a module that can be deleted without a search through everything that ever touched it. A limit that costs an afternoon now is cheaper than a file that costs a week in a year.
The purpose of the limit is not small files. It is that nothing in the product has a part nobody can find.
Start a conversation