Mark said:
The above is another standards document which discourages the use of
Hungarian notation in .NET...
This has always puzzled me... To me, using something like Hungarian
notation which makes my code easier for me to read and understand,
has got to be a good thing.
I've never yet seen a valid rason for not using Hungarian notation in
.NET...
Funny. I feel the exactly the opposite way.
Would be interested in other people's opinions...
Well, HN uses prefixes in an identifier's name depending on the identifier's
type. In a true OO environment featuring polymorphism, the exact type is
quite often unknown (just think of object factories that simply return
interface types). Actually, most of the time you don't even care abut the
real type, as long as the object complies to some sort of interface contract
(by implementing an interface or inheriting from some other class).
Next, there are potentially thousands of types -- which could mean using *a
lot* of prefixes. Oh, and once I need to change a type, I have to rename all
identifiers using that type. Hey, even worse, if it's a "visible" change
like
public int Foo(int someInt)
to
public public long Foo(long someLong),
you would want to change your code as well, if you're using my Foo()
method -- any variable in your code holding Foo's return value will use the
wrong prefix otherwise.
Not to mention all those classic HN prefixes that make no sense in .NET at
all -- l, p, sz, ...
Cheers,