I often find places where people have decided to re-implement some functionality that they could have just called from a library. Sometimes this is done because they honestly didn’t know the library call existed, and other times it’s because their pride insists that they could do it better.

I once had to work on a Java codebase where some developer had decided to re-implement String.trim(). I find it hard to believe that they didn’t know there was already a trim method so I can only assume that they thought they could write one that was better. As it happens, the new one was so inefficient that it added a total of 19 seconds to the startup time of the application. Something we discovered when we removed all references to it and used the built-in String.trim() instead.

So earlier this year, when I saw the headline “Self-pay gas station pumps break across NZ as software can’t handle Leap Day”, I naturally assumed that some developer had taken it upon themselves to re-implement the date logic in their app, and had failed to account for Leap Day. I never did hear if that was the actual problem but I think it’s a safe bet.

Whenever you find yourself wanting to build something that feels like it should already be built somewhere else, it’s worth taking a few minutes to search for it first.