I’ve been teaching programmers about the value of isolated tests1 for a long time, and recently I’ve seen increasing resistance to the idea. I worry that this comes partly from having presented motivations and reasons that tends towards the overly-abstract, ironically enough. Perhaps I can improve matters by returning to the concrete issues and constraints that led me to being exploring this idea in the first place. Consider the following questions. When I want to fix a problem within the...| The Code Whisperer
When you use relative include paths in your code, you bind each source code file to its current location in the project’s file layout. You relegate yourself to having to run it from a very specific location on the file system. You generally make it unnecessarily difficult to automate running your application (or its tests) outside your development environment, such as in platform-as-a-service environments. You make things like Docker not just helpful, but necessary. So stop doing that. You ...| The Code Whisperer
You have inherited some code. Congratulations. Now you need to change it. There, there. Michael Feathers once wrote that legacy code is “code without unit tests”. I use a slightly more general definition. By “legacy code”, I mean profitable code that we feel afraid to change. I think that both parts matter. You probably accepted the “afraid to change” part without any need for convincing. (If not, then this article probably won’t interest you.) Moreover, if the code doesn’t ge...| The Code Whisperer
At Øredev 2013, I asked managers to tell me what makes their job difficult. I spoke to one manager who told me that they face immense pressure on two fronts: from the board of directors to deliver more features more often and from the programmers to give them more time to refactor. I’ve heard dozens of stories like these over the years and I’ve found a trick that helps. It doesn’t resolve the problem, but it helps take a significant step in the direction of a resolution. Warning. You a...| The Code Whisperer
Another “demystifying” article. Great! I know… bear with me. Of the SOLID principles, the Dependency Inversion Principle remains somewhat misunderstood. I’d like to help with that. I hope you’ll ask questions and challenge these ideas, so that I can improve this little article. I learned the Dependency Inversion Principle from Bob Martin’s article, the salient part of which states: High level modules should not depend upon low level modules. Both should depend upon abstractions. o...| The Code Whisperer