I myself write 1000 line functions?
Perhaps you need to read my post more carefully - it intimates other peoples code. In some cases (although its C or VB, not C#), the code is over 10 years old. But I guess you don't understand that some companies keep support for their software open for several years (ours is 7). A good example is Windows XP - that is now 10 years old and still has coders bolting on fixes.
You also assume that where I work, I haven't imposed some coding standards. Again, this is wrong. I could go into details, but given your consistent hostility it probably isn't worth it.
Quirkafleeg, given that you come from a company without coding conventions (why didn't you yourself create some?) and you write functions of 1000 lines, I think you are absolutely not qualified to talk about such topics in the first place.
Go and read some books of Robert C. Martin or Code Complete for example and admit to failure.
I agree that var is not a problem, by another reason:
In one line it can be: var data = GetData().
Of what type is data? I don't know.
But at another place, I can simple see data.DoSomething(). I don't have the declaration there to look for the type, so what's data.DoSomething???
For me, replacing var by the real type will only solve my problem if I am near the declaration of "data". But having a more meaningful name will solve the problem everywhere I see the new name for "data". So, better variable names are better.
And, if we think about lazy programmers... well, they do a lot of "bad practices", be it with var or not.
sergueis63, I work all the time on such projects. And I prefer the var keyword. Maintenance difficulties due to the var keyword may be a symptom, but not the cause of the problem. When the var keyword is your problem, your code is probably messy in the first place.
"The idea of scanning through a 1000 line function filled with var is abhorrent. Notice the word "scanning""
This is what I mean. You've got other troubles than the var keyword when your functions are 1000 lines long.
Man... you still don't get it. The point is that you can't change those 1000-line functions into a well-structured/designed code. Usually you have neither time/money, nor permission to do that. The only thing you are authorised to do is to fix a bug or add few new lines to extend functionality. That's it! And given this is your reality, overusing of var makes your already miserable life (as a bugfixer of someone's else code) even worse.
Dave, you are completely off track. The point is the code _maintenance_ is more complex and time consuming wiht var overusing. Maintenance means bug fixing, refactoring, small changes of class implementation, etc. It has absolutely nothing to do with "code against abstractions". Looks like you've never worked on a serious large-scale business project.
Reason for my vote of 1
I completely disagree. The var keyword enhances the readability of code. Programmers should code against abstractions and interfaces anyway, thus a type becomes code-noise/code-smell, especially when coding against concrete classes. The var keyword eliminates this noise when the variable is properly named.
Last Visit: 31-Dec-99 18:00 Last Update: 12-Oct-24 2:22