Do Not Code Your Business Rules!

Sorry to be somewhat off-topic as far as economics goes. This is another one of my biases about systems development–not that I am a qualified professional at it. But on an earlier post, a commenter wrote,

code sent messages to customers by e-mail, phone, text, etc., for flight notifications (on time, late, cancel, gate change, etc.). Just for frequent flyers, the decision making on whether to send a message that a flight was delayed ran past 1000 lines of code. It depended on whether messages had been sent before already, plus results from multiple databases with customer contact details, timezones, whether the flight was a connection or originating, time-of-day, saved preferences, plus legal issues such as whether the customer had triggered telco opt-out for text messages.

My claim is that none of that should be written into computer code. Instead, think of a list of conditions that might trigger a message. Put those into a database and write code that constantly checks against those conditions. Then think of a list of conditions for sending a message by phone, a list of conditions for sending a message by email, etc. Put those into a database, and when “might trigger a message” is true, check these conditions and if they are satisfied, send a message.

My point is that business rules should reside as much as possible in data, not in code. That way, you know where they are, and you do not have the maintenance problems that come with large amounts of code.

One of the advantages I see in rewriting software is that you take the business rules that have crept into the code out of the code and into data.

When Will the Cable Business Model Break?

Kathleen Madigan writes,

In the inflation gap between goods and services, one of the biggest chasms is between the price of a television set and the accompanying cable bill. In the past five years, the price of a new TV set is down nearly 58%, while the cable bills have risen nearly 14%.

Her article cites the higher prices being charged by content providers, such as ESPN.

My household is providing a subsidy to cable TV. We don’t watch it, but it comes bundled with our Internet service. When will the cable TV model break, so that it can no longer extract so much revenue? Some possibilities.

1. Never. My household is an outlier. Other households are getting ever-increasing value from cable TV, and they will gladly pay more for it.

2. Never. The business model of bundling is sound when there are high fixed costs, as in wiring up a community.

3. When enough spectrum is freed up that consumers like me start to get rid of cable and rely solely on wireless.

4. When enough consumers shift toward Internet-based entertainment.

Social Institutions and Software

A commenter pointed me to an article by Joel Spolsky from 15 years ago.

The idea that new code is better than old is patently absurd. Old code has been used. It has been tested. Lots of bugs have been found, and they’ve been fixed. There’s nothing wrong with it. It doesn’t acquire bugs just by sitting around on your hard drive.

This might be thought of as a Hayekian view of software. Accept what has evolved, even if you do not understand it. In contrast, I think that if you are maintaining software, and there are parts of it that you do not understand, you are in trouble.

Perhaps I am wrong, and Hayek/Spolsky are right. You should not try to rewrite software that works.

However, I think that it might be possible to distinguish software modules that perform generic functions in a reliable way (do not re-invent these) from application-specific software that lives in a world of changing business rules. My hypothesis is that in the latter case, frequent rewrites are more cost-effective than a process of continual patching.

Software Conversions are Hell

From a Washington Post article on the software glitch that briefly grounded United Airlines:

“When the two airlines decided to merge, they had a choice to make: Would they take the Continental system, or would they take the United system?” Seaney said. “They decided to go with the Continental system and basically dumped Travelport.”

Flipping one reservation system into a notably different system is complicated and problematic, and it has led to headaches for United.

“There wasn’t a lot of commonality, and there were a lot of glitches along the way,” Seaney said. “They had issues with reservations, with elite status, all their awards programs had issues.”

I feel United’s pain. About 17 years ago, my homefair.com web site (which I now have had nothing to do with for 15 years) bought a related web site. We had very similar business models, so our software did similar tasks, but theirs was written in Perl and ours was written in Java. Rewriting their software to work with ours cost more than building both of our individual systems. Still, I think it was worth it.

I am a huge believer in rewriting software. In particular:

–As soon as you finish the first working version of an application, you should rewrite it from scratch. The rewrite will go quickly and will involve a much better design.

–Letting any software application go more than two years without a total rewrite will create maintenance headaches. You will have accumulated patches that turn the code into a mess. Your developers will not remember enough to be able to discern what sorts of changes could blow up the system.

