Lazy code vs sloppy code

As a Spanish person I feel perfectly qualified to talk about laziness. And as a Spaniard with a job, I feel qualify teach you the way to success through laziness.

In all seriousness, thought, it is important that we distinguish between being lazy and being ineffective or inefficient. We have talked about the advantages of being “lazy” and what it means. So we will talk now about the things you should avoid to do in the name of laziness so that you future self and all your colleagues will thank you for it.

The type of laziness we are encouraging here is the long term kind of laziness. It might be counter-intuitive that sometimes to be lazy you need to do more work than you would otherwise do, but the time invested today will mean much much less time needed tomorrow for the same task. This is very clearly visible when we talk about learning new skills, and somewhat visible when we talk about planning and organising long and complicated calculators.

The important thing to remember when coding for a calculator is that no matter how obscure or complete you think your calculator is, it will eventually be checked, used and modified by other people (this includes future you). When that time comes, any time invested in making your code more sensible, more flexible, more understandable and well organised will pay back greatly.

We don’t need to take any particular example (though Sig Fig Calculator is a great one) for everyone to picture calculator code that was sloppy, cryptic and did not make much sense. When you encounter such code you often need to spend many hours just to understand what the calculator is doing and why. When we encounter the opposite, a well coded calculator with proper structure and style [1] , reading code can be almost as quick as reading instructions written in plain English. This second type of calculator is the one that saves time in the long run, makes you feel proud and makes everyone love you. So aim to be that kind of programmer, aim to be the lazy programmer, not the sloppy one.

[1]We have a style guide to help everyone at Omni have a similar way of writing code. Check it out in the How to be friends with other calculatorians section.