|
Haha, I'm not sure what the bigger WTF is, the fact that you store the user/pass unencrypted in the cookie (thus sending it over the wire every time you request a page) or the blatant SQL injection.
|
# ¿ Apr 8, 2009 20:38 |
|
|
# ¿ Apr 27, 2024 05:22 |
|
pokeyman posted:Ah yes, that ancient coding blasphemy. Death to the not operator! All hail empty code blocks! Allah ackbar! He's using Perl (or Ruby) too, so he doesn't even have to use the not operator - unless will work just as well.
|
# ¿ Apr 9, 2009 18:28 |
|
ehnus posted:Sorry to break it to you but "unless" is redundant as it does the same thing as using if with a negated condition but saves no typing and some (like myself) might even say it does nothing to improve code clarity or comprehension. "If not (whatever) do this" is less clear to you than "unless (whatever) do this"? I mean, one of them is a common English construct.
|
# ¿ Apr 12, 2009 22:05 |
|
From the iPhone dev thread:Unparagoned posted:
|
# ¿ May 1, 2009 22:11 |
|
"handle_pants_event" is the greatest function name ever and I am going to use it all the time now.
|
# ¿ Jun 3, 2009 04:44 |
|
Inverse Icarus posted:
This is the exact opposite of a coding horror.
|
# ¿ Jun 8, 2009 22:53 |
|
meinstein posted:What font are you using?
|
# ¿ Jun 27, 2009 21:13 |
|
ColdPie posted:Hahaha oh man you should've seen my Tetris clone from high school. Let's just say there were local variables named xxxxx and yyyyy. I wish I could find my old IRC library. I created a very bad state machine to parse messages from the server, one byte at a time. One giant while loop with a switch(state) and case 3: if (byte == ':') then state = 4; etc... Oh and I thought I was being "cute" with monty python quotes in the comments.
|
# ¿ Jul 6, 2009 18:13 |
|
I'm reimplementing a tool that fills space. I don't have source for the original tool, but that's what Reflector is for!...code:
ed: I think my favorite part of this is that he knows to use regexes, but seems unaware of how exactly he should be using them. Dessert Rose fucked around with this message at 23:59 on Jul 8, 2009 |
# ¿ Jul 8, 2009 23:54 |
|
Haha, I love their "fail" page. Someone submitted a GA program that evolves hello world.
|
# ¿ Jul 9, 2009 18:37 |
|
Janin posted:that's not the problem here it's recursive in how lovely it is, that's loving amazing
|
# ¿ Jul 21, 2009 06:32 |
|
Goat Bastard posted:It's not quite a for-case though, is it? If refresh(1) is called then the pass == 2 stuff gets skipped, and similar for refresh(2). right, that happens in for-case too, the difference is that here the for loop is accomplished by recursion
|
# ¿ Jul 21, 2009 07:07 |
|
quadreb posted:Genetic TSP? From what he's said in the QuestHelper thread, that would seem to be the case (he talks about how it tends to get "stuck" on somewhat-good solutions when a large change would be better, which is exactly the issue a GA would face, for example) GAs are still magic to me. I want to make a game with GA AIs.
|
# ¿ Jul 31, 2009 05:20 |
|
The comment implies that if they don't do this, it'll be filtered by some other bit of code. Which is sort of a coding horror in itself.
|
# ¿ Aug 29, 2009 23:19 |
|
Well, I notice it says "some web-software", implying that it's not necessarily a default option of PHP (which I wouldn't discount out of hand, since it is PHP) but rather perhaps a package some people have on their servers that causes issues, and this hack is to fix it
|
# ¿ Aug 30, 2009 02:42 |
|
Supervillin posted:I'd just like to see what possible input string could go through those two lines and come out different. What I'm saying is that, while we can all lol about />/i because haha angle brackets don't have a lowercase, the real coding horror here is the security package this bit of code is meant to fix interoperability with.
|
# ¿ Aug 30, 2009 09:26 |
|
Zombywuf posted:I see this practise as a big red warning sign. For sure. All the interviews I've ever been a part of have been a bunch of interviews leading up to the "stuffed suit" who is usually the hiring manager. The only interview I've ever been to where it was JUST the manager was him basically creating a team from scratch.
|
# ¿ Sep 3, 2009 23:07 |
|
ehnus posted:I have no problem with #if 0 ... #endif but it's nearing horror status when it gets checked in. Yeah, checking in commented out code is terrible. You're using source control for that reason, just take it out.
|
# ¿ Sep 11, 2009 05:14 |
|
geetee posted:Maybe setting myself up for embarrassment, but can you explain how people should use revision control systems? Don't check in commented out code because you're half done with it. Check in only code that builds. When you pick up your code tomorrow, use the handy conflict resolution tools that your RCS has! That way, you can see any changes that anyone made to things that your code might have been affected by, and people don't open up a method and go "WTF?" because there's a big block of half-done code in there and they have no idea how to go about modifying the code anymore.
|
# ¿ Sep 12, 2009 01:34 |
|
Lysidas posted:Commented-out code doesn't affect whether the project builds Yes, I'm aware of that. Those were two separate and mutually independent statements; sorry that wasn't very obvious. Checking in commented out code is almost always bad. The problem is that if it stays there for more than about two commits, it's never going to leave, and then you have this problem where the rest of the codebase changes around this block of commented out code, and now it doesn't make any sense at all. I would have an example, but I'm not working at the company where I saw the most heinous example of this. Basically, it was a case of code reuse, where they took a previous project and then modified a few things. As stuff got modified, sometimes people would just comment out the old code, presumably so that one could see what it used to do. But then about five commits down the chain, that old code had nothing to do with what was actually going on anymore, but - surprise! - it was still there, and when I came in to look at the codebase, it made it far harder to understand what was supposed to be going on. I also had a coworker check in an entire file that didn't build for various reasons, but he had the genius idea to effectively comment it out by removing it from the project. That's why I said both of those things together
|
# ¿ Sep 12, 2009 04:32 |
|
royallthefourth posted:Thanks for clearing that up. Are you trying to be sarcastic or something? Because if you are, this thread is about to get way more interesting.
|
# ¿ Sep 19, 2009 05:03 |
|
yeah like that's a lot of php code and in any 20+ line chunk of php there's bound to be at least one horror but honestly using a shell exec command to start a server probably isn't it
|
# ¿ Sep 22, 2009 13:38 |
|
floWenoL posted:Good point. I'm actually not familiar with the state of decompilers for languages like Java/C#. How readable does "reasonable" look? Are variable names preserved? As far as C# goes, if you don't run it through Dotfuscator the thing basically looks like you just removed comments. If you do, then the variable names change to a, b, c, d, etc (so, no change ) or nonprintable characters if you have the full version, but it's still trivial to see your app logic.
|
# ¿ Oct 2, 2009 10:59 |
|
MagneticWombats posted:Couldn't you do something like this works until: code:
|
# ¿ Nov 12, 2009 22:18 |
|
ton1c posted:You know it's funny, a good number of people reading this thread and that reddit thread would probably be guilty of a number of things in this thread. Programming should be more like music, where you compete against yourself rather than bash those who suck, but then nothing would get done. I don't understand. There are musical pieces that everyone, even those who don't know a thing about musical theory, can agree are loving terrible.
|
# ¿ Nov 15, 2009 04:54 |
|
CanSpice posted:And if they change the definition of a radian then it only needs to be changed in two places! no one argued that this was a good reason for doing it but if you can't see why rads = degreesToRadians(degrees); is better in every way than rads = degrees/180*PI; then the coding horror, it's you
|
# ¿ Dec 7, 2009 23:47 |
|
A A 2 3 5 8 K posted:I thought it might be a copy/paste failure but then I thought of how unlikely that would be coming from a PHP enthusiast.
|
# ¿ Dec 30, 2009 03:03 |
|
Ugg boots posted:Whenever I see MUMPS I wonder why people actually write it by hand instead of writing it in another language that gets translated/compiled to MUMPS. I swear that would be one of the first things I tried if I got stuck with lovely language work. How are you going to deal with the corpus of already-existing code?
|
# ¿ Jan 8, 2010 06:54 |
|
Zombywuf posted:Hey, guess what my black box does, only mine does it with human eyeballs not units of soulless energy. he claims his "creates" money, too, which is interesting
|
# ¿ Feb 16, 2010 11:02 |
|
I just inherited a codebase where the previous developer had something of a mid-life crisis and disappeared off the face of the earth when it was "about 90%" done. Not only is it actually probably that close to done, but the code actually looks like it was written by someone who knew what they were doing. I'm sure I will find a giant coding horror in here somewhere to whack me upside the head, but so far the only one has been that he didn't know that static classes can have constructors.
|
# ¿ Feb 19, 2010 06:04 |
|
Milotic posted:Or maybe he realised that static class constructors are the real horror? What's wrong with them? I mean, you can't/shouldn't put any logic in them that depends on the state when they're called, but if all you're doing is making a class with a bunch of constant data in it that can't be constructed through basic initializers, what's wrong with it? The alternative is having some retarded InitializeConstants() call that has to be done in a bunch of different places.
|
# ¿ Feb 21, 2010 00:17 |
|
rjmccall posted:Sure. On the other hand, if you would naturally give the same well-named label to two different loops in a function, it becomes really easy to make tragic mistakes. code:
|
# ¿ Feb 28, 2010 03:15 |
|
Mista _T posted:If the aim is readability, then why not black-box the whole test and only offer up the result? I'm probably digging further than I need to in what probably amounts as something trivial, anyway, so I'll just back down from this one. because at some point you still have to read the rest of the code? What does this "black box" method end up looking like? Saying "well, just put all the code in some other method" doesn't solve anything at all. Okay, so how should I design that one?
|
# ¿ Feb 28, 2010 04:33 |
|
Avenging Dentist posted:Labels are local to functions so this is wholly unnecessary. oh, and he even said "two loops in a function". welp, guess that's reading_comprehension--;
|
# ¿ Mar 1, 2010 00:06 |
|
LockeNess Monster posted:From a recent conversation: Depends. If he's talking about stuff like int i = 2 + MAX_FOO; and MAX_FOO is just defined as 4 or something, then yeah, the compiler does those at least that's what I'd assume he was saying
|
# ¿ Mar 13, 2010 04:08 |
|
Jonnty posted:Oh, don't be pedantic, you know what they meant. well, what DID they mean? because you can get along just fine without arrays as long as you have pointers: code:
n.ed: I'm actually being serious, what do you think that that question means? They didn't ask "what would you do without any language construct that allows you to create a data type containing more than one value", they asked what you would do without arrays.
|
# ¿ Mar 17, 2010 21:52 |
|
LockeNess Monster posted:What is an array? A contiguous buffer in memory that you can treat as a vector of values? What is an array? A miserable pile of values! But enough talk...
|
# ¿ Mar 17, 2010 22:01 |
|
LockeNess Monster posted:I mean, depending on the definition of the array the assignment statement "don't use arrays" would have very different implications. Well, yeah, that's why this discussion is anything but pedantic. "What if you didn't have arrays" is an incredibly vague question.
|
# ¿ Mar 17, 2010 22:05 |
|
I guess I just hate the question because the answer they're expecting is predicated on you not knowing anything but what they've taught you. I hate questions like that because I always try to read more about what I'm doing, etc. and so I always know the "pedantic" answer to the question. It's a legitimate question as written - "What would you do [in this function] if you couldn't/didn't want to use arrays?" because then you can give any of the valid answers that still accomplish the task but don't use arrays. But when you write the question specifically expecting the answer "gently caress WE'RE SCREWED UNLESS THERE'S SOMETHING ELSE YOU HAVEN'T TOLD ME YET" and use vague terminology to boot, well...
|
# ¿ Mar 17, 2010 22:34 |
|
|
# ¿ Apr 27, 2024 05:22 |
|
Nomnom Cookie posted:"Array" is not vague terminology in C, C++, Java, Pascal, or C#. If it's a class in PHP, yeah, you might have a point, but I don't think that was the case. okay, so "use a linked list" is a perfectly valid response to the question, because they didn't specifically disallow that solution
|
# ¿ Mar 18, 2010 02:38 |