I was part of a code review recently where someone said, “I did this as a lazy alternative to X”. It didn’t look like much at first but as we dug in there was a dangerous mixing of concerns which would cause issues because of the coupling. Changes in one part of the system would have an effect on unrelated parts of the system.

A while ago someone was looking over some of my code and said, “Oh wow, you created objects and interfaces for everything. I feel so lazy.” It was weird to hear because I feel lazy.

Here’s the thing; I’m one of the laziest people you’ll ever meet in terms of software development. I create objects for everything because I’m lazy. I relentlessly separate concerns because I’m lazy. I’m obsessive about maintaining encapsulation because I’m lazy. I keep different levels of abstraction separate because I’m lazy.

I’m sure you’ve heard the factoid that the average person can hold 5-7 things in short term memory at any one time. I’m definitely on the lower end of that spectrum. The most exceptional individual can remember maybe 10 or 15 pieces of information at once. That’s not a large spread. If you think you can remember all of the details about a system you’re only fooling yourself. You have to spend quite a bit of time stumbling around and re-remembering what all of those bits of tribal knowledge are. Stop wasting that limited resource. Don’t bother remembering that every change to Foo requires a change to Bar and Baz. Remove the coupling so you don’t have to remember! Don’t waste your effort remembering you need to call `get(“pl-user-sys-name”)` to get the users name. Codify it and call `getUserName()` instead! Don’t make people remember that `uacc` is the user’s account, rename it to `userAccount`.

Having to remember that a conditional, when modified, needs to be modified in 5 different places is not lazy programming. That’s the most active programming possible. You will need to remember that every time you work on the system. You will have to tell new developers about it. And you will be the one everyone goes to when weird bugs pop up with it at 3 in the morning. Embrace lazy software development. Encapsulate your concerns so that you can stop worrying about them. Codify all that knowledge so that others can simply see the purpose of the system. They shouldn’t have to ask you. The intent of the system should be self evident.

Advertisements