|
floWenoL posted:Because it's an archaic overreaction to spaghetti code. It should be used only when doing so would make the code most clearly understandable. dwazegek posted:the "retVal" variable (it always seems to be named that way) Incoherence fucked around with this message at 01:51 on Mar 22, 2008 |
# ¿ Mar 22, 2008 01:49 |
|
|
# ¿ Apr 29, 2024 19:27 |
|
tef posted:See, where you might use "result" I would use bln_flg_tst_cnd_args_x.
|
# ¿ Mar 22, 2008 02:49 |
|
pokeyman posted:Found this in the PHP manual. It's like the guy knew he wanted some kind of conditional execution, but forgot about the "if" keyword. Okay, that's a pretty good one. I'm surprised that works at all.
|
# ¿ Mar 28, 2008 22:33 |
|
admiraldennis posted:I'm a CS student (actually IS but its very similar here), and our first freshman programming class is taught entirely in scheme. Coursework was fairly demanding and topics included natural recursion (for everything), functional programming, lambda programming, etc. Iterative recursion (for loops, etc) aren't even mentioned until halfway through the second semester, in which Java is used to teach object-oriented design, abstraction, encapsulation, inheritance, polymorphism, and so forth. But... uh... !false definitely qualifies as a Coding Horror. I can at least fathom why someone would write if (true), but not !false.
|
# ¿ May 4, 2008 07:30 |
|
MEAT TREAT posted:
|
# ¿ May 7, 2008 09:45 |
|
wolf_man posted:my thinking is, if your not able to read my code, or at least figure it out, then you shouldnt be looking at it in the first place
|
# ¿ May 8, 2008 19:55 |
|
bcrules82 posted:rather than have an equals method why not just overload operator== ?
|
# ¿ May 16, 2008 05:35 |
|
Entheogen posted:this is kinda lengthy but bear with me.
|
# ¿ Jun 26, 2008 02:26 |
|
Sebbe posted:I think I'll start using roman numerals as names for nested loop variables in the future. The real WTF is, of course, the fact that you're writing a 4-level nested loop, but that's another story.
|
# ¿ Aug 11, 2009 05:07 |
|
Plorkyeran posted:Lines 6921-6934 of a 10458 line function: http://www.unbearably.net/blogfiles/simplecatdps.jpg
|
# ¿ Sep 1, 2009 00:31 |
|
Seth Turtle posted:Using an else-if in this situation is wise. You don't want to match FALSE and TRUE simultaneously. And you've gotta save that ending 'else' for the third option that's sure to come up later on in development.
|
# ¿ Oct 11, 2009 00:35 |
|
Flobbster posted:I'd love it if you could track down what that bug was, because weird compiler bugs have always fascinated me. I would love for someone to explain to me (slowly) just why that happened and why the person who finally figured this out gave me the impression that this behavior wasn't a bug.
|
# ¿ Oct 20, 2009 04:45 |
|
Broken Knees Club posted:I see this as iteration done manually with a ton of ifs. My comment was aimed at the fact that this was manual iteration that could be replaced with a loop. I was not talking about the function of this horrifying code, which doesn't need a loop, but the structure. If you got some other meaning from my posts, then I'm probably a bad poster but I did not backpedal or mean anything other that what I said.
|
# ¿ Nov 9, 2009 20:56 |
|
Scaramouche posted:I found something of my own that's a small h horror but still resulted in head slapping from me. It was a quick little log viewer app that I whipped up in a couple minutes a few years ago:
|
# ¿ Dec 1, 2010 00:17 |
|
HappyHippo posted:In that case why not simply do "if !X, do something"? There's no need to figure out how to invert it if you just wrap it up in brackets and throw a negation on the front. code:
|
# ¿ Dec 1, 2010 18:03 |
|
plushpuffin posted:Hoping this was intentional
|
# ¿ Dec 3, 2010 10:59 |
|
Tux Racer posted:Does blatant plagiarism count? After the second exam, the professor mentioned in class that someone had posted the exam on Rent-A-Coder, and that someone had told him about it. I can sort of see this: someone really desperate to get a good grade, and doesn't expect the professor to be watching those sites for the exam to show up. The professor dithers on the final for awhile after this, but finally decides to make it a take-home exam as well. One day, I check the course webpage and there's a news update: the same username has posted the final on the same site. The next day, another update: some other user has accepted the job. The afternoon the exam was due, though, the other user withdrew, saying it was "unethical". I sort of wonder how much of a hand the professors had in this.
|
# ¿ Dec 13, 2010 20:53 |
|
rt4 posted:Store an integer containing cents; doubles are just big floats.
|
# ¿ Feb 24, 2011 20:04 |
|
Randel Candygram posted:Do you often ship code detailing your meat-vomiting habits?
|
# ¿ Mar 14, 2011 00:31 |
|
BonzoESC posted:. accepts any character, * is a Kleene star closure, your automata theory textbook should cover all this.
|
# ¿ Apr 13, 2011 04:18 |
|
defmacro posted:The formal definitions offer great approximations of how they're used in practice. You learn about what, lazy/greedy matches and backreferences and you're all set? Do you honestly think understanding formal languages will somehow make it harder to learn regular expressions?
|
# ¿ Apr 13, 2011 04:57 |
|
Factor Mystic posted:I have discovered exactly one useful case for an empty exception handler: on Windows when you attempt to launch a process with elevated privileges (such as, relaunching yourself from standard user -> admin with some state parameters) and the user hits cancel, the C# process class throws an exception. But it's very possible you don't want to do anything if they hit cancel. So just swallow. code:
|
# ¿ May 13, 2011 23:14 |
|
Janin posted:from a while back, but:
|
# ¿ May 15, 2011 00:01 |
|
enthe0s posted:I'm only into my 3rd year of programming, but my college teaches us to not use multiple return statements and instead create a single variable at the top and return it at the end. Why exactly, I'm not sure, but I hear it's good form.
|
# ¿ May 19, 2011 09:50 |
|
MEAT TREAT posted:
|
# ¿ May 19, 2011 20:31 |
|
HORATIO HORNBLOWER posted:Likewise, I walked into my "intro to CS" class with years of experience with C, whereas my classmates wouldn't have been able to mash out a "hello, world" program if you put a gun to their heads and a copy of K&R in their hands. This is, I'm convinced, part of the reason why Scheme became so popular for introductory course sequences: odds are good that the hotshots who have been programming since they can walk don't know Scheme, and odds are at least decent that they aren't familiar with functional programming.
|
# ¿ May 20, 2011 03:09 |
|
|
# ¿ Apr 29, 2024 19:27 |
|
OddObserver posted:That people just starting out would have lots of difficulty getting it.
|
# ¿ May 20, 2011 07:43 |