I’m feeling a little bit old

I’ve never felt like one of the hoary old veteran developers that prattle on about coding on some sort of hardware I’ve never even heard of.  I do feel a little bit old today though.  I just saw a post explaining Hungarian notation written for .Net and Java developers that have never seen it — just in case they ever have to work with a legacy codebase.  Granted, it’s been awhile since I’ve used Hungarian notation personally, but come on!  I’m not that old!  That was *the* way to name variables just a little bit ago!

I do still use underscores to denote a class field, but that’s it.  I know that offends some people, but we all have our individual oddities.  I can’t say that I miss seeing p_strVariable and m_objInstanceOfAClass in my code though.   

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • David Carrillo

    Hungarian notation and Camel are good for clean code for me. That for controls on .NET where the objects inherit properties and you can’t know if the ..Text is for a TextBox, ComboBox or any other control for example

  • http://www.vistadb.net Jason Short

    I admit that I still use hungarian like notion on some things, especially ASP.NET pages. txtSOMETHING.Text may seem redundant to some, but makes sense to me that all my text boxes are sorted together with intellisense.

    And yes I do remember thunking as well (Ahh, Win32s still gives me nightmares). Good read, and yes now I feel old too…

  • The Other Steve

    Ok, in all seriousness. I do tend to use hungarian notation on UI bits, like txtAddress, or ddlState, etc. I use I to preface interfaces, as Paul Hatcher pointed out.

    Where I have the most trouble is in local variables inside methods. What do I call my StreamReader? sr, myReader, objReader? It’s not as though I really care about the name as it’s just used in say two lines… one to open, and the other to read from it.

  • Paul Hatcher

    The weirdest one I remember was looking at some RPG once, it was fixed column layout which meant one word could run into another on occassion, yech!

    I think the IAuthenticationService still makes sense ‘cos then the concrete implementation is AuthenticationService, otherwise you have to think up yet another name, don’t like just separating the names by a namespace.

  • http://www.opgenorth.net Tom Opgenorth

    I remember good old Basic on the Apple ][+, where only the first two characters of a variable name were used. Fun stuff.

    @Ian I suppose that you remember “thunking” too? Fun stuff.

    Of course, there are still some tendrils of Hungarian Notation still floating around that don’t seem to want to die: A lot of developers still preface their interfaces with “I”, as in IAuthenticationService.

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    @The Other Steve,

    Okay Dana Carvey. I remember doing i1, i2, i3, etc. in my Fortran 77 code in college. I remember it taking an hour a piece to debug 50 lines of code.

  • The Other Steve

    Back in my day we used descriptive variable names like i1, i2, i3, ab1, ab2, ab3… And we liked it! None of this weird Hungarian or Camel casing to make the code unreadable.

  • http://www.peterritchie.com/blog Peter Ritchie

    It would have been nice if we had never needed to see Hungarian notation. If it makes you feel better, I remember a time before Hungarian notation….

  • Paul Hatcher

    A long pointer was one that took slightly longer to become corrupted than a short pointer :-)

  • Ian Cooper

    As an additional thought. Do the youngsters know what a long pointer was as opposed to a short one :-)

  • Ian Cooper

    Well I’m older than you but do remember the hideous days of doing Win32 programming when prefixes like lpsz were not uncommon (long pointer to null-terminated string in case you all cared).

    However, I still see it in dynamic languages (frx javascript), where folks often try to indicate the type of a parameter to a method by using Hungarian notation. Its an interesting one because it suggests that folks find some indication of type helpful, which is often lacking from the context when browsing code written wtih dynamic languages.

  • http://www.sullivansoftdev.com/blog Brian Sullivan

    If it makes you feel any better, I’m only 3 years out of school, and we used Hungarian notation when studying Win32 development. We did that before we got to do any .NET programming.

  • http://codebetter.com/blogs/jeremy.miller Jeremy D. Miller

    @Lamar,

    I ditched Hungarian notation for controls quite a while ago under the influence of another developer. I name things either:

    stateComboBox, cityTextbox or just stateField, cityField (habit I picked up from another dev)

    Dropping hungarian notation for your controls makes them easier to find in Intellisense. For the first choice, ReSharper’s suggest naming functionality helps quite a bit.

  • Markk

    I still work with a group of colleagues that programmed in vb6 for years. Thus, even in our current .Net project, they still want to put everything inside forms, and still use hungarian notation.
    It makes me weep!!

    Other weird stuff I see regularly:
    - Functions that dont return anything.
    - Objects everywhere for no reason, instead of strings or integers

  • http://www.planet-xaml.net Florian Krüsch

    variable – is that how you call registers nowadays?

  • mkuczara

    Seems Hungarian notation is alive and kicking. we use slighlty transformed H Notation in our projects –

    ddl for dropd won lists, bt for buttons, etc. It really helps in such ugly functions like .FindControl(“ctrlName”);

  • Marlun

    I name my winform controls like nameTextBox, ageTextBox, etc. It feels good to me.

  • Lamar

    How do you guys name your controls in WinForms and asp.net? That area seems like one of the few place in .Net that some people still use Hungarian notation. Is anyone NOT using hungarian for controls?

  • http://www.vinull.com Michael C. Neel

    I’ve adapted my Hungarian to a more modern .Net dialect. I normally name controls in a Hungarian style, so a textbox might be tbFirstName, ddlState would be a DropDownList, bSave would be a button. Given the code behind of ASP.NET and WPF it really helps when trying to remember the control’s name/id in code. I do find my self doing sbResult for StringBuilder as well ;)

  • http://chadmyers.lostechies.com Chad Myers

    That reminds me of one of the funniest programming web sites I know: ‘How to Write Unmaintainable Code’

    Specifically, the ‘Naming’ section:
    “Hungarian Notation is the tactical nuclear weapon of source code obfuscation techniques; use it! Due to the sheer volume of source code contaminated by this idiom nothing can kill a maintenance engineer faster than a well planned Hungarian Notation attack. The following tips will help you corrupt the original intent of Hungarian Notation:…”