I have a reservation system that allows you to Book a reservation, Modify an existing reservation, and Cancel an existing Reservation. I was looking into the Interface Segregation Principle and I was wondering how thin I should make my interfaces and if I am violation the Single Responsibility Princple. My intial design was:
interface IReservation
{
void Book();
void Modify();
void Cancel();
}
but then I thought, what if one Reservation system, does not need to implement one of these methods for a reservation and is just concerned with Bookings for example, 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 becomes am I taking it to far with thinning it out like this. Also, it becomes harder to think of names for the interface, for example, I don't like IModify or ICancel (They just seem like methods to me that should be on the IReservation interface). How do you determine what should go into an interface and what should be segegrated out into another interface, class, etc...