|
One Night in Paris
Mongo: Mongo only pawn... in game of life.
|
|
|
|
|
"Sharks on the train (Italian rail version)"
(It's what the ticket inspector says when he throws them all out)
|
|
|
|
|
Sharkestration
|
|
|
|
|
|
|
I absolutely despise when people say "oh, I'm using this because it reduces the amount of code I have to type".
F**** me. If you don't like typing, why are you a programmer?
I need a punching bag in my home-office.
Marc
|
|
|
|
|
But isn't that essentially the only reason "we" use anything?
I mean yes, I could write a Deflater from scratch, but I'll use zlib to reduce the amount of code I have to type..
|
|
|
|
|
harold aptroot wrote: I mean yes, I could write a Deflater from scratch, but I'll use zlib to reduce the amount of code I have to type..
Well no actually, it's because someone's written it, tested it, and it's a sh*t load of code to write. But when it's something (think of a C macro, for example) that just obfuscates the code, that's what I mean. See my rant below this one.
Marc
|
|
|
|
|
Same thing I see with Linq/Lambdas ; it's still just the Cult of Fewer Keystrokes .
|
|
|
|
|
Also var everywhere
|
|
|
|
|
Oh, yes, but I include that as part of Linq -- given that it was only added to support Linq's/Lambda's anonymous types.
|
|
|
|
|
I use (our team uses) var, where applicable. Nothing wrong with it, unless you are using notepad to edit your code.
|
|
|
|
|
Are you one of Those People who use var instead of int? If so, why the hell?
|
|
|
|
|
harold aptroot wrote: Are you one of Those People who use var instead of int?
no. I did say "where applicable".
We use var on list returns and some lamda/linq stuff, but not everywhere.
Edit: I have never run into an issue with "var". Visual Studio lets me know what the type is, if I need to know it.
|
|
|
|
|
Ok good.
Slacker007 wrote: "where applicable" Well that's the thing. There's a school of thought that it is applicable any time it is allowed.
|
|
|
|
|
harold aptroot wrote: There's a school of thought that it is applicable any time it is allowed.
I use ReSharper a lot, and it will ask you everytime it can to use implicit type declaration. So, I can see why some devs out there may think that it is good for everything.
However, I have debugged code files that have had "var" all over the place, and it has not been an issue. If for some reason, I cannot tell the type, then hovering over "var" will tell you.
|
|
|
|
|
Try doing a code review in Crucible where someone's abused var and then see how you feel about that.
|
|
|
|
|
Interesting discussion.
I found var a bit difficult to cope with at first as it does hide the actual type. Fortunately many IDEs will, as has been pointed out elsewhere, give you the type if you hover over the 'var '. This, however, doesn't help when dealing with printed/quoted code snippets or when working in an environment that doesn't reveal the type.
So, my definition of 'appropriate' is where the type is obvious (usually because the assignment includes the type as part of a 'new ' or a typecast of some kind) or because the type is so complicated that it obfuscates itself (e.g. nested generics with multiple parameters). In the latter case I either rely on VS for an explanation or, where possible, simplify the type by creating a new wrapper class /struct with XML help to explain what the class is about.
The basic rule is "Think about other people when writing your code." Always ask yourself 'Can this be understood without having to look through reams of code or relying on an IDE to find variable/type definitions?' If not can it be simplified or explained?" If all else fails use a comment to explain (and thereby starts another argument ).
|
|
|
|
|
Couldn't agree more with you. I would also like to add that even if you have Visual Studio it interrupts reading and interpreting the code. Making it harder to understand for someone that is reading the code for the first time.
I blame ReSharper for the fever of using var everywhere. That's the argument of many: "Oh, but Resharper says to use var everywhere".
I wish I knew who at ReSharper dev team decided it was a good thing.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
Fabio Franco wrote: I blame ReSharper for the fever of using var everywhere.
Indeed! That's why I quickly felt pressured into using var . However, as with most things ReSharper, you can turn off the 'hint' in the ReSharper settings if the nagging gets too much and your employer's required coding style doesn't prohibit it.
|
|
|
|
|
Paul Benson wrote: ou can turn off the 'hint' in the ReSharper settings
Yeah, but by that time, ReSharper already damaged the new devs.
To alcohol! The cause of, and solution to, all of life's problems - Homer Simpson
Our heads are round so our thoughts can change direction - Francis Picabia
|
|
|
|
|
No. I will not rely on some IDE to tell me what my code means. Often enough the IDE is too busy showing me hysterical error messages or the parser got lost a little further up in the code and simply is not able to provide any useful information anymore.
Second, especially when I have to work with complex baseclasses, I tend to use some good oldschool printouts of those baseclasses as reference. I tried using intellisense on a printout, but the result always was a classic 'Funny, no response!'.
Third. I don't hover, not even when flying a helicopter.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
Interesting view points.
|
|
|
|
|
Actually I have nothing against hovering with a helicopter. It's just because I gave a friend the nickname 'Hoverfly' because he keeps practicing hovering and did not want to carefully start flying around. Last weekend he did and crashed his helicopter and has been repairing since then.
Now I can't just say that hovering is ok, or he will never try again.
The language is JavaScript. that of Mordor, which I will not utter here
This is Javascript. If you put big wheels and a racing stripe on a golf cart, it's still a f***ing golf cart.
"I don't know, extraterrestrial?"
"You mean like from space?"
"No, from Canada."
If software development were a circus, we would all be the clowns.
|
|
|
|
|
CDP1802 wrote: or the parser got lost a little further up in the code and simply is not able to provide any useful information anymore.
after saying that you really think you are in position to say that var is a problem? you just said you write code that the machine that will compile and run it can't understand.
|
|
|
|