I have a reservation system that allows you to reserve a reservation, modify an existing reservation and cancel an existing reservation. I studied the principle of separation of segregation, and I was wondering how subtle I have to deal with my interfaces, and if I violate the principle of sole responsibility. My internal design was:
interface IReservation { void Book(); void Modify(); void Cancel(); }
but then I thought that if one reservation system does not need to implement one of these methods for reservation and, for example, just deals with booking, so I did the following:
interface IBook { void Book(); } interface IModify { void Modify(); } interface ICancel { void Cancel(); }
Now I can do something like this:
interface IReservation : IBooking { }
or
interface IReservation : IBooking, IModify { }
So the question is that I take it for a long time, draining it like that. In addition, it becomes more difficult to think of names for the interface, for example, I do not like IModify or ICancel (they just seem to me to be methods that should be in the IReservation interface). How do you determine what should go into an interface and what should be allocated to another interface, class, etc.
source share