Dilbert 5/4/2004

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:

  1. Take a database value (object) and return a value of the desired type, using a magic value to represent null
  2. 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.

   1: Dim StudentId As Guid = IsNullGuid(drStudent("StudentId"))
   2:  
   3: ...
   4:  
   5: Dim StudentId As Guid = IsStringEmptyGuid(ddlStudent.SelectedValue)


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)

  1. GuidFromDatabase & GuidFromScreen
  2. NullableGuidFromDatabase & NullableGuidFromUserInput
  3. ConvertDBValueToNullableGuid & ConvertUserInputToNullableGuid
  4. ConvertDbToNullGuid & ConvertUIToNullGuid
  5. DbToNullableGuid & UIToNullableGuid
  6. 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.