Computational vs Economic Efficiency

Efficiency is a concept in both economics and programming. This article will compare and contrast these two views of efficiency.

Efficient coding can be described in 3 ways. These 3 descriptions often  but not always imply essentially the same implementation:

  1. Efficient code is DRY, not duplicative. Efficient code is reusable, modular, and generalized, not overly specified.
  2. Efficient code is concisely written and small in character or byte size. Efficient code is written on a need to know basis, presenting the minimal information needed to accomplish requested functionality.
  3. Efficient code executes as quickly as possible with minimal resource usage and requirements.

Economic efficiency means getting the best benefit for the least cost. Economic efficiency agrees with computational efficiency essentially in only one case: When a program requires less resources to run, including both time and hardware as resources, then it can be executed literally in a less expensive way because we don’t have to purchase expensive computers or waste a bunch of time to run it.

There are many cases, however, where efficient coding is not economically efficient. In these cases the code may be optimized from a technical resource usage point of view but it is not optimized from the point of view of maximizing profitability on the market for supply, demand, or other reasons. Examples include:

  1. When code is technically optimized it may not be readable. Such is the case with minified code, for example. This can create supply problems of productivity. DAMP code is not technically efficient but it may be economically ideal because it improves productivity.
  2. Convenience coding or hacking can allow for rapid production with suboptimal code. Sometimes getting to market ASAP matters more than optimized coding from a business perspective.
  3. User experience sometimes demands duplication. In Microsoft Word, for example, there are at least 3 ways to turn text bold. You can use control + b, you can click the button in the ribbon, or you can trigger a listener function from a plugin. While this creates a degree of technical duplication it is economically efficient because it improves demand for Microsoft Word by improving the product from a usability standpoint.
  4. Sometimes it is good to organize a program in a way that is loosely coupled, decentralized, and implements separation of concerns. These approaches create redundancy in order to reduce the likelihood and impact of system failure or improve security. For example, the decentralized operation of the bitcoin blockchain involves many people downloading and duplicating the same blockchain.
  5. Ensuring maximum environmental compatibility may involve duplication. For example, you might have to write a particular function a number of times in order for it to be compatible with Firefox, IE, older versions of IE, Linux, Mac, Windows, desktops, tablets, cell phones, and so on.

The question becomes: How should we code by default? I think we have to mutually maximize supply and demand and I think this generally means preferring economic efficiency to technical efficiency.

Agile methods do a solid job of maximizing demand by frequently retargeting developer tasks to ensure production code is meeting consumer preferences.

Agile methods are ideally coupled with a development style that maximizes development speed toward whatever product customers are demanding and excludes code or methods that doesn’t service that objective.

  • 2

Leave a Comment