|
Chairman Steve posted:Can you elaborate? I'm not trying to call you out on anything - I'm genuinely interested to hear how String.equals() breaks the equals() contract. I think he's referring to the problem with null strings in Java. If foostring is null, and you call foostring.equals("whatever"), then you get a null pointer exception. If you reverse that call, since "whatever" is guaranteed not to be null, you will never have that exception. It's due to java treating strings like objects, and building the equals() function into that object. e: The horror is that java includes the equals function into the string object, where most other languages handle it in a separate function that can handle null cases better. zeekner fucked around with this message at 16:35 on Jun 12, 2010 |
# ¿ Jun 12, 2010 16:32 |
|
|
# ¿ Apr 26, 2024 08:14 |
|
SirViver posted:Substring does allocate a new string. You can read the characters directly from the string, though, making substring completely unnecessary for reading single characters. That said, how would you implement substring without allocating a new string? He may be referring to Java, where substring uses the parent's char array. http://www.javamex.com/tutorials/memory/string_memory_usage.shtml
|
# ¿ Aug 31, 2010 14:34 |
|
PhonyMcRingRing posted:... Horrible code is the only thing thats truly cross-platform.
|
# ¿ Sep 4, 2010 00:19 |
|
code:
|
# ¿ Nov 13, 2010 23:38 |
|
npe posted:Dear Penthouse: Do VB switch-cases fall-through? If so, there are no words to describe the horror.
|
# ¿ Nov 18, 2010 18:09 |
|
code:
This breaks a major feature in XMBC, and has gone unnoticed for months because of differences in how major versions of python handle int(boolean).
|
# ¿ Jan 18, 2011 19:25 |
|
quote:Coding horrors: post the code that makes you laugh (or cry) Eggnogium posted:this ugly workaround that made me laugh: Not everything in this thread has to be straight from the demented mind of an enterprise Java/PHP veteran. I kinda like seeing the crazy ways new people solve problems, they are pretty creative (albeit in a terrible way).
|
# ¿ Mar 5, 2011 00:00 |
|
yaoi prophet posted:
I thought I knew a fair bit about perl regex, but I can't read this drat thing. What's it supposed to parse? zeekner fucked around with this message at 23:33 on Apr 7, 2011 |
# ¿ Apr 7, 2011 23:27 |
|
yaoi prophet posted:poo poo that looks like "(PP (IN in) (NP (JJ full) (NN swing)))". The (?<node>) syntax means 'this pattern is called 'node'' and (?&node) means 'the pattern 'node'. So basically you can recurse back into the pattern from itself. Amazing. No, wait, the other thing: Tedious. Are there any practical limitations on how far that kind of regex can recurse? zeekner fucked around with this message at 23:38 on Apr 7, 2011 |
# ¿ Apr 7, 2011 23:36 |
|
Munkeymon posted:I'm not the best with Java, but I think this counts, right? It's not completely horrible, it just looks like a C programmer that's still stuck assuming everything needs a null-check or to be allocated manually. Also, concatting strings like that should be done with StringBuilder or something.
|
# ¿ Apr 11, 2011 18:03 |
|
HFX posted:The real horror here is that they overloaded mathematical operators for strings and thus broke consistency. Java strings are a confusing mess. Features like that += operator are designed around ease of use, not speed. Anyone who understands this mess well will avoid them like the plague. When you stare into the enterprise, the enterprise stares into you. That code snippet just shows that the programmer doesn't understand Java strings very well. Each += operation creates a new string, wasting memory and processing time. With StringBuilder, he could just append the string and generate the final string when he's done reading from input. zeekner fucked around with this message at 19:13 on Apr 11, 2011 |
# ¿ Apr 11, 2011 18:46 |
|
ToxicFrog posted:Am I missing something, or could that whole thing be replaced with: code:
The code just opens/reads/concats a webpage or file into a string.
|
# ¿ Apr 11, 2011 18:51 |
|
Why does a localizer class do any form of pluralization?
|
# ¿ Apr 12, 2011 15:51 |
|
code:
e: gently caress, didn't notice $
|
# ¿ Apr 12, 2011 17:48 |
|
TRex EaterofCars posted:You're right. What is that (.*) doing in front of the line-start symbol though? That's what threw me off. . Any character (may or may not match line terminators) X* X, zero or more times So, anything zero or more times, basically a pure wildcard. I assume strings are tokenized before calling these functions.
|
# ¿ Apr 12, 2011 18:07 |
|
Is that better or worse than (Java):code:
|
# ¿ May 8, 2011 09:23 |
|
Monkeyseesaw posted:Rule #1 of web development: Browsers don't scream about *anything*. They cry themselves to sleep instead.
|
# ¿ May 12, 2011 19:33 |
|
Aleksei Vasiliev posted:
Dooey posted:(This shop primarily does electrical engineering so they aren't really familiar with common software development methodologies.) This is pretty much the case, EE's tend to commit some pretty major coding horrors. Hell, sometimes horrors are even required by the device/IDE/platform. And I've never seen a good IDE for embedded devices. Ever.
|
# ¿ May 14, 2011 07:02 |
|
Janin posted:from a while back, but: An exception type can be really specific or really general. Yea, you need to check the exception contents for an SQLException, but what can you really do with a NullPointerException? Even then, his code could easily have checked for the mis-constructed state inside the catch block and thrown a fail() there as well.
|
# ¿ May 14, 2011 22:58 |
|
decarboxylated posted:
It's handy to have that, remember back in '79 when "Two" was legally 3 for a week? Just plannin' ahead. Also, off-by-one errors can be fixed en-mass.
|
# ¿ May 17, 2011 04:23 |
|
Sedro posted:Java 7 has new operators to make this crap faster to write. code:
|
# ¿ May 22, 2011 04:32 |
|
Sedro posted:What if that array is empty? Surely the indexer should return null instead of throwing an exception. From what I understand, if the left side of the ? is null, it will return null instead of attempting to read the array. The second question mark does the same for the array value. code:
code:
e: Misread that, from that link: "(the array) is non-null and non-empty", it'll return null instead of throwing an error. zeekner fucked around with this message at 07:01 on May 22, 2011 |
# ¿ May 22, 2011 06:54 |
|
It might be fine in other languages, but Java always encouraged avoiding null references as a design methodology. That way you don't have to check for null on every single operation. Now I'm gonna see code that'll have more question marks than a headline. e: My complaints are really about the quality of the average Java programmer, the actual function isn't horrible. The coding horrors that will result will be. zeekner fucked around with this message at 09:32 on May 22, 2011 |
# ¿ May 22, 2011 09:26 |
|
dwazegek posted:How the gently caress do you even accomplish this? I could only imagine some variables refer to previous variables, and rely on the specific initialization order. int ONE = 1; int TWO = ONE+ONE; ect. zeekner fucked around with this message at 09:48 on May 26, 2011 |
# ¿ May 26, 2011 09:46 |
|
Standish posted:that's 5,400 commits every single day since subversion was released back in 2000, what are you doing? All I can imagine is some app backed by a flat file database. Eventually they need to scale, enterprise style. Rather than spend 10 minutes rewriting the app to use SQL, they write to the file and check it into SVN. Every time the app goes to read the file it calls svn update first, and every time it writes it will commit those changes. The Überhorror.
|
# ¿ Jun 10, 2011 20:07 |
|
JediGandalf posted:I just found this gem Don't worry, I validated the input!
|
# ¿ Jun 14, 2011 00:04 |
|
xarph posted:Torn between this thread and the poo poo that pisses you off thread... That's like every init script ever written. I've seen one that used a web-interface to shut down the daemon, and never checked the output to find if that failed or not.
|
# ¿ Aug 2, 2011 02:22 |
|
Zhentar posted:I just realized that in MUMPS, since '+' and '-' are also unary operators, this is legal syntax. MUMPS is signified by swelling, fever, headaches, and rashes. It has been eliminated in the first-world but remains a common issue in developing countries. See also: Mumps_(disease).
|
# ¿ Sep 15, 2011 19:11 |
|
Munkeymon posted:I get to support it because I'm the only one who will admit to knowing anything about PHP other than that it's terrible. Thankfully, I don't have to take the marketing director's code and make it not suck poo poo because we outsourced that. The guy doesn't understand loops and uses PHP. Use your imagination and I guarantee reality was worse. Isolate that box from the network and name it Tortuga, there ain't no way that whore will stay clean.
|
# ¿ Sep 22, 2011 21:12 |
|
A A 2 3 5 8 K posted:Every time I see a PHP blog post, it looks like this to me: http://techinfogurus.com/modules/editor/view_article.php?id=6 GOTOs are Bad, so I'll use do-while-break! Happy Programming !!
|
# ¿ Sep 28, 2011 18:59 |
|
yaoi prophet posted:
ArchLinux? I haven't installed it in a while, but the installer was pretty barebones for such a nice customizable distro.
|
# ¿ Jan 31, 2012 02:37 |
|
Get that new job quickly, before they get hacked and that entry on your resume becomes a burden.
|
# ¿ Mar 31, 2012 00:47 |
|
Chopper posted:Current fashionable languages/frameworks are Python/Django and Ruby/Rails. Personally I prefer Django. And if you must use PHP, CodeIgniter is the only competent framework. Good documentation, reasonable design standards, no lovely comments by terrible coders in the documentation. It almost made PHP seem like a normal language, until I had to look up some core PHP functionality and came crashing back to earth.
|
# ¿ Apr 11, 2012 09:00 |
|
There's also the bit where he's calling row() without checking num_results() first. CodeIgniter will actually throw a proper exception if you try to access a row in an empty cursor. But I wouldn't expect a PHP programmer to know what an exception is.
|
# ¿ Apr 17, 2012 16:16 |
|
Goddamn, never roll your own crypto implementation. How hard is that? It's literally less work and cheaper to use a professionally written and publicly licensed library.
|
# ¿ Apr 26, 2012 07:58 |
|
Hammerite posted:I know it's not nice to make fun instead of helping, but goddamn. Oh god the varchar(2) that he will most assuredly use as the item count. 99 Erasers is enough for anyone!
|
# ¿ May 1, 2012 19:27 |
|
Dont forget that Google customizes results based on your search history. I get a lot more programming based results for otherwise ambiguous terms, where I would get much more generic results from a non-customized search.
|
# ¿ May 11, 2012 23:09 |
|
Zamujasa posted:I'd consider another job but right now I've worked hard for my lowly $15/hour wage. At least I have benefits, even if they do come out of my paycheck at the end of the week. Hey, stop selling yourself short. If your competent enough to point out those flaws, you're probably worth more than $15/hr. Seriously, IT helpdesk people make more than that. Even if you are dangerously incompetent you could still make $25/hr like any bog-standard PHP developer.
|
# ¿ Jun 20, 2012 10:10 |
|
yaoi prophet posted:I don't know C++ at all, what's the horror? Returning the memory location of a local variable. Probably some other horrors too.
|
# ¿ Jun 30, 2012 22:38 |
|
|
# ¿ Apr 26, 2024 08:14 |
|
Cirian posted:Imagine what you get when you start with a horrible, ugly, slow language (Objective-C), and you selectively discard some (but not all C-isms), replacing them with a sprinkling of JavaScript, Pascal and Ruby. Finish it off with a dash of pure crazy, and you get this, the Eero Programming Language. Anyone who thinks switch fall-through isn't a good feature should write a state machine. Heh, NSNSSomeType errors.
|
# ¿ Jul 11, 2012 04:16 |