Nov-15-2020, 11:15 PM
I would argue for the top version, from the point of view of maintainability and expandability. What happens if another fruit is introduced, apple? Add a couple lines to the first one and you are fine. But, how do you fix the second code snippet to handle apples? And then they add coconuts. And they migrate.