Class Naming Really Does Matter

Time and time again I see programmers making up nutball names for their domain objects. This makes it really hard to understand the code without diving in. I deal with a significant amount of code on a daily basis and if I had to read every line I’d be in big trouble.

Instead I prefer to look and the classnames and imports to get a good feel for what the code does and what the relationships are. Sure sometimes I have to dig into the initializer (init) of a class and maybe a method or two. But in general I really don’t need or want to read everything all of the time.

Package names are different. I don’t mind when it is not immediately obvious what a package does when reading the name. FefiFofum is a fine name for a package. But what if that were the class name? Is it a FIFO queue? Is it a simple data object? What a pain!

For the sanity of other programmers please use good names for your classes!

Update: I have another post that explains how I come up with good names.

Share and Enjoy: These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Digg
  • del.icio.us
  • Reddit
  • Technorati

Comments

  • How is 'good class name' defined? Long and descriptive? Describes input/outputs? Proper noun?
blog comments powered by Disqus