The Perl code that we inherited was not only hard to follow (all Perl code is hard to follow–that’s why I hate it) but had undergone continual patching without rewrites. Most corporate software evolves that way, and sooner or later that ends up costing a lot.

Related: Zeynep Tufekci writes,

In the nineties, I paid for parts of my college education by making such old software work on newer machines. Sometimes, I was handed a database, and some executable (compiled) code that nobody had the source code for. The mystery code did some things to the database. Now more things needed to be done. The sane solution would have been to port the whole system to newer machines, fully, with new source code. But the company neither had the money nor the time to fix it like that, once and for all. So I wrote more code that intervened between the old programs and the old database, and added some options that the management wanted. It was a lousy fix. It wouldn’t work for the next thing that needed to be done, either, but they would probably hire one more person to write another layer of connecting code. But it was cheap (for them). And it worked (for the moment).

The Virtual Library

Tyler Cowen writes,

as a very frequent user, I say libraries are getting worse. Much worse.

I say libraries should be obsolete. Much obsolete.

Imagine the set of books that people have in their homes as an enormous virtual library, with all books registered in a central registry and available to be borrowed. All we need is an app that makes it work that way.

At any one time, more than 99 percent of the books in my home should be lent out. That would be a win-win. I would have more space, and the people with the books would be reading them–or at least there is a non-zero probability that they would be reading them, which is not true for me. And if I get a sudden urge to read something I have lent out, I can borrow a copy from someone else.

Note that there could be opportunities for charging rent for books, for entrepreneurial book ownership, etc.

What Bureaucracies Do

Megan McArdle writes,

Does Congress need to give agencies a freer hand in developing good systems? I’m all for it. Should Congressional Republicans commit to support the president in hardening our government against cyber-attacks and other disasters, rather than simply holding political show hearings? Heck yes. But these things won’t happen unless the president makes fixing government IT a bigger priority — and starts enforcing accountability for every disaster that happens on his watch.

Along similar lines, David Strom, an IT consultant, writes,

If a private industry CIO had this sort of security record, they would never work in IT ever again, unless to become a motivational speaker and tell people what not to do. Instead, because they are the Feds, we just shake our heads and wonder what is going on, and some how give them a free pass to mess something else up again. It really boils my blood.

In my view, bureaucracies are notable for two things.

1. They filter out new ideas.

2. They blur accountability. When you make a reasonable request and are turned down because of “policy,” you have encountered this blurred accountability.

I understand the constructive value of filtering out new ideas. A large organization can only focus on a few major initiatives. Those initiatives had better be good ones. Most new ideas are bad. Think of a Type I error as making a catastrophically bad bet and a Type II error as missing out on a profitable opportunity. Bureaucracies help to curb Type I errors but tend to make Type II errors. And every middle manager who has ever had an idea die in the bureaucracy is convinced, usually incorrectly, that the organization committed a Type II error.

Perhaps there is also a constructive value for blurred accountability. But I cannot think of one.

Non-marketable Outputs and Executive Compensation

I have suggested that one can think of firms as taking marketable inputs and producing non-marketable outputs. These non-marketable outputs ultimately contribute to marketable outputs. It is the non-marketable outputs that bind the firm together. If instead all outputs were marketable, then you could unbundle the firm and arrive at marketable output using market transactions among many firms.

I have also suggested that non-marketable outputs have an indeterminate value. This in turn makes the compensation paid to workers indeterminate.

Apply this to CEOs or other top executives. A CEO produces non-marketable output. The CEO’s “output” consists of key decisions with regard to strategy and personnel. It also includes intangible effects on employees, customers, and other firms.

Non-marketable output is, by definition, mostly valuable within the firm. The value of firm X’s CEO to firm X is likely to be quite a bit higher than the value of firm X’s CEO to firm Y. Thus, the CEO’s opportunity cost easily could be low relative to the value that the CEO provides. Whereas for low-level positions, it is plausible that competition serves to narrow the range of potential compensation, the same is not true at the level of CEO. It would seem that the range of indeterminacy in CEO pay ought to be especially high.

Observers on the left have argued that the rise in CEO pay in recent decades reflects changes in social norms rather than an increase in CEO productivity. Although there may be other explanations, I would think that the range of indeterminacy is sufficiently high that one should not dismiss the social-norms story out of hand.

Non-marketable Outputs

