Very good allegory from Shai Yallin:

https://www.shaiyallin.com/post/your-software-as-a-kitchen

Assume that you’re a cook in charge of feeding a lot of people; maybe you’re hosting a big family dinner, maybe you’re working in a homeless shelter - it doesn’t matter; you have one task: feed people. You have generous counter space (but not limitless), a wide kitchen sink, a set of pans and pots, groceries (let’s say vegetables and chicken) and kitchenware (plates, cutlery, cups, etc). The task is composed of sub-tasks: you need to prepare the vegetables and meat - peel, slice, dice, etc; you need to cook the ingredients in pots or pans, in some specific order; and you need to transfer ready portions to plates and serve them to people.

There are, however, other, hidden sub-tasks within these sub-tasks; you have to dispose of leftovers from preparing your ingredients; you have to clean used dishes; you may have to store prepared but uncooked ingredients somewhere, but if the counter is full of vegetable peel and used dishes, you first have to move stuff to the sink. The sink, however, might be already full of piled dishes and pots, so you have to stop and wash some dishes. But if you already have something cooking on the stove, you might have to temporarily turn the it off to avoid it burning while you’re washing the dishes. Maybe it’s a dish that can’t afford being halted in mid-cooking. So you move some piles of plates from the counter to the floor to make room for your prepared ingredients while you tend to other cooking dishes…. it goes on.

Working in a kitchen for an extended period of time in an effective manner requires developing an efficient methodology. It will usually evolve around pipelining food preparation, and using short breaks in cooking activity to perform “housekeeping” tasks such as cleaning your counter or washing dishes. A good balance of both “customer-facing” tasks (making food) and these housekeeping tasks is at the stem of a sustainable cooking experience. If you neglect housekeeping tasks for too long, your ability to perform customer-facing tasks gradually slows down until, at the extreme, it completely halts as you look around incredulously to find yourself stalemated by your own mess.

If we go back to software development, by “customer-facing” I refer to bugs, features, or any work that is assumed to have immediate business value, and by “housekeeping” I refer to refactoring or other tasks that are aimed at “paying the debt”, “reducing entropy”, “pruning the plants” or “cutting away the gangrene”, that are seen as having no business value, but that do, in fact, have an indirect business value, insofar as to impede business value when they are neglected. A good balance of both types of tasks is at the stem of a sustainable software development culture.