Why I write bad code
I love the title of this blog as the answer to me is clear.
I write bad code because there is no other way. Then once I have written it I can improve the design, rewrite the algorithm and refactor it until the cows come home.
But at the end of the day, I start out with some truly awful code, it’s only good point being that I got it to work. And I think this is the same for everyone who writes code. There are ways to reduce the amount of time you have bad code for in your system, the “red, green, refactor” approach being a prime example.
So in conclusion, writing bad code is fine - and should be encouraged, so long as you think about:
- improving on it before committing.
- tidying it up when creating a pull request.
- reviewing your pull request before asking for feedback.
- having it reviewed before merging.
- thinking about it before deploying.
After all, it may be you who has to fix this bit of code when it is next broken. :P