There is no insanity so devastating in man's life as utter sanity
There is no insanity so devastating in man's life as utter sanity
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).
OCPJP 6, OCMJD 6
OCPJP 6, OCMJD 6
OCPJP 6, OCMJD 6
OCPJP 6, OCMJD 6
Do you think validating all my input for all the set methods in my HotelRoom class is an overkill?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
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.
OCPJP 6, OCMJD 6
Oladeji Oluwasayo wrote:The only thing is that I don't know what the markers expect.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
OCPJP 6, OCMJD 6
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.
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
OCPJP 6, OCMJD 6
Oladeji Oluwasayo wrote:if you have multiple null references representing the deleted records in your Map.values(), how do you obtain their respective keys?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
OCPJP 6, OCMJD 6
by saying
public String[] read(int recNo) throws RecordNotFoundException;
Did you guys actually take this recNo as the customerID in your implementation?
Cheers, Roberto Perillo
SCJP, SCWCD, SCJD, SCBCD
I like you because you always keep good, crunchy cereal in your pantry. This tiny ad agrees:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|