Step 2 - Polygene™ "Making a booking."
Location: Page 17, "Knowledge-Rich Design.
Results from Step1
- For the Cargo and Voyage interfaces, we have introduced the Property<Double>.
Property is an explicitly supported type in Polygene™, which makes life a lot easier
for everyone involved.
- The SequenceGenerator has changed the name to "HasSequence", since it doesn't handle the
generation of new numbers. It is given Property<Integer> to hold the last
sequence number, but it doesn't handle the next() equivalent from Evans' code.
-
The increment of the sequence number is instead handled in the SequencingConcern. One
advantage is that the number will only be incremented if the policies are met, as we
will place this concern at the top of the call chain.
-
Overbooking is a concern (according to Mr Evans in this part of the book) for the
makeBooking() method. So, we create an OverbookingConcern, that implements
the ShippingService. See below for more details.
-
The ShippingService remains the same. But notice that there is No Implementation!
-
We introduce a new interface, ShippingServiceComposite. This interface binds together the
parts to form the Composite. It extends the ShippingService and the
Composite and has annotations about how it should be wire together.
The ShippingServiceComposite
The ShippingServiceComposite declares which concerns should be used, and the order is significant. The
SequencingConcern is placed first, that means it will be invoked before the OverbookingConcern,
but it performs its own work after the call to the next.makeBooking() method.
The OverbookingConcern
It extends ConcernOf to show which MixinType it is chained into.
Moving on