5 good programming habits that will change the way you code forever

Ehsan Alikhani
1 min readMay 4, 2022

--

A close-up of the cuneiform inscription — Bisotun, Iran
  1. Make your code as readable as a book
    - Use long, descriptive names.
    - Divide the code into logical subroutines.
    - Keep it simple when possible — there are no points for complicated one liner solutions.
  2. Follow three steps in this order:
    - First, make it work.
    - Then make it right.
    - Then make it fast and beautiful.
  3. Spend a lot of time reading and understanding a complex piece of code you might be interacting with
    - Jumping to code when you do not understand what is happening around will almost always result in an inefficient solution.
    - You will end up saving time.
  4. Use debuggers extensively
    - Understand input fast: put a breakpoint, play around with methods on your input.
    - Sandbox: Quickly implement a solution in the watch/console section instead of rerunning the whole program.
    - Debug: Understand the state of the program and fix it up.
  5. Write tests, a lot
    - It’s better to fail early and fix the problem than fail in production.
    - Every time you refactor, change, or add to your code, your tests will make sure you did not regress.

That’s all for this post. If you find this useful, share and leave a like — it motivates me to write more similar content 🙂

--

--