"Can you hand part of the task to someone else so it goes faster?" Many programmers have heard a question like this at least once in their lives, and most likely several times. But it is not only technical people who have to answer this dilemma. Managers are in a similar situation just as often, maybe even more often, when they talk to a client and explain that some things can't be sped up. And the client asks, "why?"
Exactly: how come some tasks can be done faster by assigning more people, while others can't be sped up that way at all? What decides that some topics must be handled by one person, while others, despite a huge amount of work, can be spread across several programmers? Are there any "formulas" for calculating this at all?
Can nine women have one baby in a month?
First a bit of theory, but don't worry: it relates to today's topic and also explains the famous sentence in the title of this section. It is often cited precisely in the context of many people working at the same time, and it is used to explain the absurdity of assigning several programmers to a task that cannot be divided at all. To approach this in a more scientific way, let's recall two laws that appear in the area of computer science dealing with the problems of parallelizing computations. And let me say up front that I will explain them in a way that won't get you through any exam, so it is better to learn from serious sources and treat the description below at most as a metaphor.
The first of these laws is Amdahl's law. It shows that the speedup of computations (that is, of a program's execution) has a limit resulting from the part that must be executed sequentially. Everybody probably understands this intuitively, but here is an example. If a computation normally takes 10 hours, but a 2-hour fragment has to run sequentially (that is, instruction after instruction, with nothing happening "in the background"), then no matter how many processors are assigned, the minimum execution time of the program will never drop below those 2 hours. The theory behind this law is more complicated, but quoting formulas is not my goal here.
What I care about more is translating this to completing tasks. In this case the processors are programmers and the computation is the task to be done. Suppose its time was estimated at 60 hours and we can split it into 3 parts. The first will take 30 hours and has to be done at the beginning, in one go (sequentially). The second part requires 20 hours and the third 10, and these can be done in parallel, because they are independent of each other. Leaving aside the time spent on merging changes and verifying them, we see that with two programmers working, the whole thing will take 30 + 20 = 50 hours at best (you can also look into the critical path method, CPM, here). A rather small speedup. The question is what would happen if we could split those two parts into even smaller pieces done in parallel. With more programmers the speedup might be greater, but it would never drop below 30 hours. Following this trail and answering the question from the section title: asking 8 additional women will not make one baby arrive sooner, because that one woman has to "do this task" sequentially. It's not like one woman delivers the head, another the arms, a third the legs, and by combining the ladies' efforts one baby comes out. A gruesome example, but I hope you understand what I mean.
The second law we are interested in is Gustafson's law, sometimes also called the Gustafson-Barsis law. It carries a more positive message: any problem can be parallelized effectively, as long as it is big enough. That sounds abstract (and in computer science theory it is), but it also applies in practice.
Suppose we denote the part executed sequentially as s, and p is the part that can be parallelized using n processors. In this case, on a single computer the execution time will be s + n * p, because what n processors would normally do has to be done here by a single processor. The whole idea is that if the problem as a whole is big enough (which means the sequential part becomes smaller and smaller within it, because it is unlikely that increasing the size of a project would make one continuous process longer), then the speedup from parallelism will tend toward infinity.
Following the previous example: suppose the task given to programmers, which used to take 60 hours and was split into one sequential part followed by two parallel ones, were significantly expanded and now took 1000 hours, but could be divided into many parallel parts. Even though the sequential fragment would still exist (or new elements of it would appear), it would make up a minority of the work. This means you can throw more programmers at an even bigger task and get a bigger speedup than with a smaller task. Someone will say at this point that this means a longer wait than 50 hours, but the point is different: the more requirements we add to the project, the 50-hour time won't grow in line with the "additions", and the increase will be smaller. Going back to the case of 9 women, Gustafson's law means that after 9 months, 9 women will give birth to 9 babies. More babies mean a larger scope for the task and, indeed, a speedup has been achieved this way: you don't have to wait 81 months, only 9.
Why am I writing about this at all? To show that the problem of parallelizing work is not just about throwing N additional programmers into the fray. A lot depends on the type of problem and on identifying the part that cannot be split and has to be done by one person. Amdahl's and Gustafson's laws show that this has a scientific basis, and although these terms originally relate to parallel computing and processors, they can easily be transferred to software development and team management. But there is something else...
Characteristics of programming tasks
Implementing functional requirements is not just time spent on design and coding itself. I mentioned above that even when work is parallelized (and maybe precisely because of that), there is still a need to merge it and check that it works after integration. Another thing is running tests, which also takes time and requires the developers (or at least a significant part of them) to be on hand. But that is still not the full picture.
Clients often forget that developers differ, and not every one of them has the experience needed to complete a given task efficiently. What is more, individuals know one part of the system better and another worse. Sometimes you also have to design a fragment of the architecture first that is used by several tasks, or, despite the parallelism, the tasks somehow "use" each other (although that may be a symptom of a mistake in managing how requirements are assigned). There are also requirements that cannot sensibly be split without causing more confusion. That's why, for example, when we define the scope of sprints, we avoid proposing tasks from a single module, even if it is a priority. There is a risk that individual tasks will be so closely related that they can't be split between 2-3 programmers, so they won't fit into the sprint anyway (even though the time estimate is smaller than number of programmers * number of working hours per programmer), and in addition some people will have to get tasks from outside the project so they don't get bored. That's why we often agree to do half of one module in a given sprint, but add half of a second priority module to it. In the next sprint we do the other halves of both, which puts Gustafson's law into practice: within 2 sprints we "gave birth" to 2 modules, but, this time in line with Amdahl's law, we wouldn't have been able to build 2 modules in 1 sprint with twice as many programmers.
And as if all that weren't enough, someone has to manage the execution of these tasks and monitor their progress. That is what the project manager or product owner is for, whose job is to supervise, react to problems and plan assignments so as to deliver business value efficiently. But if we enlarge the team, say tenfold, don't we also create a flood of work for the person managing it, who suddenly has many people to supervise and questions to answer? Maybe the management layer should then be enlarged too, but those people would also have to split up work and keep each other informed about progress (in a more complex way than through stand-up meetings). As if there weren't enough problems...
Of course, all this depends on the project and the tasks themselves. It is a very individual matter, and there are situations (even frequent ones) when one big piece of functionality can be "squeezed" into a sprint. But remember that this is not always so simple or possible.
Is splitting a task always a good thing?
From reading the previous section you probably already know it isn't. Forcing a search for parallel work within a task will not always bring the expected result. For example, if we build a notification module and have five requirements related to five different types of notifications, even though they differ from each other in some way, it's very likely that they use similar concepts and therefore similar solutions in code. Now, by distributing these tasks among five different programmers, they can finish in one day instead of a week. But there is a risk that this will come at the price of repeated code or different ways of solving the same dilemma that appears in several of these tasks. Of course, you can deal with this by splitting the functional points further and singling out the common part in the form of an interface, whose implementation one person will handle, but conditions don't always allow playing around like that.
Summary
Of course, don't get me wrong: a proper division of tasks is a key issue and it absolutely lets you build software faster without losing quality. Large projects are built by teams, not by one person, and by necessity requirements must be parallelizable. Still, it is worth remembering that there are scientific grounds showing that throwing a few extra programmers at a project will not magically speed up software development in every situation. You have to skillfully identify bottlenecks and manage resources sensibly. Not to mention purely business matters, knowledge of the project, experience or such a prosaic thing as the ability to act together as a group. Simply put, not everything can be done at the same time. But it is worth trying.
While writing this article I used materials by Dr. Rafał Walkowiak of Poznań University of Technology (from the course "Parallel Processing"). I admit that I'm sometimes surprised how often I return to some of the topics discussed at university, which are only now starting to fall into place for me. Besides that, as usual, I was helped by Wikipedia and articles such as this one.
Best regards and thank you, Jakub Rojek.


