notes · thoughts ·
How far does a DTO change reach?
When looking at a response shape, I now think beyond the current screen to where the data goes next. I want to ask how far the next change will reach.
If I see a DTO only as a bundle of fields for the current screen, it is easy enough to create. But when the data continues into another screen and new requirements arrive, that original bundle may need to be split or rebuilt.
The issue may be less about a few fields than about which concepts were grouped together. If data updated at different times sits in one response, and changing one part forces changes in other screens, that grouping deserves another look.
A DTO exposes both the information a client may know and the shape it will depend on. That makes changing a response different in scope from cleaning up an internal implementation. A small internal change may require coordinated changes in several places that consume the response.
Try the next requirement
When I dislike a structure, I am tempted to propose something cleaner immediately. But “cleaner” alone does not explain why it should change now. Existing consumers also have to be updated.
Instead, I try putting a plausible next requirement into the current structure. Which DTO changes? Where do optional fields or flags appear? How much data-moving code is repeated? I put the same requirement into the alternative and compare whether it actually reduces the scope of change.
The same applies when splitting endpoints. Appearing beside each other on a screen does not necessarily mean two pieces of data belong in the same response. Different data characteristics, query costs, or update cycles may justify separate handling. Data that is always needed together may be better fetched together.
I am more interested in the conditions under which the current structure becomes awkward than in which structure is better in principle. If I can describe those conditions concretely, a proposal can move beyond competing preferences. I want to see whether the next change really becomes easier enough to justify restructuring now.