I am creating an object oriented design for a cab-calling app like Uber. I have some of the classes listed. I am having trouble in designing behavior between the classes. For example, I have these two classes -
A customer can call drivers and a driver can accept a ride request from customers.
So my thought is
Customer class will have a function
Driver class will have a function like
I have two questions here -
Where should the actual implementation of contacting nearby drivers and confirming driver's response should be? My thought is that there can a utility class, lets say
CustomerDriverInteraction. This class will actually have functions for contacting near by drivers and recording their responses.
Customerclass would instantiate
CustomerDriverInteractionand call its functions . Is this a good way of going about it?
Once a driver accepts a request, the customer and driver need to be linked together for a ride. Should there be another class called
Rideclass will have a
Driverobjects as their members, among other fields. Is this approach correct? What are are the better ways of designing it?