Economics for Developers: Understanding Opportunity Cost
by Joseph Finsterwald
Contents
- The Importance of Economics
- Every Bug is Sacred. Or is it?
- To Optimize or not to Optimize
- Conclusion
The Importance of Economics:
"The ideas of economists . . . are more powerful than is commonly understood.
Indeed the world is ruled by little else."
-John Maynard Keynes
Software developers are constantly confronted with tough decisions
regarding the best way to accomplish a task or solve a problem. As a
result, we are inundated with cautionary lists and articles extolling
the benefits of best practices. Don’t do "X" or be sure to do "Y".
Developers, however, are often
not asked to step outside of their
development roles and think of their code from an economic perspective.
The fact is that for many of us, development is a business.
It is our profession first even if it happens to be our hobby second.
As a result, we do a disservice to our employers,
our clients, and ourselves when we fail to think of software
development in economic terms.
This article looks at some basic principles of economics that
should enter into your thinking before you write that next
line of code, start working on that bug, or opt for that cool
new feature. Thinking in this way will help to elevate you from
the code drone into the corner to a valued business partner.
Every Bug is Sacred. Or is it?
You’ve just discovered a bug in an application that is used
by your firm to track new sales leads. The sales team is furious
and your boss is checking in with you every couple of minutes to
see if it is resolved. You have already left a number of increasingly
desperate sounding messages to the consultant who built the application.
Finally he gets back to you. He says it will take 10 hours at $200 an
hour to fix the problem. $2,000 dollars seems like a lot of money
to you so you hesitate before deciding if you should give the
consultant the go ahead.
So what is the cost of fixing the bug? The common sense answer is $2,000.
However, to an economist the answer is less clear. The accounting cost to the firm is $2,000, but the
opportunity cost is
potentially much higher. What is opportunity cost you ask? Formally it is defined as the value of the most highly valued forgone
alternative. If you are scratching your head over the definition, imagine that not fixing the bug would result in the sales team
losing a million dollar project. In this case, the opportunity cost is a million dollars which is significantly higher than the
accounting cost. In other words, by not fixing the bug you forego a million dollar opportunity for the firm and that million dollar
opportunity is the most highly valued of all the choices that are available to you. You should obviously fix the bug.

Now imagine the same scenario except in this case the aforementioned bug
is a look and feel issue that only affects internal employees. We also
know that the sales department’s development budget is already strapped,
and each expenditure needs to be carefully weighed against other priorities.
The sales team may be upset but is it worth it to fix the bug?
The answer is likely no. This may initially seem counter intuitive
since as a developer you’ve most likely been inculcated into the belief
that if a bug is found it should be fixed. Mantras have been built around the
shrine of zero-defects but in truth that kind of quality comes at a cost.
Every decision has a trade
off and software is no different than anything else. The lesson
being: not all bugs should be fixed if your effort may be better
spent elsewhere. So next time tell your boss to the opprotunity cost is
too high to fix that bug which maybe inconveniences a few users
and that she should let you focus on that new feature
that will open up additional revenue sources.
To Optimize or not to Optimize:
Now imagine another scenario. A couple of years ago you wrote
an automated report for your company. When you initially wrote your
report the people in accounting were exuberant that you took a task that
formerly took days to complete down to a matter of minutes. Everyone
was so impressed that it ended up on your end of year review and was
instrumental in getting you a huge bonus. Now, however, the drudgery
that you freed your co-workers from has been forgotten and people
have even started to complain about how long it takes to run the
report you wrote. Ingrates! To make matters more annoying your boss
has even requested that you speed up your report. You think that
with some optimization you could reduce the execution time of your
report from 5 minutes to 1 minute. Is this a worthwhile endeavor?
To answer this question you’ll need to perform a cost analysis.
How much does it cost to run your report? To figure this out we’re
going to need to be a little creative, and we’ll need some extra
information.
We need to figure out the frequency of usage of the report.
To do this we’ll have to add some more detail to our scenario.
Let’s imagine that an accountant at the corporate office runs the
report you wrote on the first of every month. Our imaginary accountant
has a pretty good job. She only works a 40 hour weeks and she’s paid a
wage of $31.25 an hour. Now let’s do the math.
- An accountant’s wage per minute: $31.25 / 60 = $0.52
- The cost to the firm to run the 5 minute report for a year:
$0.52 * 5 * 12 = $31.25
- The cost to the firm to run the 1 minute report for a year:
$0.52 * 12 = $6.25
- The cost difference between both
reports: $31.25 - $6.25 = $25
We’re almost there! The opportunity cost to the firm of not
re-writing the report is the extra money in wages that must be paid
to the accountant who runs the report, and the forgone interest on
that money paid. Had the firm not paid the money in wages it could
have invested it in the market. As a result, we’ll need to account
for the forgone interest in order to calculate cost. Economists call
this the user cost of capital: more formally, the opportunity cost
that is incurred as a consequence of owning and using an asset.
To calculate the cost in terms of interest we’ll need to calculate the time value of money.
The Future Value (FV) equation
for an annuity allows us to discover the future value of annual payments.

The table below shows the results of our calculations.
The Future Value has been calculated for three different interest
rates and four different time periods.
| |
Interest Rate: |
| 3% |
5% |
7% |
| FV 5 Years |
$132.73 |
$138.14 |
$143.77 |
| FV 10 Years |
$286.60 |
$314.45 |
$345.41 |
| FV 15 Years |
$464.97 |
$539.46 |
$628.23 |
| FV 20 Years |
$671.76 |
$826.65 |
$1,024.89 |
It’s interesting to see the effect of a few minutes spread out
over a number of years. Now imagine if it wasn’t one user but a
thousand and that the report was run every day instead of every month.
In this case performance optimization becomes more of a worthwhile
endeavor because the opportunity cost of not fixing the problem would
be in the millions!
This scenario also illustrates the combined effect of the interest
rate and time on the cost of performance optimization. Many developers
might consider the interest rate to be an inconsequential factor in a
performance optimization problem, but when you think in terms of
opportunity cost and factor in the user cost of capital the results
over time can be significant.
On a larger scale the change in interest rate affects the market for
software. Economists refer to the interest rate as the price of money.
When the price of money is high we’re typically in a recession, when the
price of money is low we experience economic expansion. I suspect that
when work slows and firms are in an economic contraction development is
focused on refactoring more than new application development. This
change in focus would be partly due to a scarcity of new work, but
also because firms have more of an economic incentive to work on
refactoring problems when the interest rate is high and their
tolerance for risk is low. It’s the software equivalent of a
flight to quality.
Conclusion:
It’s crazy to me that so many important decisions regarding
software are made in the absence of information regarding cost.
In my opinion the ability to manage resources effectively and to
make informed business decisions requires that you have an understanding
of the elementary principles of Economics. Learning
to think like an economist is similar to learning object oriented
programming in that it is initially counter-intuitive. However,
increasing your understanding of economic concepts like opportunity
cost will provide you with a rigorous methodology for thinking about
problems generally and will ultimately make you a better developer and
business partner.
I hope this article was helpful to you. Please do not hesitate to
email me if you have any questions (my email is in the "About the Author"
tab above.) If you think I’ve missed something, I would greatly appreciate
you letting me know.