Roel: 2/ According to the specifications the only 2 required actions are finding rooms and booking a room (which is considered an update of the room record).
Do you think validating all my input for all the set methods in my HotelRoom class is an overkill?
Oladeji Oluwasayo wrote:Hey, how do I upgrade to "ranch hand", I don't like this "greenhorn" thing under my name?
Oladeji Oluwasayo wrote:Please let me know if this kind of detailed validation is too much for the assignment. I don't want to do beyond what is required. Thanks.
Roberto Perillo wrote:Howdy, Oladeji!
Honestly, yes. There is a way to design software known as design by contract. Basically, it implies that some conditions must be followed before data achieves a particular point. For instance, let's say that we are designing our business layer and defining business methods. We establish a contract: the Room object must not be null when the bookRoom method is invoked. So:
The component that invokes this method must not send a null object, and thus, it is his task to verify if everything is correct.
On the other hand, there's the defensive programming, where there is no contract. So, still in the example above:
I myself just generated the getter and setter methods, but if you want, you may justify that you followed a design by contract approach, and therefore, everything will always be ok when the HotelRoom methods are invoked.
Oladeji Oluwasayo wrote:The only thing is that I don't know what the markers expect.
Roel De Nijs wrote:and what about adding just a null value to the record cache in case of a deleted record? I would object against adding a boolean value to your value object, because when a record is deleted there is simply no value object (because there is no record, it's deleted). When you want to reuse record numbers, just iterate over the map and find the 1st null value.
Oladeji Oluwasayo wrote:if you have multiple null references representing the deleted records in your Map.values(), how do you obtain their respective keys?
public String read(int recNo) throws RecordNotFoundException;
Did you guys actually take this recNo as the customerID in your implementation?