This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hi, I'm Reservation. | |
I dont need an interface because I am a carrier of data. | |
Like a good carrier, I can be instantiated in any layer and used | |
in any other layer. | |
[CR] Nomenclature! "Data carriers" are *not* domain models. They are | |
DataTransferObjects (DTOs). What I call domain model, you seem to call | |
Service Object, whereas what I mean by "Service Object" is something | |
altogether different...so maybe this is part of the reason we're not |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* This is my interface, my API, my contract. */ | |
interface IReservation { | |
IList<IGuest> getGuests(); | |
Duration getLength(); | |
Amount getBalance(); | |
Amount getTotal(); | |
bool cancel(); | |
// By the way pay() could have been in IPaymentMethod as well but you know what? | |
// I called first and so I win! | |
// Or both of us would end up implementing pay() in which case we would smartly delegate |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Hi, I'm Reservation. | |
I dont need an interface because I am a carrier of data. | |
Like a good carrier, I can be instantiated in any layer and used | |
in any other layer. | |
If you need to do stuff with me you should know to instantiate the correct | |
service and pass me to it. | |
Makes sense too since I you might need other classes to instantiate service |