|
code:
|
# ? Sep 9, 2011 18:29 |
|
|
# ? Apr 27, 2024 06:43 |
|
Plorkyeran posted:
Take a drink every time you see a for-switch in this thread.
|
# ? Sep 9, 2011 19:08 |
|
This is mild for the thread but I need to vent since the person who wrote this left the company right before shipping and left me to take over their systems... How do you know when you need to refactor someone's code? When a 300 line function ends with: code:
|
# ? Sep 9, 2011 21:58 |
|
^^Holy crap! This cracked me up: function xhtml_foot() { ?> </body> </html> <? }
|
# ? Sep 9, 2011 23:09 |
|
revmoo posted:function xhtml_foot() What possible reason is there for this to be valid
|
# ? Sep 9, 2011 23:30 |
|
EDIT: Nevermind, I see the differences now. I'm the coding horror.
|
# ? Sep 10, 2011 00:09 |
|
Plorkyeran posted:17 lines to avoid duplicating a trivial line of code three times. Shouldn't this just be code:
|
# ? Sep 10, 2011 00:22 |
|
Yeah, the coding horror is that they didn't figure out whether to use MaxPoint or MinPoint by examining i/2 and i % 2
|
# ? Sep 10, 2011 00:25 |
|
Hughlander posted:This is mild for the thread but I need to vent since the person who wrote this left the company right before shipping and left me to take over their systems... I think I might have found some other ways to tell. I just inherited some more VB6 code today. This one class is 2700 lines long, and starts with seventeen arrays of Variants. All the variables in this app are named using Hungarian notation. The names of these public variables suggests that they are module level. They are in fact public, and used by dozens of totally unrelated modules. Blue Footed Booby fucked around with this message at 04:00 on Sep 10, 2011 |
# ? Sep 10, 2011 01:36 |
|
code:
|
# ? Sep 10, 2011 18:02 |
kalleth posted:
That's not that bad.
|
|
# ? Sep 10, 2011 21:44 |
|
A MIRACLE posted:That's not that bad. Ruby gives you loads of rope to do fancy poo poo with metaprogramming. When I start seeing myself write stuff like "string".singularize.classify.constantize.send("another_string") I realise that I'm probably using that rope to hang myself, and should probably stop
|
# ? Sep 10, 2011 21:58 |
|
kalleth posted:Ruby gives you loads of rope to do fancy poo poo with metaprogramming. When I start seeing myself write stuff like "string".singularize.classify.constantize.send("another_string") I realise that I'm probably using that rope to hang myself, and should probably stop I've never even so much as looked at Ruby before but I looked up what that does and wow: quote:Constantize tries to find a declared constant with the name specified in the string. It raises a NameError when the name is not in CamelCase or is not initialized. quote:classify(table_name) quote:singularize(word) I'm going to have to look into this Ruby thing in the future, I've been looking at c++ COM objects too long to wrap my mind around this stuff.
|
# ? Sep 10, 2011 23:45 |
|
Most of those methods only come from the ActiveSupport library, not the standard Ruby library. You can do it with standard Ruby, those methods just make it easier for you.
|
# ? Sep 11, 2011 03:46 |
|
That's a really cool language feature, actually! I have thought that something like that would be neat in the past, but I didn't know this existed.
|
# ? Sep 11, 2011 04:54 |
|
kalleth posted:
At least move it to the model so you can unit test it.
|
# ? Sep 11, 2011 06:24 |
|
My own idiocy that cost me 10 minutes of confusion:code:
|
# ? Sep 11, 2011 15:03 |
|
This one wasn't me, but one of the indian developers:code:
|
# ? Sep 11, 2011 16:05 |
|
kalleth posted:$3 per hour gets you software developers, guys, remember that I have one experience with the cheap kind of developer, and I will never fear offshoring again.
|
# ? Sep 11, 2011 18:16 |
|
lord funk posted:My own idiocy that cost me 10 minutes of confusion: is it because you forgot to do this? [array0 removeAllObjects] I'd do that and then wonder why my loop only ran once.
|
# ? Sep 11, 2011 18:59 |
|
code:
|
# ? Sep 11, 2011 23:47 |
|
code:
|
# ? Sep 11, 2011 23:56 |
|
Hughlander posted:This is mild for the thread but I need to vent since the person who wrote this left the company right before shipping and left me to take over their systems... I had a professor in college that would end his Java programs like this: code:
|
# ? Sep 12, 2011 00:16 |
|
Hughlander posted:This is mild for the thread but I need to vent since the person who wrote this left the company right before shipping and left me to take over their systems... Why's this so awful?
|
# ? Sep 12, 2011 00:22 |
|
HardDisk posted:Why's this so awful? It means lotso nested ifs and loops.
|
# ? Sep 12, 2011 00:30 |
|
HardDisk posted:Why's this so awful? How are you supposed to keep track of all that indentation? It's also a 300 line function, which is 200 lines longer than fits on my screen. Something that big could probably be turned into 30 (or fewer) ten-line functions.
|
# ? Sep 12, 2011 01:25 |
|
YardKGnome posted:I had a professor in college that would end his Java programs like this: Did he come from Lisp?
|
# ? Sep 12, 2011 01:26 |
|
GrumpyDoctor posted:Did he come from Lisp? It looks like he taught Lisp back in the 80s, so there ya go!
|
# ? Sep 12, 2011 02:21 |
|
HardDisk posted:Why's this so awful? There is trailing whitespace after one of the }s.
|
# ? Sep 12, 2011 13:02 |
|
Lumpy posted:is it because you forgot to do this? It was because of the // other crap part. It wasn't the only array under the knife, and I have to fire off messages about the removal of some of those objects. I figured if I had to iterate anyway, why not just dump it. Derp indeed.
|
# ? Sep 12, 2011 13:38 |
|
I know I seriously don't belong here, but I figure why not. I know it isn't code (pseudocode), but I think it's definitely some sort of horror. I'm in Comp Sci 101 and the assignment was "write a code with a bug in it and describe how you would fix the bug." This was posted by another student on the message board for the class. code:
|
# ? Sep 12, 2011 14:00 |
|
Save Russian Jews posted:I still don't know what to make of "blue*yellow doesn't make sense, it should be blue+yellow." I just... This, folks, is why friends don't let friends learn pseudocode.
|
# ? Sep 12, 2011 14:19 |
|
Seriously though, coming up with good examples to demonstrate language constructs and programming techniques is something which stumps me more often than not. It's like when you go up to test a microphone and somebody says "Say something" and suddenly you forget how to talk. "Fix the bug in this code" is frequently easier than "introduce a deliberate bug into this code" just because I have more experience with the former.
|
# ? Sep 12, 2011 15:28 |
|
I have a lot of experience introducing bugs into code
|
# ? Sep 12, 2011 15:36 |
|
thelightguy posted:I... just... why Has the author of this code never heard of implode()? Not to mention, using "yes" instead of a boolean. At the place I used to work they used "good" or "verified" or "success" as comparisons instead of true/false. The author of that code was the CTO who had supposedly been with the company for ten years. I don't know what it is about people but it often seems like they cannot grasp the concept of booleans. Then again, the CTO was the kind of guy who would check if an error message was returned from a function and then disregard it in favor of saying "An error occurred" (with no other information anywhere, not even logs), so I guess it's not really surprising. quote:
It's vaguely useful as a way to embed strings without having to escape everything, but considering that php has "theredoc" () now it should hopefully be obsoleted soon. I find it useful when doing small things on rare occasions, though.
|
# ? Sep 12, 2011 16:51 |
|
Hammerite posted:There is trailing whitespace after one of the }s. I'm actually glad someone noticed that, I left it in as a spergin present...
|
# ? Sep 13, 2011 03:24 |
|
Object oriented programming!code:
|
# ? Sep 13, 2011 07:33 |
|
Wheany posted:Object oriented programming! "No subclassing in Javascript? Oh well "
|
# ? Sep 13, 2011 13:43 |
|
I don't do much coding since leaving my CS degree, but in my job I have the opportunity to put out some Excel Macros. It also means I am the fixit guy for Excel Macros made by our company head.code:
Rows_actual is a pretty sweet constant he determines as being the upper bound for any iteration of this spreadsheet in the future. Five years later and I have to fix it because the spreadsheet has gotten bigger than his imagination could have fathomed at the time of committing this to a VBA module.
|
# ? Sep 13, 2011 17:33 |
|
|
# ? Apr 27, 2024 06:43 |
|
Hughlander posted:This is mild for the thread but I need to vent since the person who wrote this left the company right before shipping and left me to take over their systems... I see your bid and raise you! code:
|
# ? Sep 13, 2011 20:48 |