Long Names: a smell? or a clue?

Sometimes I want name a method or class with a long name. I wrote about this once before. I stumbled upon someone claiming that he only used long names because he didn’t take the time to think of a shorter name. I offer a different reason.

I use long names when I don’t have enough evidence yet of a pattern that will let me shorten the name.

If I create a new thing, and it’s the only of that type of thing in my system so far, then I’ll name it something long and descriptive. As I add similar things to it, those new things will overlap their names with the first thing. I’ll use that as a sign to remove structural duplication. As I do, I’ll remove that word or phrase from the longer names, making them shorter. Assuming that I keep this up, the long names will shorten as I generalise the system in the direction of design changes the need for which I have real evidence. I could speculate, but that usually lands me in the soup.

12 years ago
Comments
blog comments powered by Disqus




Blue Theme by David