Little's Law and the Central Limit Theorem are used many times in agile software discussions when speaking about flow processes based on Deming's principles.
These discussions usually start by quoting something from a summary of Little's Law or the Central Limit Theorem.
A critical element of both Little's Law and the CLT is the notion of Identical Independently Distributed (IID) random variables. These variables are the arrival rate to a service - stories selected from the backlog for development, or someone arriving in line at the bank to make a deposit of a check.
Let's start with some math. In probability theory, the central limit theorem (CLT) says,
- Given certain conditions (we'll define these next), the arithmetic mean (the average) of a sufficiently large number (this needs to be defined) of samples of independent random variables, each with a well-defined expected value and well-defined variance, will be approximately normally (Gaussian) distributed.
- There are some important ideas here, Independent random variables are the first important idea. That is the variables are not related to each other.
- As well these random variables must be Identically distributed. That is, they are all drawn from the same underlying probability distribution, and this assumes a large - usually infinite - population of random variables.
Using a grocery store check-out line or bank teller window example, Little’s law gives the relation between the mean number of customers in the system, E(L), and the mean transit time through the system, E(S), and the average number of customers entering the system per unit time, λ, as E(L) = λE(S).
An Actual Example In Preparation for Developing Software From The Story Queue
Let's pretend we're in line at the grocery store. We'll call the check-out line the resource and the people lining up at the check-out line the customers. If the clerk manning the check-out station is busy checking out customers, a queue will form in the line waiting to check out.
The population of customers that can use the store is usually finite, but this makes the problem harder, so let's assume for the moment the population of customers is infinite. The number of check-out lines can be one or many, but we'll want to assume they are identical in their services for the moment as well. Let's define the capacity of the store as the number of people that can wait in line, plus the person being served by the clerk. In most stores, there will be a finite number of people in the queue at check-out, but again if this number is infinite to makes the analysis easier.
We need another simplifying assumption. The distribution of the amount of time each customer stays at check-out (once they arrive) is Independent and Identically Distributed (IID). As well the probability that a customer will arrive at check-out is also an IID variable. This distribution is usually taken to be exponential. This means the longer you wait, the more likely it is someone will show up at the check-out stand ready to check out.
These are critical assumptions for what follows about Little's Law. If the above conditions are not met, Little's Law is not applicable to the problem being described.
So let's have a quick summary of Little's Law:
Mean number of people in line at check-out = Arrival Rate of customers × Check-Out Time
This law can be applied if some other conditions exist:
- The mean number of people arriving at the check-out line equals the mean number of people being checked out.
- This means - over a long period of time - the mean number of people arriving in line approximately equals the mean number of people leaving the store after check-out.
- In math terms:
- The number of arrivals N over a long period of time T defines the arrival rate.
- Mean Arrival Rate = Total Arrivals / Total Time = N/T.
Now for Software Development
Instead of assuming if Little's Law can be applied to software development, let's first ask are the conditions right to apply the law:
- Is the arrival rate at the server an Identical Independently Distributed random variable?
- Is the service time for each piece of work an Identical Independently Distributed random variable?
This means, do the jobs - stories - arriving at the service - development (or some other process) - behave like IID variables. That is they have no knowledge of each other and are indistinguishable from each other and when serviced, they can not be distinguished from the other work serviced(meaning developed, tested, installed, etc.)
Let's look at an actual project, a simple one. We want to fly to the moon for the first time, land, and come home.
To do this we need to do some work, in a specific order, with dependencies between this work in order to produce some outcomes that enable us to fly to the moon and back - and live to tell about it.
Doing work on a development project is not the same as work arriving in a queue of a service, it is a network of dependencies, with interconnections, and most importantly - most critical actually - the duration of the work, the time spent in the service - are not independent, identically distributed random variables. A network of work looks like this (notionally).
So does Little's Law apply? Nope!
- The work arriving at the service is not an Independent Identically Distributed random variable.
- The service time is not an Independent Identically Distributed random variable.
- The dependencies between work may itself by a random variable of unknown distribution, behaving dynamically depending on the prior work, the follow-on work, and other external conditions.
These networks of work are called Stochastic Networks and are not subject to Little's Law. The process in the Little's Law condition can be stochastic, but there has to be independence between the work elements and they have to be identically distributed probability distributions.
Production queues of parts going down an assembly line are. Cards being pulled from the tray in a Kanban furniture manufacturing system are. The notional Kanban system in agile development are - but If and Only IF (IFF) the work pulled from the wall is independent of all other work, and the probability distribution of the duration of that work independently distributed from the actual work as well.
If you can find a project where all the features are independent of each other, their work efforts are identical, independently distributed random variables, and you'll be able to apply Little's Law.
The End
Little's Law applies to software development work that looks like production flow - like the assembly line at Toyota, or the office furniture production line we designed at a factory in Idaho.
But those types of software projects must be intentionally designed to have no dependencies between the work performed, have the duration of the work in the service cycle (development) have no dependency on the prior work or the work.
This is the condition of Identical Independent Distribution (IID) needed for Little's Law as well as the Central Limit Theorem. So before anyone says Little's Law applies to software development, they need to show these conditions exist.
One Final Observation
The slicing proposed by some in the agile community might create the conditions for Little's Law to work. But the effort to slice the stories into equal-sized - or at least Independent Identically Distributed work sizes for the entire project duration seems like a lot of work. Especially when there are much easier ways to estimating the total work, total duration, and total cost.
But since this slicing paradigm appears to be anecdotal and untested across a wide variety of projects, domains, and sizes, the population sample size condition is unlikely to be met as well.
More research, based on actual analysis needs to be done, then that research reviewed and tested before the notion of mathematically slicing has much use outside of anecdotal examples.
Resources (of many)
- Statistical Analysis with Little’s Law, Song-Hee Kim, and Ward Whitt, Industrial Engineering and Operations Research, Columbia University.
- Estimating Average Production Intervals Using Inventory Measurements: Little's Law for Partially Observable Processes. Operations Research, vol. 36, No. 2, March-April 1988, pp. 208-223.
- Statistical Analysis with Little's Law, Supplementary Material: Technical Report. (with Song-Hee Kim).
- Introduction to Stochastic Processes, Paul Hoel, Sidney Port, and Charles Stone, UCLA, Houghton Mifflin, 1972.
- Modeling and Performance Analysis of Network Computer Systems, Queuing Theory, CS533, Worchester Polytechnic Institute.