Skip to content

Instantly share code, notes, and snippets.

View rajakolluru's full-sized avatar

rajakolluru

View GitHub Profile
/*
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 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
/*
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