A non-marketable output is something that has relatively little value outside of one firm. One company’s tax return won’t help any other firm file its return. A half-finished Chevy is not of much use to Toyota.

1. I claim that a typical firm buys marketable outputs, produces non-marketable outputs, and turns at least some of these non-marketable outputs into marketable outputs.

2. I can imagine a firm that produces only non-marketable outputs because it works only for a single buyer. However, there is a sense in which the firm and its buyer can be treated as a single entity.

3. Non-marketable outputs are what determine the configuration of firms. Suppose that there are ten stages of production. If at each stage the output is marketable, then there might exist firms at each stage of production. On the other hand, if only the final stage is marketable, then there will be just one firm.

4. The value of a non-marketable output is indeterminate. It has to be worth at least as much as the cost of the inputs required to produce it, and it cannot be worth more than the entire marketable output of the firm. But that leaves a wide range. Consequently, workers engaged in the production of non-marketable output do not have a well-defined marginal revenue product.

5. I conjecture that the larger the firm, the higher the proportion of non-marketable output relative to total output. If all you are doing is buying marketable outputs and selling marketable outputs, then you can be a tiny firm, like somebody who sells on e-Bay. On the other hand, if you manufacture airplanes, then most of your effort goes into producing unfinished airplanes, so you need a large firm.

Compare the old-fashioned general store to Wal-Mart. Wal-Mart has important non-marketable output in its supply chain, consisting of logistical systems and contracts with sellers. That supply chain might be worth something to an old-fashioned general store, and you can imagine a different Wal-Mart acting solely as a wholesaler/distributor. However, the supply chain is worth even more when it is integrated with large, strategically-located retail outlets, namely Wal-Mart stores.

6. I conjecture that non-marketable output tends to become increasingly important as the economy becomes more complex. That in turn would suggest that the trend would be for firms to get larger.

7. Some important creative destruction takes place in the arena of non-marketable outputs. Uber and taxi companies both offer on-demand rides. But Uber replaces the taxi company’s non-marketable output, its dispatching system, with something different. Amazon and traditional sellers both offer books. But Amazon replaces the non-marketable outputs of the traditional sellers (inventory management, product display, and customer fulfillment) with something else.

Note that Amazon found that a lot of its infrastructure proved to be marketable. Other companies rent server space from Amazon or sell products using Amazon.

Capital Indivisibility as a Theory of the Firm

Cameron Murray writes,

If it was the division of labour that leads to increased productivity, labour could just as easily be divided between firms. The fact that pin factories, even with only ten men, still performed all 18 tasks, instead of specialising in just 10 tasks, is clear evidence that there is something special and coordinated about the tasks themselves that arise from the particular capital investments. The tools and machines are designed to be compatible with each other, and if part of the process is done outside the firm, each of the two firms would inevitably be tied to the same compatible capital equipment, and would therefore find gains by merging into a single firm.

Pointer from Mark Thoma.

According to Alchian and Demsetz, Murray’s first sentence is false. If the value of labor is in their combined product, rather than in each individual task, someone must manage the production process and allocate payments to individual workers. Remember, in an Alchian-Demsetz firm, marginal product is not defined.

I agree with Murray that if two firms have complementary capital then there is an incentive to merge, at least if one or both firms does not have a lot of other choices for partners in production. But what Murray sees as the gains from merging firms that use compatible capital equipment also would arise from merging firms whose workers who undertake complementary tasks in a production process.

When Marginal Product is Undefined

In an Alchian-Demsetz firm, marginal product is not defined.

Think of a business that has exactly one full-time tax accountant (TA). In a sense, the marginal product of the TA is zero, since the TA contributes zero output. On the other hand, the tasks performed by the TA have tremendous value, allowing the firm to remain in business and keeping the owner out of prison.

What determines the compensation paid to the TA? It cannot be less than the TA’s best alternative, or opportunity cost. It cannot be more than the firm’s best alternative, which could be to hire a different TA, outsource to an accounting firm, or try to automate the process using software. If there is lots of competition on both sides of the market, then compensation will be driven to some unique level. Otherwise, there may be a range of plausible outcomes.

Remember that most of us are Garett Jones workers. We do not produce output. We produce organizational capital. So most of us have undefined marginal product.