I disagree. I mostly use it for long namespaces. My current project likes to name things like so:
When newing up objects of that type via a factory method or even via new constructor its good to not have to figure out what long winded namespace they live in. Knowing it really adds nothing to the programming experience.
And why not use var in those cases? Its a convienence.
Yes you are right, that is your
but think of the person who will read your code in 3 years time.
" its good to not have to figure out what long winded namespace they live in"
This epitomises why using var
as little as possible is a good thing. As a developer you are tasked with creating libraries, for the really long ones the
keyword greatly simplifies things. It is so important that someone looking at your code can anticipate why x works with y, and your "convenience" makes things that much harder. A good program should read like a book, without resorting to
If you read a historic book, lets say "War and Peace" by Leo Tolstoy, you have the annotation at the bottom saying, the political environment was like this, and the
were about to launch a revolt. This is all relevant
. With your method, it means having to resort to intellisense and it makes for a stuttered way of deducing the code that's written and that much harder.
This, as they say on the internets, is "My 2 Cents".