<Rant topic='Hungarian'>Damn I get mad about stuff!
Some things get me really fired up. Not your typical high school debating issues (abortion, euthenasia, religion, ho hum?) -- but Hungarian naming standards. Now that's a fiercesome topic! Full of emotion! A political minefield! Oh I've tried to code without Hungarian. I've followed the new standards. But it's a crock! A marketing foible! Getting rid of Hungarian is just a terrible piece of 'Fashion' that will later be looked back on with regret. 'Well we've got .Net now, so we'd better make all of our code look minimalist, clean and non-technical...' 'Everything's an object, you know, like Java, so let's do what sun does' [Rant continues, with comparisons...]
You may feel that for an API (a public API that you are going to foist onto other people) will *look* better if you avoid hungarian. That's kind of true.
But in such a case the details of your API are largely a marketing exercise and have little to do with 'Maintainability.'
But for real code, the guts of your code, the sort of code you write every day and work with every day, nothing can beat Hungarian.
Arguments I've seen against Hungarian
- "Hungarian makes code harder to read. for example: m_dblPrice vs Price."
No, it isn't harder to read, it's more informative and easier to understand.
"Price" alone tells you much much less than "m_dblPrice".
The reader's digest condensed version of "Slaughterhouse 5" is a quicker read too. But that doesn't make it better.
To a seasoned developer, "m_dblPrice" is easier to read than just "Price". Your mind is not distracted by questions like, "hang on, is this the pricing object? or the price parameter? or the local static price variable? or the module level... let me just hover over it, or right click on it and then... oh!" You get the idea.
- "With Intellisense you can find out the type and scope of a variable more easily than previously."
Not as easily as you can with Hungarian, baby!
You can only find out one variable at a time
Without Hungarian, you have to actively seek that information out.
Intellisense doesn't help if the code is printed out, or pasted into an email, or provided on a web page, or being viewed in any other way. (You probably read a lot of code outside of the IDE, just like I do.)
- "It takes longer to write "m_dblPrice" than it does to write 'Price'"
Yes but it's quicker to use and maintain, because you can find it faster.
Roland Weigelt has excellent pictures that demonstrate this.
- "In Hungarian, if you change the type of the variable then you have to change the name. What a mess!"
This is a very good point, and I concede it utterly.
However, in Whidbey, refactoring support promises to be a lot better.
You will be able to rename a variable with ease.
- In Hungarian, if someone puts in the wrong prefix, it will mislead you.
True enough. But FX-Cop can gobble up problems of this sort. You needn't lose any sleep over it.
The main reason I've seen for ditching hungarian is:
"But this is the new way."
Come here and say that! I dare you! You'll feel the stinging wrath of my sarcastic wit! You will be sorry, dunderhead.
</Rant>
Add or view comments about this page
|
Articles
Mind-boggling Demo of New Gaming Genre, aka Folder-Based Hangman, aka Fun with Recursion
Got CSV in your javascript? Use agnes.
I went to write down a book name and founded an internet empire instead.
NimbleText: Origins
The Windows 8 Mullet
Cosby: spontaneous striped background generator
Slides from WDCNZ: Live Coding Asp.net MVC3
MVC 3, "Third Times a Charm" references
Custom Errors in ASP.Net MVC: It couldn't be simpler, right?
Anatomy of a Domain Hijacking, part 2: The Website Who Came In From The Cold
Anatomy of a Domain Hijacking, part 1
secretGeek.net domain has been stolen. The site may go down.
Boring article: 'untrusted domain' issue with SQL Server.
Coding While You Commute
Test Driven Dentistry Is A Good Thing
The 'less crashy' release of NimbleText
Rethinking Toolbars in Visual Studio (or any IDE)
Where shall we have lunch?
Setting up email for your microIsv
The NO Visual Studio movement: Compiling .net projects in Notepad++
ZeroOne: the editor for programmers who think in binary
Mercurial workflow for personal projects (with a .net bias)
I see you're using vim. Let me fix that for you.
The worst recruitment spam I've ever read
A thank you I forgot to say
My new product, NimbleText, is live
Grabbing the free songs of Jonathan Coulton (with Powershell)
Using NimbleSet to compare lists
Wanted: Wiki Lists (dot org)
DOS on Dope: The last MVC web framework you'll ever need
JSON Query Languages: 5 special purpose editors
What then, is b?
SQLike: A simple editor
Yet Another BizPlan Generator.
HOT GUIDS: A hot or not site for guids
How does life get better? One tiny hack at a time.
24 things to do, and 100 things *not* to do (yet) for building a MicroISV
Venture capital won't kill Jeff Atwood, it will only make him Jeffer.
A handy workflow image for newbie mercurial users
Fractal Feedback, a diversion into recreational programming
Hump-Jumping: How the Education of Computer Science can be Saved, err, maybe.
Suggested User Experience Improvements for DiffMerge
SQL Style Extensions for C#
The Movie Hollywood (And My Wife) Doesn't Want You To See: Weekend at Jacko's
Sysi: the ultimate administrators toolkit
.: secretGeek :: Complete Archives
TimeSnapper.com
Version 3.3: true productivity boost
NextAction Managing the top of your mind
NimbleText -- World's Simplest Code Generator, Text Manipulator, Data Extractor
25 steps for building a Micro-ISV
3 Minute Guide Series
Universal Troubleshooting Checklist
Top 10 SecretGeek articles
ShinyPower Now at CodePlex
RealTime Online CSS Editor
Gradient Maker
How to be depressed
You are not inadequate.
Recommended Reading
 the little schemer
The Best Software Writing I
The Business Of Software (Eric Sink)
Recommended blogs
Jeff Atwood
Joseph Cooney
Phil Haack
Scott Hanselman
Julia Lerman
Rhys Parry
Joel Pobar
Thomas White
OJ Reeves
Eric Sink
Aggregated Links
proggit
dzone
hacker news
dot net kicks
Human Link Machines
interesting finds
a continuous learner's weblog
arjan's world
weekly link post
LogEnvy - event logs made sexy
Computer, Unlocked. A rapid computer customization resource
PC Smart Buys - Computer Hardware in Australia
|