There are any number of naming conventions and coding standards. Each have their values and issues. This is the pattern I created but as it is important to stay flexable and learn new patterns as new ideas come along.

I started developing software with MS Visual Basic 2.0, back in 1993. So my naming conventions came from the Hungarian notation. However a few years later I found that this convention was not quite right for me. It was with the release of VB 4.0 in 1995 that I developed the "Rose Variant" on the Hungarian form. Not much changed. However I believe I made it easier to recognize the objects by this new convention. You see human beings are primarily visual creatures and we can interpret information visually much quicker than we can read. (Yes I understand that reading is a visual medium as well)

The Rose Variation is simply:

  • Variables have a single character lower case prefix.
  • Database objects have a two character lower case prefix.
  • All other objects have a three character lower case prefix.
  • Module level variable have a lower case "m" prior to the object prefix
  • Global level variables have a lower case "g" prior to the object prefix. Note: Do not do this as it is a bad pattern to expose a variable to the entire project.

Recently I posted on several tech and development sites asking about naming conventions and if they still have a value. Because I have been using these conventions for over a decade I wanted to insure that I was not holding on to old patterns just because that is the way I have been doing so for the past years. Software development is a relatively new profession and I believe that it is important to keep up on new processes and well as new technologies. After a week of reviewing the various conversations I came away with the thought that there is still a strong value for naming standards. My variant is not the absolute answer, just one idea. What I do strongly suggest is that you find a pattern that works for you and stick with it. Over time you and other developer that have to work with your code with appreciate the consistency.

There were some who spoke that naming conventions are no longer necessary with the current abilities of IDEs. Most allow you to mouse over the object to get the details including data type and the current value. However I felt that this method of thought missed out on why I developed the Rose Variant in the first place. The ability to scan a page of code and instantly know what type of object you are looking at has been a great help for me.

For example: What is this object "UserValue" (yes it is a bad name) Is this a string or a numeric or even a full object? (yes, I know that in .NET all items are objects, let's not get picky here.) But if it was labeled as "iUserValue" or "sUserValue" then you could know instantly that it is a integer or a string.

There is, of course, some issues with the Rose Variant in that some objects will have the same prefix. eg: Single, Short and String, or Date, Decimal and Double. While I will agree that this is not perfect, I have used this pattern for over a decade and it has served me well.

Here is a listing of the differences between the two conventions. This list is not complete, and I welcome any thoughts on this pattern.

Variables:

ObjectHungarian PrefixRose Prefix
Booleanblnb
Bytebytb
Charchrc
Datedatd
Decimaldecd
Doubledbld
Integerinti
Longlngl
Shortsrts
Singlesngs
Stringstrs

Database Objects:

ObjectHungarian PrefixRose Prefix
Fieldfldfd
Indexidxdx
Queryqryqy
Tabletbltb
Recordsetrecrs
Connectionconcn
Commandcomcm
DataSetdstds
DataReaderdardr
DataAdapterdapad

These objects are the same for the Rose convention as the Hungarian standards.
Controls and Objects

ObjectHungarian and Rose Prefix
Formfrm
Check boxchk
Combo boxcbo
Command buttoncmd
Dialogdlg
Gridgrd
Imageimg
Labellbl
List Boxlst
Menumnu
Option Buttonopt
Picture Boxpic
Scroll Barscr
Text Boxtxt
Timertmr