11

One of our senior developers has stated that we should be using a naming convention for stored procedures with an "objectVerb" style of naming such as ("MemberGetById") instead of a "verbObject" type of naming ("GetMemberByID"). The reasoning for this standard is that all related stored procedures would be grouped together by object rather than by the action.

While I see the logic for this way of naming things, this is the first time that I have seen stored procedures named this way. My opinion of the naming convention is that the name can not be read naturally and takes some time to determine what the words are saying and what the procedure might do.

What are your takes on this? Which way is the more common way of naming a stored proc, and does a what types of stored proc naming conventions have you used or go by?

Gan
  • 602
Chris
  • 2,013

4 Answers4

10

Look at it like this. How are your methods organized in code? By object, with the methods hanging off.

MyObject.GetById(int)
MyObject.Save()

By having your stored procs mimic that naming, it will be much easier to see how they relate to your source code.

MyObjectGetById
MyObjectSave
CaffGeek
  • 8,103
6

I too can see the logic; it groups actions together by entity. However, if your actions are always GET, PUT, and DELETE the change in naming might not matter that much. I see the best benefit from the new naming standard occurring when you have unique action names e.g. "AccountTransferMoney," that kind of thing.

The most important thing is that there is a single standard, and that it is followed by everyone.

Robert Harvey
  • 200,592
5

You have to decide what's the bigger issuer, finding the procs you're looking for or quickly deciphering their meaning?

If you see:

memberGetID memberGetName memberGetThis memberListSomething memberDelete

At some point, once you've already found 'member' you just ignore that and go from there.

Look in a phonebook. If you want to find John Smith, is Smith, Dave Smith, John Smith, Robert

really that hard? I don't call people by their last name and then first name unless it's James Bond.

JeffO
  • 36,956
0

Instead of "objectVerb", you could use "namespace_verbObject", like Member_GetById.
It will group procedures by namespace, and still use traditional "verbSomething" naming.

Abyx
  • 1,445