|
I believe there's somewhat more to the C++11 standard than just those new to_string functions, right?
|
# ? Dec 11, 2012 21:36 |
|
|
# ? May 17, 2024 15:22 |
|
PrBacterio posted:I believe there's somewhat more to the C++11 standard than just those new to_string functions, right? Yes and MS is pretty good about supporting it in VS2010 and 2012.
|
# ? Dec 11, 2012 21:43 |
|
Manslaughter posted:Holy christ on a cracker Aww, you found something I could have written just a couple of years ago.
|
# ? Dec 11, 2012 21:50 |
|
PrBacterio posted:The same goes for C++ string handling, where it isn't even possible to convert a number into a string with standard C++ functions except by using a string stream. What ought to be a single line of code There's always boost::lexical_cast.
|
# ? Dec 13, 2012 06:19 |
|
This isn't really a coding horror but it certainly belongs in this thread regardless. My data structures + algorithm design/analysis class this semester uses an awful book by Richard Neopolitan that has a killer gently caress up: Fortunately none of the actual text has the misspelling/error but having it on every other page in the header might be even worse..
|
# ? Dec 14, 2012 04:11 |
|
What're the odds that it was a bad spellcheck dictionary/a copyeditor that doesn't know the word 'intractability'?
|
# ? Dec 14, 2012 04:12 |
|
Yeah, I'm sure that's what happened but if you're a copyeditor of an algorithms book and the word is strewn throughout the text you probably shouldn't gently caress that up. Unless you're saying the odds are low, in which case.. I dunno.
|
# ? Dec 14, 2012 04:16 |
|
lol "traveling salesperson"
|
# ? Dec 14, 2012 04:52 |
|
I'd buy an algorithms book that exclusively used female pronouns/names for algorithm descriptions throughout.
|
# ? Dec 14, 2012 04:57 |
|
It would be p awesome if the text misstated the NP-Complete version of the traveling salesman problem.
|
# ? Dec 14, 2012 05:04 |
|
For a few hours I've been pulling my hair out over a C++ glitch that I introduced. I was storing a value in a char that was supposed to be an unsigned char and kept wondering why I was getting a 0 value when I shouldn't have been. I am the coding horror.
|
# ? Dec 14, 2012 06:18 |
|
Bunny Cuddlin posted:lol "traveling salesperson" These are changing times.
|
# ? Dec 14, 2012 07:24 |
|
I received an eval copy of a data structures textbook that I was considering using for my class next spring. At first, it was great. Awesome topic order, good coverage of the material, well-written... until I flipped to a random page on lists and saw: "Unlike the standard Java List interface, our list will start at index 1." The whole book was tainted after that. Every algorithm that used that list interface had little +1s and -1s scattered all over it to correct for this stupid design decision. How does an author not realize how stupid he's being when he has to write correction code like that? How do other reviewers before publication time not say "What the gently caress are you doing?"
|
# ? Dec 14, 2012 12:38 |
|
Bunny Cuddlin posted:lol "traveling salesperson" I wonder how you'd make something like Hall's Marriage Theorem less gender-specific.
|
# ? Dec 14, 2012 14:00 |
|
Datetime strings and what Internet Explorer thinks of themcode:
|
# ? Dec 14, 2012 14:49 |
|
I'd put money on it being some kind of ancient Excel or office compatibility issue.
|
# ? Dec 14, 2012 17:34 |
|
That Turkey Story posted:These are changing times. "SENIOR software developer is ageist. From now on your job title is Extensively Experienced Software Developer."
|
# ? Dec 14, 2012 17:59 |
|
Received this snippet from a customer who is still working in VB6:code:
|
# ? Dec 14, 2012 19:54 |
|
if you number the lines, you can get line numbers in error messaged by using the semidocumented 'Erl' variable.
|
# ? Dec 14, 2012 20:54 |
|
It occurs to me that I never tried putting the line numbers out of order...
|
# ? Dec 14, 2012 21:04 |
Use a negative number, jump out of the stack like a train off its rails
|
|
# ? Dec 14, 2012 21:28 |
|
Not really a horror, but buried deep in a legacy BIOS AGESA module...code:
|
# ? Dec 14, 2012 23:29 |
|
That Turkey Story posted:These are changing times. In my database theory class the lecturer had to point out one of the textbook examples that involved modeling family relations wasn't really compatible with our same-sex civil partnership laws..
|
# ? Dec 15, 2012 15:30 |
|
uncleTomOfFinland posted:In my database theory class the lecturer had to point out one of the textbook examples that involved modeling family relations wasn't really compatible with our same-sex civil partnership laws.. Seems like a good time to wheel this out again... http://stackoverflow.com/questions/6163683/cycles-in-family-tree-software
|
# ? Dec 15, 2012 15:45 |
|
Ok, so this guy is a prick. I told him to take his java code and turn it into c# code, because we're a c# shop. And he said "<bosses name> has been riding me, and he said i could write it in java code", or something like that. Kinda pissed me off, but ok, can't over-rule the boss(at least not without talking to him first) Next time I saw <bosses name> was at a meeting about the project.. This was also the first time i got to actually see idiot's code. He had put everything in a single 3000 line file. Not only that, but he had written everything in functions (or methods if you wanna get technically correct). Each method dealt with one line. And yeah, each method had code in it that parsed the given line. But it just printed out to the console. It didn't do anything with the result of that parsing, or decoding. really. This is what he had: code:
This stuff has to go in a database, not to the screen. And besides, some lines are gonna have info that other lines need if you want to put them in a database, and link them together. For instance link the merchantId with the various authorization records. I knew this, and I hadn't even read the spec really. I kind of scanned over it. It's just common sense. There was no way his solution was gonna work, and he'd basically wasted his time. I was more diplomatic than that though. I said look, you need to break this out into objects, and you're gonna want to use a base class, an abstract base class really. You might as well write it in c#. But it was as if he had no idea why he would need to do that. He really pushed back. Oh, and the fact that he has a 3000 line code file that was not auto generated. If you find yourself in the middle of typing up a 3000 line file, you should probably rethink your career choice. Wow, sorry this is so long. But this guy really got under my skin. I've had a real breakthrough recently, and realized I need to stop coddling these guys. If I can tell they're not gonna work out after a week, I need to fire them (I don't really have the power to fire anyone, but the owner loves me, and trusts my opinion implicitly). It really wastes everyone's time to let them linger on This was not the end of this guy, but I can assure you it has ended now. We have a new rule in my office. If you have a project with a 3000 line code file in it that was not auto-generated, you are fired. I have more about this guy if anyone cares. .
|
# ? Dec 15, 2012 20:45 |
|
e: ^ holy crapuncleTomOfFinland posted:In my database theory class the lecturer had to point out one of the textbook examples that involved modeling family relations wasn't really compatible with our same-sex civil partnership laws.. Ours did too and we had to model an address book that was compatible. http://qntm.org/gay has a funny take on the whole situation and how much of a hassle it is to implement correctly. bucketmouse fucked around with this message at 01:35 on Dec 16, 2012 |
# ? Dec 15, 2012 21:01 |
|
Jen heir rick posted:I have more about this guy if anyone cares. Please share more
|
# ? Dec 15, 2012 21:02 |
|
Jonnty posted:Seems like a good time to wheel this out again... The horror there is that the LDS church has created the specification for the most commonly used genealogy format, and purposefully crippled it to fit their moral standards.
|
# ? Dec 15, 2012 21:03 |
|
Jen heir rick posted:This was not the end of this guy, but I can assure you it has ended now. We have a new rule in my office. If you have a project with a 3000 line code file in it that was not auto-generated, you are fired. I have more about this guy if anyone cares. Yes longer files can be annoying and can be a code smell, but seriously, firing people for 3000 line files? That's a management horror right there.
|
# ? Dec 15, 2012 22:22 |
|
awesmoe posted:What's wrong with 3k line files? If you're looking at two different pieces of code at once,you're going to have to open another view(/window/split/tab) for the second piece. Why does it matter whether the code is 3k lines away or 10k lines away, or whether it's in a different file? (Unless you never learned to use your editor, I guess) There are always exceptions and cases where 3k isn't that bad, and I would give a little leeway depending on the language. I recently refactored an 1800 line monstrosity into 3 manageable classes, and that significantly improved readability. If anyone doesn't feel the need to rework something that ugly, then I start questioning their capabilities. If I worked on a team where that was the norm, I'd look for another job.
|
# ? Dec 15, 2012 22:30 |
|
Geekner posted:There are always exceptions and cases where 3k isn't that bad, and I would give a little leeway depending on the language. I recently refactored an 1800 line monstrosity into 3 manageable classes, and that significantly improved readability. It's not like I write gigantic files recreationally, and I'm not claiming long files are strictly superior to short ones or anything. My main point is that messiness (not file length) is what matters when it comes to refactoring. I dislike the dogmatic attitude that guy had - and if I had a manager who made decrees like the above, I'd sigh heavily and start daydreaming about writing my code with line 2999 being #include "filename2.cpp"
|
# ? Dec 15, 2012 23:07 |
|
awesmoe posted:What's wrong with 3k line files? If you're looking at two different pieces of code at once,you're going to have to open another view(/window/split/tab) for the second piece. Why does it matter whether the code is 3k lines away or 10k lines away, or whether it's in a different file? (Unless you never learned to use your editor, I guess) I knew someone would fuckin' say this, so I'd just like to note that 1. I will make an exception for people who come to me first and I approve of their approach 2. They can always split there code into partial classes to get around the rule 3. I was kidding, there is no such rule
|
# ? Dec 15, 2012 23:28 |
|
This person is an intern, right? Like, they've never really programmed before. Give me that at least.
|
# ? Dec 15, 2012 23:34 |
|
awesmoe posted:
Actually his code was not messy at all. Sure he had hundreds of methods that all did basically the same thing, but it was very neatly typed, indented and even commented in places. My point was that his code was not very extensible. I asked him how he planned to proceed with the project and he had no idea. I knew how he could proceed, but he wouldn't listen to me. And it took me and a coworker and my/his boss telling him to, before he agreed to. And if it's so easy to navigate around one giant file in modern IDEs, why not put all of your classes in one file. Why this arbitrary practice of placing different classes in different files? Just shove em all in one big file. Saves a lot of time not having to right click->new class. Right? Oh and in case you missed it the first time. I was kidding. It was a joke. *edit* I think I'm gonna start coding this way, it really would be convenient!! Jen heir rick fucked around with this message at 23:56 on Dec 15, 2012 |
# ? Dec 15, 2012 23:50 |
|
awesmoe posted:I'm not convinced that if you took the files you wrote your 3 new manageable classes in, and concatenated them together into one big long file, you would have affected readability in any major way (except making it harder to navigate your project outside your IDE).
|
# ? Dec 15, 2012 23:52 |
|
Jen heir rick posted:I knew someone would fuckin' say this, so I'd just like to note that 2. So it's literally dogma, rather than an objection based on a short-files-enforce-reduced-class-length-to-maximize-responsibility-splitting argument (for example). Cool. 3. Well I guess if you're not actually doing what you said you were doing, it matters a lot less! Jen heir rick posted:Actually his code was not messy at all. Sure he had hundreds of methods that all did basically the same thing, but it was very neatly typed, indented and even commented in places. My point was that his code was not very extensible. I asked him how he planned to proceed with the project and he had no idea. I knew how he could proceed, but he wouldn't listen to me. And it took me and a coworker and my/his boss telling him to, before he agreed to. In your example, you weren't refactoring his code, you were binning his lovely code. Guess what? If he'd split it into six 500 line files you would still have binned it because it would still have been lovely! (I'm not arguing the shittyness at all, it all sounds very stupid.) pigdog posted:It's not just about readability. A 3000 line class most likely ... Maybe - probably! - but we're talking about files not classes. awesmoe fucked around with this message at 00:16 on Dec 16, 2012 |
# ? Dec 16, 2012 00:14 |
awesmoe posted:Maybe - probably! - but we're talking about files not classes. This was Java. You know, where one file is typically one class.
|
|
# ? Dec 16, 2012 00:20 |
|
awesmoe posted:Maybe - probably! - but we're talking about files not classes. I'm quoting this because that's a bullshit response and you know it. The whole point of this discussion is that someone didn't go "Wait, do I really need to manually do all of this?" As for 3k line files (I swear I've got to be falling for some sort of trolling here), honestly, there's a point at which a code "thing" is too big and it becomes a hassle to maintain. I mean, hell, that's why we have the term "spaghetti code." Even still, its so much easier to maintain a normalized code base instead of having some gigantic monster doing all the work from one god file. Its also easier to do code reviews and to keep management of said code under wraps. I would not like to have everyone working on one monster file in my svn repo.
|
# ? Dec 16, 2012 00:23 |
|
awesmoe posted:Yes longer files can be annoying and can be a code smell, but seriously, firing people for 3000 line files? That's a management horror right there. It may not be a valid metric (in the sense that it's a measurable line to cross), but it sure as hell is a good heuristic for determining lovely programmers.
|
# ? Dec 16, 2012 00:24 |
|
|
# ? May 17, 2024 15:22 |
|
It isn't about some bullshit dogma, but the fact that you think gigantic source files are A-OK and unrelated classes should share a source file for convenience. Get a proper IDE that can jump between source files by reference, and use some loving subfolders. Not everyone who manages code is some dogma-sperg, 3k is just a point where 99% of cases you have someone doing something stupid. I'm willing to bet you aren't in the 1%.
|
# ? Dec 16, 2012 00:29 |