Mismatched parameters cause confusion

October 30, 2012

In the database, the ClosedFlag field can consist of “Y”, “N”, or “I”, which tells us whether an auction is open, closed, or in progress.  Unfortunately, this naming convention made it up through the data access layer and several service tiers, leaving us with the following:

public class Auction
    public bool ClosedFlag { get; set; }

Somewhere along the way, the purpose of this field got confused, and instead of being mapped to an enumerator or something sensible, it ended up as a badly named boolean property which is impossible to decipher.

I’m generally against this type of naming convention, and prefer the self-documenting style of IsSomething, so we could have IsOpen, IsClosed, etc.  In this specific scenario though, there are multiple states and an enum would be more appropriate.  The oddly named naming convention from the database should be restricted to the data access layer, where we’re already converting data to business objects (using AutoMapper), but it seems like it was ignored in this case.


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: