|
jarito posted:Or just use a higher level construct like a List, Hash or Set. You can go too far that way, though. I found this in a codebase I inherited: code:
Also, this object gets reused, and here's the method that gets called when that happens (and when it first gets set up, too) code:
I love broken code that looks like it works, but has enormous design flaws. I have spent the last two days of work on this project refactoring all the code surrounding this area. And of course THIS part of the code has absolutely no unit tests whatsoever. Oh, and all the code is broken in subtle ways that are instantly apparent when I write the tests.
|
# ? Mar 29, 2010 20:59 |
|
|
# ? May 14, 2024 13:42 |
|
The person that wrote this has been fired, sure, but that's meager consolation when I stumble across all the droppings he left. This was buried under a few levels of indentation, in the middle of a giant switch, in a 900 line function. I've preserved the formatting also for your enjoyment.code:
BigRedDot fucked around with this message at 00:33 on Mar 30, 2010 |
# ? Mar 29, 2010 21:40 |
|
code:
|
# ? Mar 29, 2010 22:36 |
|
That fwrite call is amazing.
|
# ? Mar 29, 2010 23:13 |
|
I just wrote the programming equivalent of the "Buffalo buffalo buffalo" sentence:code:
|
# ? Mar 30, 2010 18:53 |
|
Ooh! I get to contribute! Came across this the other day while looking at a jsp that extracts the app version from pom.xml... it's always the first version node... code:
code:
deedee megadoodoo fucked around with this message at 19:28 on Mar 30, 2010 |
# ? Mar 30, 2010 19:26 |
|
Lexical Unit posted:
star on the left? thats teh real coding horror
|
# ? Mar 30, 2010 20:22 |
|
Speaking of bad student code I remembered a real horror in Java from a ways back. It was for an app that had to read from a large database. Pretty simple, make a data storage object, get the cursor, do a for every and drop it into a generic list right? Nope. For every column in the database they had an array. Its not like they didn't know about generics, there was one or two instances where a column had multiple values and ergo a LinkedList<String> but I swear the next time I see 40-50 sets of int[]s I'm going to drink until I don't remember it. Oh and yes, each row in the database was a column in each array
|
# ? Mar 30, 2010 20:36 |
|
Flobbster posted:I just wrote the programming equivalent of the "Buffalo buffalo buffalo" sentence: This is wonderful.
|
# ? Mar 30, 2010 20:51 |
|
Flobbster posted:I just wrote the programming equivalent of the "Buffalo buffalo buffalo" sentence: Code is Art.
|
# ? Mar 30, 2010 21:50 |
|
More irredeemable code today (approximated):code:
code:
BTW if you are a US citizen your tax dollars paid for this.
|
# ? Mar 31, 2010 20:40 |
|
BigRedDot posted:More irredeemable code today (approximated): Wouldn't surprise me in the least. Fortunately, I know corporations do no better. I've just got finished cleaning up some javascript where the same 12 lines were posted 9 times in the same file.
|
# ? Mar 31, 2010 20:49 |
|
dwazegek posted:I'm partial to the almost always applicable "result" Dijkstracula posted:God drat, that's one smarmy article. Shumagorath fucked around with this message at 02:58 on Apr 2, 2010 |
# ? Apr 2, 2010 01:38 |
|
Hey I've got an idea, let's make our urls seo friendly! OOh what a good idea! But wait, we didn't use the link function for all our href's and I don't wanna go back and edit my poo poo spaghetti code! No I got this, see if we capture all the output and then push it through this: code:
Sounds good to me! I'd hate to have to fix my poo poo! ...Later... WHAT THE gently caress WHY IS THIS THING NOT REWRITING MY FORM ACTION URLS. *looks at seo code* you motherfuckers
|
# ? Apr 3, 2010 19:56 |
|
I always read all the 'preg' functions in PHP as 'pregnant'.
|
# ? Apr 5, 2010 21:47 |
|
Kidane posted:I always read all the 'preg' functions in PHP as 'pregnant'. I've barely used PHP and always find that funny. What does it actually stand for?
|
# ? Apr 5, 2010 22:06 |
|
Perl-compatible regular expressions.
|
# ? Apr 5, 2010 22:22 |
|
I thought it was Posix REGular expressions, and pcre was the perl ones.
|
# ? Apr 6, 2010 20:41 |
|
bitreaper posted:I thought it was Posix REGular expressions, and pcre was the perl ones. Nope, ereg() was the Posix regular expression function and preg_* are the PCRE methods. Of course, you shouldn't be using ereg() or any of the variants.
|
# ? Apr 6, 2010 20:50 |
|
pseudorandom name posted:The deadlock detection probably isn't smart enough to deal with the ordering. Talk about a late reply. I don't come to the forums that often. It's not an OS. It's RDBMS kernel code that I've obfuscated to protect the guilty. and no,the deadlock detector should be sufficient to catch any true deadlock (i.e. multiple processes blocking with a cycle in the 'waits for' graph); that loop would only make sense if it would be possible for the deadlock detector to give false positives due to ordering issues, which I believe it can't. Meganiuma fucked around with this message at 18:13 on Apr 7, 2010 |
# ? Apr 7, 2010 18:03 |
|
quote:@mtabini: Once you learn how powerful arrays in PHP are, you realize that every other language must, in a sense, be kidding. I must be unenlightened because http://us2.php.net/manual/en/ref.array.php makes me want to throw up.
|
# ? Apr 8, 2010 07:21 |
|
A A 2 3 5 8 K posted:I must be unenlightened because http://us2.php.net/manual/en/ref.array.php makes me want to throw up.
|
# ? Apr 8, 2010 08:09 |
|
PHP arrays: because every other data structure in the standard library is even worse.
|
# ? Apr 8, 2010 11:15 |
|
php.net - next() posted:Returns the array value in the next place that's pointed to by the internal array pointer, or FALSE if there are no more elements. Oh, PHP.
|
# ? Apr 8, 2010 12:00 |
|
Internet Janitor posted:Oh, PHP. What if the next element in the array is FALSE?
|
# ? Apr 8, 2010 15:56 |
|
Internet Janitor posted:Oh, PHP. What if the next element in the array is the boolean value FALSE? Edit: Athas fucked around with this message at 16:03 on Apr 8, 2010 |
# ? Apr 8, 2010 16:01 |
|
Scaevolus posted:PHP arrays: because every other data structure in the standard library is even worse. Does PHP's core or standard library have any other data structures besides its array/hash mashups?
|
# ? Apr 8, 2010 18:24 |
|
Otto Skorzeny posted:Does PHP's core or standard library have any other data structures besides its array/hash mashups? Depends how you define "standard library" do you mean the unholy mess of everything they just threw in the global namespace, or the *actual* SPL. I think the SPL has some more datastructures, they probably suck though.
|
# ? Apr 8, 2010 18:30 |
|
Otto Skorzeny posted:Does PHP's core or standard library have any other data structures besides its array/hash mashups? yes: doubly linked lists, stacks, queues, heaps, nax/min heaps, priority queues and fixed arrays. I've never really seen them used though.
|
# ? Apr 8, 2010 18:33 |
|
And let's not forget the myriad of frameworks that create their own versions of certain datatypes.
|
# ? Apr 8, 2010 19:15 |
|
markerstore posted:What if the next element in the array is FALSE? Then the function throws a EverytingIsFine exception, which evaluates to FALSE.
|
# ? Apr 8, 2010 20:56 |
|
markerstore posted:What if the next element in the array is FALSE? the horror posted:Note: You won't be able to distinguish the end of an array from a boolean FALSE element. To properly traverse an array which may contain FALSE elements, see the each() function.
|
# ? Apr 8, 2010 21:20 |
|
I started a new job a few months ago. My main responsibility is maintaining a nine year old application that has had probably half a dozen mostly unsupervised developers work on it in the past, so its a giant mess. One dev would have so many nested ifs that she would block quote her ends like she was leaving herself breadcrumbs. So not only is the code littered in {x}s, but it does a fantastic job of screwing up the process of commenting things out. Thankfully, the code is also good for a laugh every now and then. code:
code:
|
# ? Apr 8, 2010 21:32 |
|
A A 2 3 5 8 K posted:I must be unenlightened because http://us2.php.net/manual/en/ref.array.php makes me want to throw up. That's pretty funny because the last time I had to do something semi-complicated with PHP arrays I pretty much had to implement a sorting function using the usort function listed there. :php:
|
# ? Apr 8, 2010 22:49 |
|
Arms_Akimbo posted:So not only is the code littered in {x}s, but it does a fantastic job of screwing up the process of commenting things out. quote:
|
# ? Apr 9, 2010 01:06 |
|
This is what happens when you tell a bunch of Windows developers to write a Linux application:code:
|
# ? Apr 9, 2010 19:07 |
|
Janin posted:This is what happens when you tell a bunch of Windows developers to write a Linux application:
|
# ? Apr 9, 2010 19:14 |
|
Shumagorath posted:Developing for Windows destroys their ability to read APIs and/or understand how a filesystem works? Am I missing something about NTFS? They wrap every "cryptic" function with a "properly named" one, usually without bothering to figure out the exact behavior of the function being wrapped: unlink -> TryToRemoveFile rand -> GenerateRandomNumber, GenerateRandomNumberEx stat -> ReadFileInfo, ReadFileInfoW etc
|
# ? Apr 9, 2010 23:03 |
|
Janin posted:They wrap every "cryptic" function with a "properly named" one, usually without bothering to figure out the exact behavior of the function being wrapped: haha, they seriously try to emulate the *Ex naming style from Win32?
|
# ? Apr 9, 2010 23:07 |
|
|
# ? May 14, 2024 13:42 |
|
code:
|
# ? Apr 9, 2010 23:30 |