Shawn Ng

Programming Principles

 

There are many schools of thought on programming. Here are my principles.

KISS (Keep it simple, stupid)

It must be readable enough for non-programmers to understand in plain English. It must be simple enough for beginner programmers to understand. It's simple in theory, but not in practice. Having the ability to write is essential.

Intellectual masturbation is bad. People who have the time to make things unnecessarily complex are bad for the company, don't hire them.

DRY (Don't repeat yourself)

Don't repeat yourself means don't write the repeating code. It is tempting to copy and paste working code for instant readability, but bad for maintenance. Pay the upfront time to write well-thought code rather than technical debt after.

Documentation

There are conflicting views on leaving comments in code. Some believe that well-written code is self-explanatory and doesn't require it. Others believe a complex piece of code should have some.

I believe that the function and variable names should clearly explain what the code means. Following open-source projects, I add docstrings to my code.

Published: 2020-05-28 | Updated: 2021-12-10

Share this!