Working on an application mostly means thinking about ways to express a given problem in a way that a machine can understand and work on it. Domain-driven design takes this full circle back and makes sure that the people working on the domain understand the machine representation of the problem, and are therefore able to reason about it and contribute to it.
Throughout the book, we have been talking about building a language for humans and machines at the same time. Doing this means taking the constructs that JavaScript gives us and making them expressive to developers and domain experts alike.
There are many ways to express a problem, and some of them are easier to reason about than others. In a very simple case, for example, one could write the sum of the numbers of an array like this:
var ns = [1,2,3,4] for(var i = ns.length-1, si = ns[i], s = 0; si = ns[i--];) s += si console.log("sum for " + ns + " is " + s)
This simple program works by doing a lot of...