Ron Johnson, JC Penney’s CEO, has been fired after about a year and half on the job. Johnson’s tenure was plagued with losses including a $552 million loss in a single quarter.

How’d JCP lose all that money? They rolled out a big new change — an abandonment of sales and coupons in favor of more uniform pricing. Customers, uninterested in a JC Penney sans the discount opportunities, abandoned the store.

Critically, the rollout was made across the entire store chain without first testing it out on a smaller scale:

Alex Fuhrman, a Piper Jaffray analyst… says J.C. Penney made a critical mistake by rolling out a sweeping pricing change before testing it on a small scale at some of its stores.

Johnson, a former Apple exec, should have known better from his time in the tech sector: always test in a staging environment before rolling out into production.

In software development, newly written or updated software potentially has bugs. Some of those bugs might be caught in early development and testing… but some will survive longer. Perhaps the bug is obscure, perhaps it only manifests in complicated real-world scenarios, or perhaps an imperfect software developer (considerably more common than the perfect variety, as it turns out) misses it even though it’s right under his nose.

A staging environment is the perfect place to ferret out these bugs. A staging environment imitates the production environment as much as possible, but isn’t accessible by customers like a production environment is. Instead, the staging environment is used to test the software until it’s deemed ready to be promoted to production. This creates an excellent opportunity to identify and fix bugs before they start aggravating customers.

JC Penney could’ve created their own staging environment: they could have done more focus groups or other market research outside of their real-world stores, or they could have used a subset of their stores to test the new changes they were making. It sounds like they did too little of the former and none of the latter. The result: a showstopper bug in “production” that Johnson couldn’t fix in time before getting the axe.