I spent some time this weekend rewriting 8 year old code. It's interesting to compare the pieces where the core logic resides.
Original:
New:
Now I'd like to jump ahead 8 years to see the code rewritten again (and bring it back with me).
Comments
Rob Seder
Sunday, July 4, 2010
Perhaps it will include declaring types again and not use "var". Presumably, the future-versions of us will see the folly of this trend and go back to being explicit, once we realize that "assumptions are the root of all software bugs"!! I'm not picking on you, I'm just saying - I don't agree with this trend... :-)
Chris Airey
Monday, July 5, 2010
Although "var" is not the same as used in dynamic typed languages, eg. JavaScript. I think it really depends on when and where you should use it in C#.
Craig Andera
Monday, July 5, 2010
That's easy: just write it in Clojure. :)
In short, I couldn't agree with Rob less - the code will be *less* statically typed, not more. Especially something like this...
tobi
Monday, July 5, 2010
It seems the two pieces of code are unrelated.
scott
Monday, July 5, 2010
@Rob - I like var, so we'll have to agree to disagree!
@tobi - Right - it's hard to make a 1:1 screen shot. The original solution used a lot more code and never really expresses the essence of the solution, if you know what I mean.
scott
Monday, July 5, 2010
@Chris - right!
@Craig - I think this code would look pretty good in Clojure. Hmm ....
Tuomas Hietanen
Tuesday, July 6, 2010
In 8 years the code will be useless: M$ have already made it for you out-of-the-box. ;)
beyondChairs
Wednesday, July 7, 2010
As far as I can tell, neither of these pieces of code is complete, although the first one looks close. The only reasonable comparison is complete correct code A vs complete correct code B
scott
Wednesday, July 7, 2010
@beyondChairs - That is intentional. If you are looking closely at the code then you are missing the point ... :)
James Curran
Thursday, July 8, 2010
@scott - I think you're missing the (your) point. To say "I used to do this; now I do this" isn't really meaningful unless the two examples do the same thing.
Scott Allen
Thursday, July 8, 2010
@James, @beyond - ok, point taken.
HMC
Wednesday, July 28, 2010
This is the emperors new clothes and utterly pointless, but hey, who am I to upset your ego ?
Comments
In short, I couldn't agree with Rob less - the code will be *less* statically typed, not more. Especially something like this...
@tobi - Right - it's hard to make a 1:1 screen shot. The original solution used a lot more code and never really expresses the essence of the solution, if you know what I mean.
@Craig - I think this code would look pretty good in Clojure. Hmm ....