Vagif Abilov's blog on .NET


Can you afford naming mistakes?

I usually don’t. I know that if I choose wrong name for a class, project or service, I am going to spend time on hating them later. And if there are several people in the team who have strong feelings about proper naming, they are going to bring back wrong naming issues and use their precious time on it. So unless the project is shipped, and names it exposes become a contract that you can’t violate, it’s worth sorting out all uncertanties about naming convention.

There is however an argument that name corrections should not have high priority because it’s just a refactoring that don’t change a thing in functionality. But does it really cost so much to fix wrong name that you should postpone it (and potentially increase the cost of change)? I tried to measure one such change.

Yesterday I revised one of our services that provided validation of payment limits. Originally it was placed in PaymentEngine/Limits folder, and the WCF service it exposed was called just Limits. It was decided to relocate WCF services and revise their names to better reflect its business purposes, so I moved the project to a new place under Services/LimtsValidation. The change also affected several configuration and Wix deployment files.

Right after I was done with my changes, one of my colleague commented that “LimitsValidation” is not the best name. If we apply the same guidelines and styles we use for other projects, we should call it “LimitValidation”, with the word “limit” in singular form. After a short discussion I agreed but added that I won’t correct the name now, and maybe we should just live with “LimitsValidation”. Well, it’s not a big deal, is it?

But when I came back home, I realized that it will be difficult for me to cope with a wrong name that I admitted was wrong. And the best time to fix it would be now, when I still remember what I did and which files I changed.

So today I came to work earlier and corrected spelling of the service name and related files. This is what it cost me:

  • Files changed: 22 (including changes in projects, folders, namespaces, configuration and deployment files)
  • Time spent: 25 minutes (including execution of selected integration tests to validate availability of affected services after the change)

As you see, it did not take much time to correct a naming mistake, but it would take much more if the correction was postponed until it no longer remained an internal matter. Then it could even become too costly to afford.

Comments

Fadzai Chamba said:

This is an interesting topic, and one that I have just had to work around. In my case however, I was writing a WCF that a would be called periodically by a windows service and a couple of web-applications to access some data.

One of the fields in the database table that I was providing access to was given a name which is a rarely used word in this part of the world. It also had a data type of integer and it wasn't clear what values were valid or what they would require. At first I thought it meant number of days, but it turns out that it was a small set, 1 - Daily, 2 - Weekly, and 3 - Monthly. Seeing as I couldn't change this, I had to do all the work on my service.

What I did is that the data contract had a more easily recognizable name, instead of "Periodicity", I changed it to "Interval" which most people would be familiar with. I then made the data type an Enumeration which I created so that it would be clear which values to pass so that the the database has valid data only.

The cost there was just a few minutes, and now there is no guessing what values to put in the table as there was before, anyone can just go to the service, create an object and specify that the Interval is Weekly and the rest is done by the service which makes access to this very simple.

# October 2, 2009 5:02 PM

凡客诚品 said:

The cost there was just a few minutes, and now there is no guessing what values to put in the table as there was before, anyone can just go to the service, create an object and specify that the Interval is Weekly and the rest is done by the service which makes access to this very simple.

# October 6, 2009 3:18 AM
Leave a Comment

(required) 

(required) 

(optional)

(required) 


Please add 3 and 8 and type the answer here: