Dare Obasanjo complains about Resharper 4.0's recommendation to use implicitly typed locals (i.e. var someVariable = SomeMethod(); rather than SomeType someVariable = SomeMethod();)
It is a small issue and I would probably wouldn't comment about it except I hear some of the same complaints from members in our team. The main grievance Dare has is that using var impedes the readability of the code. He also says that that people using var will be more inclined to use long "hungarian style" variable names.
Dare also mentions MS recomendation on the use of var which recomends

As for me, I am just happy with anything that get me nearer to true duck typing and the extreme-late-binding it offers.
Dr. Alan Kay (inventor of Smalltalk and one of the fathers of OOP) even says that that extreme late-binding is one of the essential attributes of an Object oriented language:
"(I'm not against types, but I don't know of any type systems that aren't a complete pain, so I still like dynamic typing.)
OOP to me means only messaging, local retention and protection and hiding of state-process, and extreme late-binding of all things. It can be done in Smalltalk and in LISP. There are possibly other systems in which this is possible, but I'm not aware of them."
Yes, the var keyword is still a far cry from duck typing as it doesn't provide the true late binding to the interface needed you get in languages like Python or Ruby. It does however takes one worry from you and helps reduce the overall accidental complexity. var, extension methods and lambda expressions all help make C# more "dynamic" and easier to work with.

I think Ola Bini summed the issue best:
"A statically typed language with type inference will give you some of the same benefits as a good dynamic language, but definitely not all of them. In particular, you get different benefits and a larger degree of flexibility from a dynamic language that can't be achieved in a static language. Neal Ford and others have been talking about the distinction between dynamic and static typing as being incorrect. The real question is between essence and ceremony. Java is a ceremonious language because it needs you to do several dances to the rain gods to declare even the simplest form of method. In an essential language you will say what you need to say, but nothing else. This is one of the reasons dynamic languages and type-inferenced static languages sometimes look quite alike - it's the absence of ceremony that people react to."
Edit As for the code readability claim. I prefer to focus on stronger methods like keeping methods short, meaningful method and variable names and supporting tests (which can actually help you understand how the code behaves...). Not to mention that, if you really really need that, resharper will tell you the type if you put the mouse over the "var" keyword ;) 
 
Comments are closed.