Friday, October 3, 2008

Naming the opposite of actual...

What if a formal parameter does not have the precondition != null? I have started to try out aBookingOrNull, like in

private void UpdateFrom(Booking aBbookingOrNull)

You may argue that this is just the complement of anActualBooking, so one of them is redundant. Instead, I could use either of the couples
  • aBookingOrNull vs. aBooking (or just booking)
  • aBooking (or just booking) vs. anActualBooking
I agree. But seeing aBooking (or just booking) on its own, it is not intuitive which of the couples I have settled on. So, for the time being, I prefer the couple where each of the two alternatives is explicit:
  • aBookingOrNull vs. anActualBooking

No comments: