Is Taking Small Steps Always a Good Idea?
Join the DZone community and get the full member experience.Join For Free
the best way to develop software is by taking small steps. at least, that’s what all software methodologies tell us. but is it always the case? maybe sometimes leaps are more efficient? some argue that making small changes takes more time but it’s always safer. is it that simple?
some facts about the brain
the following two facts about the brain can help us to answer these questions:
- our working memory is extremely small. some early studies showed the average human cannot hold more than 7 objects in their working memory. but more recent studies showed that the number is actually 4.
- loading objects (or memories) into working memory takes energy. accessing recent memories is much cheaper and faster. for instance, can you recall what you had for breakfast a week ago? it’s extremely hard and may take a few minutes. now, what did you eat this morning?
when taking small steps is more efficient
imagine yourself making changes to a project you haven’t touched since last year. you can still have a pretty good understanding of the domain and structure of the project. since you know it quite well and the test coverage is good, you feel that taking large steps will be more efficient. after all, it’s you who have built the project.
the problem here isn’t with learning new concepts or technologies, but with accessing old memories. taking a leap involves a lot of context switching, which means loading the same groups of objects into your working memory over and over again. that’s an extremely energy-demanding process. you will feel worn out after a couple of hours. making small changes doesn’t require many context switches. and even when it happens, everything you care about is right there, in the code.
when taking larger steps is more efficient
imagine yourself working on some feature for a month. since all the concepts are already learnt, and the memories are fresh, loading them into your working memory is super fast and cheap. in the previous example trying to recall what some class was supposed be doing could take a few minutes, whereas in this example it’d take a fraction of a second. and as a result, shifting your attention from one class to another isn’t that tiring. so you can make changes in multiple places without losing a clear picture of your program.
rule of thumb
accessing old memories => small steps
accessing only recent memories => larger steps
when uncertain, take small steps. everyone emphasizes the safety of this approach, but it also can be less tiring, and, therefore, you can stay productive the whole day.
knowing the code and being able to quickly load this information into your working memory can make context switching rather negligible. in this case, don’t be afraid to take larger steps. most likely it’ll be faster.
Published at DZone with permission of Victor Savkin, DZone MVB. See the original article here.
Opinions expressed by DZone contributors are their own.