“Am I a good developer?” - That’s the question I ask myself often. When I first started coding I was a complete novice and my biggest fear was not being able to write functional code that will do the acquired job. As time passed, I’ve improved my skills and slightly lost that fear. I realised that you can always write code that will do the job. But the question always remained - is it good code and does it make me a good developer?
To find answers, I started reading the book Clean Coder, written by Robert C. Martin, recommended by my two friends, Matija and Martin.
First chapter was - Professionalism. Before reading it, I thought that if you get paid for the job you do, then yes, you are a professional. Oh, what a fool I was :)
To be a professional, it takes much more then just being paid. First thing is taking responsibility - “If you make a mistake, you clean up the mess.”
Personally, I love this rule and I think we should apply it in every aspect of life. My father once told me that it is not a problem if you make a mistake, that’s normal, everyone does it. But that you should fix that mistake and try not to make the same mistake again.
So, taking responsibility when coding means knowing that you have functional, flexible, working code that doesn’t break anything else. One way of achieving this is to have your code covered with an automated suite of tests. The best thing to do when adding a new feature or changing existing is to start with writing a failing test. So don’t add code! The first thing to add is a test - failing test! Then, write some code to fix that test and then refactor the same code and run the test again. Repeat this until the code is acceptable and you are happy the way it looks.
In my everyday work, I try to follow this rule and to have tests that cover my code. To be honest, it is not always easy and sometimes it requires a lot of time and effort to have tests on an existing codebase. I do my best.