Both chapters 5 and 6 of The Clean Coder seem like basic things all programmers should know and be including in their work. Chapter 5 goes over reasons that programmers should follow and use Test Driven Development. Martin gives a brief explanation of what TDD is and his three rules for how to do it:
“1. You are not allowed to write any production code until you have first written a failing unit test.
2. You are not allowed to write more of a unit test than is sufficient to fail—and not compiling is failing.
3. You are not allowed to write more production code that is sufficient to pass the currently failing unit test.”
He then talks about the benefits to coding this way; that programmers have more confidence that their code works, code is less susceptible to defects, coders are not afraid to make changes to the code, test code acts as good documentation for other programmers,  and it makes you focus on how to better design your software. I have taken a few classes where TDD was emphasized, and I have learned that making these types of tests can save you a whole lot of time when working on any project. Though Martin also points out that you can have bad tests and thus bad code; especially if you are unclear about the project or about how to design it. The other thing that I want to point out is that unit testing isn’t the only type of testing out there, but it is a good place to start if you have never add tests while coding.

In Chapter 6, Martin goes over why programmers should practice programming. As he has said in previous chapters practicing isn’t for your work, it’s for improving yourself as a programmer. He goes over several ways to do this: by practicing by yourself, by practicing with a partner, and by practicing in a group. He points out the positives for each type of practice and gives website examples of where these exercises can be found. Again I find this kind of a no-brainer. If you are in a field make sure to keep up on what’s going on in it and keep your skills sharp. However, I don’t agree with how militant Martin is when he talks about this. If all you do is code for work and then code in your free time, then you are going to get burnt out really fast. I personally think that working with a person and setting up a bi-weekly meeting to do small exercises or projects is the best way to practice a new code, or keep up on existing skills. (I say that this is the best way because it keeps you focused and makes you learn to work with a pair/group mentality, but I also think small personal projects are also great.) I also saved the websites that he gave examples from to do some of the “kata” exercises later in other languages I want to learn.

Advertisements