Tuesday, March 20, 2007

Whats in a name?

English is ambiguous. It is easy to misinterpret well formed sentences not to mention variable or class names.

As developers, we put the definition of a class in its name. Its a good practice. It enhances readability. Its a difficult skill to master, but important.

While a good tool for readability, it is not a substitute for documentation or a complete way of understanding a class' responsibilities or interactions (tests work great here). Even if a class is named well, it can still be misinterpreted and we enter a dangerous path when we rely on names alone.

English can't be taken too literally and what means something to someone means something completely different to someone else. I'm not sure English will ever be enough context to understand a class... With resharper, I'm a big fan of ctrl-b (go to definition), ctrl-alt-b (go to inheritor) and ctrl-alt-f7 (find usages), this is a quite a useful and quick way to explore code and can take even less time than analyzing a name!

The other day I read some bizarre, but entertaining and artistic naming conventions and I found readable and more enjoyable... interesting idea; I wonder if it would ever catch on :)


Matt said...

Where's the link to the artistic naming conventions?

wunda said...

Names were care of Daniel and Evan and unfortunately there is no link available to that code :(