# Codermetrics.org

Sharing information on codermetrics

## Software Risk Arbitrage

This is the first of three planned articles on analytic techniques for decision-making in software development.

Frequently in software engineering we face hard choices about system and architecture changes.  This isn’t unique to software development, of course, but like many other fields we often have to weigh decisions about whether it’s better to fix, upgrade, or replace problem components.

Some decisions are straightforward and obvious, especially when the pain of sticking with what we have is great and a better alternative exists.  It’s also easier when our software is in an early stage, especially if only a small number of users are affected.  In other words, it’s easy to decide if the risk is low and the chance of a positive outcome is high.

But as our software matures and our user-base grows, decisions become harder.  “Rip and replace” gets riskier, and therefore it makes sense to have some kind of process or model to help you weigh the risks and make a good decision.

One analytic framework for architecture or other potentially risky change decisions can be found in the domain of Risk Arbitrage.  Risk arbitrage is an area of financial speculation where an investor tries to take advantage of the discrepancy in stock prices between two public companies involved in a merger or acquisition (M&A).  Public companies in M&A create opportunities for investors to profit if they can forecast whether or not the merger will go through.  The key to successful risk arbitrage is being able to assess the risk and likely outcomes of corporate mergers, as well as the likely results on stock prices, and to use this information to make investment decisions.

Expected Value is a concept from risk arbitrage that you can apply to other fields including software engineering.  The idea of Expected Value is to come up with a single number that measures potential gain versus potential loss based on estimated probabilities.  The formula can be written as:

Expected Value = (Forecast Gain x Success Probability) – (Forecast Loss x Failure Probability)

In the case of risk arbitrage, Expected Value is used to compare the estimated stock price gain if an acquisition is successful versus the expected stock price reduction if an acquisition fails.  By estimating the stock prices and the probabilities, a risk arbitrageur can use Expected Value to guide his or her investment decision.

To use this concept in software engineering decisions, you need to start by finding a way to forecast gain or loss for a specific project.  Example measures are:

• The number of minutes or hours of system problems or downtime
• The count of system failures or outages or reported user issues
• The response times of specific components

Any of the above can work.  What you need to do is to choose one that is applicable to your project and then estimate the potential gain or loss.  For the gain, forecast your expected results.  For the loss, forecast what could realistically happen if something goes wrong when you put the change into production.  Finally, you need to estimate the probability of success (no unexpected problems in rollout) and failure (unexpected problems in rollout).

For example, let’s say you’re considering an upgrade of a core component in your system.  Suppose that bugs in the current version are causing four hours of production problems per month, and you believe the new version will eliminate the production issues.  But if the upgrade fails, it could cause ten hours of system problems while you either fix the issue or rollback.  You estimate the likelihood of success as 90%.  You can calculate your Expected Value as:

Expected Value = (4 hours gained x 90%) – (10 hours lost x 10%) = 3 hours gained

First of all, you’re forcing yourself to think analytically about the project.  You have to identify a measure and forecast the likely gain and the potential loss, and you have to estimate the probability of each.  Clearly, if you realize that the potential gain is low or the likelihood of failure is high (which in either case might result in an Expected Value near or less-than zero), then that can help you clarify that the potential project is either too low-value or too high-risk.

Second, you can now compare the Expected Value to your current situation.  In the above example, the current version is causing four hours (per month) of production problems and the Expected Value of upgrade is a gain of three hours, or a 75% gain.  Looking at it this way, Expected Value can help you decide if a project is worthwhile.  Obviously it will depend on the details and the effort required for the project, and you can develop your own rule-of-thumb, but personally I think that an Expected Value that shows 50% or more improvement indicates a project that is at least worth serious consideration, while an Expected Value that shows less than 20% improvement indicates a project that may not be worth the effort.

Expected Value is an analytic technique to frame your thinking and analysis on a decision.  You will need to decide how high the Expected Value should be to make a project worthwhile.  Of course, Expected Value alone is not enough to make a go or no-go decision.  In the next article in this series I will cover another analytic concept that can be used to help in critical software engineering decisions.