A Call to Arms

January 25, 2010 at 10:07 am (SQL Server 2005, SQL Server 2008, TSQL) (, , )

Phil Factor’s most recent guest editorial over at SQL Server Central has, to a degree, pointed out that the emporer’s spiffy new outfit… well, it’s not exactly there. That’s why he looks so nekkid.

But seriously, the very idea of naming objects inside of the database with Hungarian-style notation really should end. Phil’s right. There’s absolutely no reason why you should name a unique index ixuTableName when UniqueTableName or TableNameUnique would do the job just as well and not be nearly as obscure. I confess to using this type of naming convention all the time, but I’m realizing that I don’t need it and it’s largely just habit.

There are possible exceptions, for instance you want to group all lookup tables in your database so you name them lkTableName, but why not LookupTableName? It’s a little more typing, but with typeahead available, for free, in Management Studio and excellent add-ons like Red Gate’s SQL Prompt, who types out the full name of any of the tables anyway?

I don’t know any developers that are using Hungarian notation in their code these days. Everyone is working with objects and dealing with them like columns in a database table as far as names go (yeah, I know people put Hungarian notation in column names too, but that’s pretty rare). Why keep doing that kind of thing in databases?

Go over, read Phil’s editorial, and the comments about it as well. See if you’re not on board with breaking this bad habit. No more tibbling!

Permalink 3 Comments