Coding for Co-Workers, part 1

I write code for my co-worker, not for the compiler. In this series of articles, I try to explain what this means.

Useful names

Classes, methods, and variables should have a name that reflects their current purpose. This means that a developer who is unfamiliar with some code should be able to glance at it and have an idea what is it about. If the purpose changes, the name should change as well (Using a proper IDE which allows you to change all occurences helps a lot here).

If you decide on the name, or if the only thing you can decide on is something general like UserManager, this a good sign of code smell. Chances are that the class or method does too much, and can be refactored into smaller subclasses/submethods.

Comments are closed.