Clean Code: What I Like
We were asked to read the first chapter of Clean Code: A Handbook of Agile Software Craftsmanship. Within this chapter, there is a quote from Ron Jeffries that I agree with and disagree with. Let’s start with what I do agree with: there should be no duplication. He states that the presence of duplication shows that we aren’t representing our idea correctly within the code. I can 100% agree with this, as duplication often occurs when we are coding without fully understanding what needs to be done. We are just writing code as we need it, when we should instead do our best to determine what we need before hand.
Clean Code: What I Don’t Like
In his quote, Jeffries also states to limit the number of classes, functions, and methods. The reason I don’t like advice like this is because how do we know what the right number of entities is? It seems like this would be subjective from person to person. He also goes on to state that methods and classes that are doing too many things need to be broken up unto smaller objects or sub methods. I can agree with this to a certain extent, but when we try to put a definitive number of lines on a function or class, it starts to get a bit murky.
Refactoring: What I Like
In the book Refactoring: Improving the Design of Existing Code, Martin Fowler lists some “code smells” that we should look out for. One of the code smells he lists is the “Mysterious Name”. He discusses how renaming a function, or variable may seem like something that is unimportant, but can often save hours of trouble. This is especially true with functions. Often times, we don’t even need to look at the logic of the function. If the function is properly named, we should be able to deduce its “functionality” based solely on its name.
Refactoring: What I Don’t Like
Apparently, Martin Fowler is not a fan of loops, and says “they are no more relevant today than bell-bottoms”. I admit, I am not sure if I am in the minority, but I find loops very easy to follow and understand. It is entirely possible that this is only the case because that is how I learned programming, and my mind can’t imagine an alternative. In addition, I may change my mind as I gain more programming experience.