Do you ever look at code you wrote years (even months) ago and think, "Fuck me, this is shit"?
Is there a threshold age where anything older than that is guaranteed to suck, or is there a cutoff date after which code is generally up to your current standards?
A threshold age would indicate that you are still learning; any cutoff date will probably be when you finished (and fully understood all the concepts of) SICP.
Name:
Anonymous2010-04-07 18:04
any cutoff date will probably be when you finished
You can't finish learning, think about what it means that you stop regarding your past self as shit then.
Name:
Anonymous2010-04-07 18:09
I have a few fundamental rules for determining whether or not my code is shit:
1. Am I writing it now?
If so, it is incomplete and therefore shit
2. Did I write it sometime in the past?
It's shit.
No seriously, I was going to point out that they weren't typical /prog/ asshattery, but I figured that would go without saying. Of course it doesn't, I'm a fool.
More like the opposite. I think I've lost the determination to write huge, complex sequences of code now.
Name:
Anonymous2010-04-07 20:50
When I was doing my projects in C or C++, I often returned to the code I wrote and asked myself, "what was I thinking". Ever since I've found Haskell and started working with it, I don't have this same problem any more. It's really liberated my mind!
Name:
Anonymous2010-04-07 21:08
>>14
Using Haskel is no excuse for not going back to review your old code.
Name:
Anonymous2010-04-07 21:25
This happened to me, but after one day. Wrote some code that was way too complicated 150ish lines in 3 hours, The next day I was like "What the fuck is this shit, why don;t I just do it like this..." wrote 40lines in 30 minutes that did the same thing
>>16
I always do a rewrite. The trick is to start the rewrite before finishing the first one, and soon enough to complete it before the first one would have been finished.
Name:
Anonymous2010-04-07 22:22
sometimes ive come back to code, and thought the fuck is this inefficiency, started editting it, then re-realized a problem with that thinking, and then realized why i had done in that way in the first place
>>19
Are you suggesting that >>18-1ZOMG OPTIMIZED are actually the same person?
Name:
Anonymous2010-04-07 23:16
It sounds like you guys would be interested in something called FizzBuzz. Google it. Post results. I wrote a FizzBuzz program and I was able to shorten it quite a bit after I finished writing it.
Name:
Anonymous2010-04-08 1:44
#include <stdio.h>
int
main(){
int mult = 0;
for (mult = 1; mult <= 100; mult++){
if (mult % 5 == 0){
if (mult % 3 == 0){
puts("FizzBuzz");
} else {
puts("Buzz");
}
} else if (mult % 3 == 0){
puts("Fizz");
} else {
printf("%d\n", mult);
}
} return 0;
}
Oh yeah! Faster than most compscigraduates ... Beat by an underage b&!