Tag Archives: refactoring

Five code commenting anti-patterns

In some projects (most?) comments multiply like tribbles creeping up everywhere. Sometimes the comments are especially useful but other times comments useless are destructive to maintainability. Contrary to some beliefs, bad and inaccurate comments are not mostly harmless. Bad comments take many forms. There are four forms that I think could be considered anti-patterns: 1.… Read More »

Unit testing private methods using reflection (and other solutions)

When it comes to unit testing you might find yourself wanting to test private methods. Here’s four solutions, some much better than others. 1. Don’t test private methods (refactor!) If you find yourself needing to test private methods, you’re code is trying to tell you something – listen up! Unit tests should test the behavior… Read More »