3 ms·
I'm mega curious about this > ...like lpszFileName (lpsz = long pointer to a zero terminated string) I remember those. AIUI hungarian gives you some kind of
by tempguy9999 7y ago
I'm mega curious about this
> ...like lpszFileName (lpsz = long pointer to a zero terminated string)
I remember those.
AIUI hungarian gives you some kind of typing. The typing is done by humans using the names. The humans have to get it right; they are the typecheckers.
The first thing I'd do is offload the typechecking onto an automatic framework - the idea of letting people do a computer's job is madness. It would not have been too hard to do (relatively very cheap for a large codebase like an OS), I think, and would have allowed the hungarian prefixes to be dropped because they'd become redundant, and strengthened and speeded up typechecking. So where is the flaw in my thinking?
(aside: one of my first contract jobs was working in pascal (delphi actually). The company I worked for had coding standards cos you need standards, don't you. It was to prefix every integer with i_, every float with f_, every int array with ai_, et cetera. As pascal was strongly typed this was totally pointless).
- tempguy9999 7y agoWould whoever downvoted this please explain why. I laid out my thoughts for critiquing by others, but learn nothing unless I'm told why it's wrong.
- inlined 7y agoI’ll save you with an upvote. Hungarian notation also helps avoid collisions that lead to confusingly similar names: pArray (array pointer) ecArray (element count of array) bcArray (byte count of the full array)
- MagnumOpus 7y ago> So where is the flaw in my thinking The codebase has 34 years worth of code written already, 100 million LOC or more if you count Office, VS etc. The cost of typechecking is trivial but the cost of rewriting this much code to be consistent with any new convention is in the hundreds of millions of dollars. This legacy cost then of course becomes higher every year...
- inlined 7y agoI’ll do it for only 50 million dollars. Remove it with repeated regexes like s/^wec//g (remove all word prefixes for element counts). Of course, you’ll need another convention for all the collisions that Hungarian notation fixes like IFoo (Foo’s test fake-able interface) and CFoo (the concrete class)
- tempguy9999 7y agoOh hell. Where did I say anything about it having to be rewritten? I did not. I said "allowed the hungarian prefixes to be dropped", not required. And all I meant was "in subsequent work", of course changing existing code would be idiotic. And this absolutely misses the vital point that typechecking can be offloaded from the human to an automated typechecker, so why wasn't it? "The cost of typechecking is trivial" - not if it's done by humans.
- andreareina 7y agoAccording to Joel[1] it was originally about distinguishing variables that had the same type but had different semantics, e.g. a window's width (dx) vs its horizontal position (x). Both ints, but not really the same kind of data. [1] https://www.joelonsoftware.com/2005/05/11/making-wrong-code-look-wrong/ https://www.joelonsoftware.com/2005/05/11/making-wrong-code-...