This has always been one of my favorite Dilbert strips. Why? Because in our field, it's true. Many times I've spent more time figuring out what to call something than I spent actually developing it.
This week, I've been gathering ideas from team members on how to name some methods that we use throughout our application. The existing names are ambiguous and the methods have not always been used correctly, so I want to rename them to something that makes sense.
We have 2 sets of methods for working with "nullable" values. Pretty standard stuff:
- Take a database value (object) and return a value of the desired type, using a magic value to represent null
- Take a user-entered value (string) and return a value of the desired type, using a magic value to represent null
We have a pair of methods for each data type that we work with: Guid, String, Integer, Decimal, etc. The methods are ubiquitous as all user input needs to (should) flow through one of these methods, and all database values need to (should) flow through the other. So virtually every field entered or displayed for edit is using these methods. Sadly, the methods have been inconsistently used and we have potential bugs out there.
Presently, these methods are named: IsNull* and IsStringEmpty*. Since I like to talk about Guids, we'll show the examples for that data type.
Since I created this nomenclature, it's always made sense to me; but to others, not so much. What should these methods be called? Here are some of the candidates we've had today: (using Guids for the example)
- GuidFromDatabase & GuidFromScreen
- NullableGuidFromDatabase & NullableGuidFromUserInput
- ConvertDBValueToNullableGuid & ConvertUserInputToNullableGuid
- ConvertDbToNullGuid & ConvertUIToNullGuid
- DbToNullableGuid & UIToNullableGuid
- CallThisFunctionToConvertADatabaseValueToANullableGuidForUseInApplicationCode (facetious of course)
I want something succinct but unambiguous, so I think options 1 and 2 are at the top of my list. What say you?
Since we’re using .NET 1.1, we can’t actually use nullable types or generics.