amounts it posts to the indicated ledger.
The new model has several advantages.
The change
Enriches the
UBIQUITOUS LANGUAGE
with the term "accrual"
1.
Decouples accrual from payment
2.
Moves domain knowledge (such as which ledger to post to) from the script and into the
domain layer
3.
Brings fees and interest together in a way that fits the business and eliminates duplication in
the code
4.
Provides a straightforward path for adding new variations
of fees and interest as
Accrual
Schedules
5.
This time, the developer had to dig for the new concepts she needed. She could see the
awkwardness of the interest calculations and made a committed effort to look for a deeper
answer.
She was lucky to have an intelligent and motivated partner in the banking expert. With a more
passive source of expertise, she would have made more false starts
and depended more on other
developers as brainstorming partners. Progress would have been slower, but still possible.
Contemplate Contradictions
Different domain experts see things different ways based on their experience and needs. Even the
same person provides information that is logically inconsistent after careful analysis. Such pesky
contradictions, which we encounter all the time when digging
into program requirements, can be
great clues to deeper models. Some are just variations in terminology or are based on
misunderstanding. But there is a residue where two factual statements by experts seem to
contradict.
The astronomer Galileo once posed a paradox. The evidence of the senses clearly indicates that
the Earth is stationary: people are not being blown off and falling behind.
Yet Copernicus had
made a compelling argument that the Earth was moving around the sun quite rapidly. Reconciling
this might reveal something profound about how nature works.
Galileo devised a thought experiment. If a rider dropped a ball from a running horse, where would
it fall? Of course, the ball would move along with the horse until it hit the ground by the horse's
feet, just as if the horse were standing still. From this he deduced
an early form of the idea of
inertial frames of reference, solving the paradox and leading to a much more useful model of the
physics of motion.
OK. Our contradictions are usually not so interesting, nor the implications so profound. Even so,
this same pattern of thought often helps pierce the superficial layers of a problem domain into a
deeper insight.
It is not practical to
reconcile all contradictions, and it may not even be desirable. (Chapter 14
delves into how to decide and how to manage the result.) However, even when a contradiction is
left in place, contemplation of how two statements could both apply to the same external reality
can be revealing.
Read the Book
Don't overlook the obvious when seeking model concepts.
In many fields, you can find books that
explain the fundamental concepts and conventional wisdom. You still have to work with your own
domain experts to distill the part relevant to your problem and to crunch it into something suited
to object-oriented software. But you may be able to start with a coherent, deeply considered view.
Do'stlaringiz bilan baham: