We have a type of data in the system that used to only come in pairs. I guess at some point that changed so we might get up to 5 different records of this type. Now we need to change again to handle an unlimited number of records. I was tasked to find out what would happen if the change happened before we could update our software. Everyone thought the app would bomb. I was surprised when it handled multiple records with ease.
I did some investigation. There was a constant definining the maximum amount of records to be two. Why wasn't the system crashing? Wouldn't they be trying to access some memory or indexes that were out of bounds? Nope.
A close inspect of the code showed that it counts the number of records. Then it would retrieve the records, up to the maximum amount that it expected. The system just ignored all subsequent records. Nice. That's the way to design software. Plan for future expansion. And handle that expansion in a controlled way.
Free Laundry
-
Apparently a lot of apartment buildings have coin operated laundry machines
in the basement. And guess what? You can order a key to unlock the payment
me...