Friday 2018-12-14

Domain-Driven Design by Eric Evans

Evans notes that programmers make errors when they do not fully grok the problem domain in which they operate. He proposes the remedy that developers should a) adopt the established jargon of the domain, b) "live in the domain", working closely with domain experts, and c) use the mental models of the domain.

Chapter 8, "Breakthrough" has an amusing story of Evans working at an investment bank:

We were developing a core part of a large application for managing syndicated loans in an investment bank.

When Intel wants to build a billion-dollar factory, they need a loan that is too big for any single lending company to take on, so the lenders form a syndicate that pools its resources to support a facility (see sidebar). An investment bank usually acts as syndicate leader, coordinating transactions and other services. Our project was to build software to track and support this whole process.

The Loan Investment is a derived object that represents a particular investor’s contribution to the Loan, proportional to its share in the Facility.

But there were some disconcerting signs. We kept stumbling over unexpected requirements that complicated the design. A major example was the creeping understanding that the shares in a Facility were only a guideline to participation in any particular loan drawdown.

The Loan Investment had disappeared, and at this point we realized that “loan investment” was not a banking term. In fact, the business experts had told us a number of times that they didn’t understand it. They had deferred to our software knowledge and assumed it was useful to the technical design. Actually, we had created it based on our incomplete understanding of the domain.

Apart from Evans' struggles, is it the case that many programmers have a damagingly limited grasp of their problem domains? Perhaps; though this assertion echos the conceit of TheReflectivePractitioner -- that everyone else is horribly broken, and they need to be fixed.

While prima facie true from a Human Perfectibility perspective, books like these are abused by reformers: despite the normality of errors across regimes, reformers point to the errors of the current regime (all these books say everything is broken), and boldly state that we can do better by adopting The New Regime.

Of course, that the reformers will gain personally from such is a small cost to pay for the overall benefits which will accrue to Humanity forever.