top of page

Forgetting How to Write Code while Writing Code

  • Writer: Kimone Premlall
    Kimone Premlall
  • Mar 30, 2020
  • 1 min read

Updated: Jun 17

Just completed my first task on our stand-up board. Got through it quite well, but I wish I had been more methodical in my approach to writing code. Once we pushed the code to staging and tested it, I realised that I forgot to add toggles to the code. Also, in the middle of development I realised that the code had no unit tests. In a panic, I tried to add the tests, which broke immediately.


So... I think it's best to have a sequence of steps for my development process. This may change overtime and not every step will apply to every situation. But here goes:


1. Analyse the problem

2. Add toggles around old code that will be changed

-- Build & Push Code

3. Write unit tests based on the expected results

4. Solve the problem in the simplest way

5. Make sure that all new code is toggled

6. Run unit tests and fix errors

-- Build & Push Code

7. Refactor the code

8. Make sure that all new code is toggled

9. Run unit tests again and fix errors

-- Build & Push Code


This is a guide for the development process in general. Stick to this pattern and you should be ok.


I would like to do a strategy like this for refactoring code, which lists all the most common refactoring steps. Following a strategy like this should help me get used to refactoring. I should be able to refactor without a guide within a few months of working with one.

Comments


bottom of page