|
ninjeff posted:This is the real coding horror. At a previous job, I inherited a project with a couple of .cpp files being well over 15000 lines each... one class per file.
|
# ? Aug 4, 2011 21:37 |
|
|
# ? May 15, 2024 02:17 |
|
kalleth posted:He's quite clearly an emacs user Obviously. Emacs is the only editor next to which vim looks archaic.
|
# ? Aug 5, 2011 00:15 |
|
Arguing about text editors is the real horror.
|
# ? Aug 5, 2011 01:15 |
|
pokeyman posted:For what it's worth, default Xcode behaviour is to throw everything in one folder, so you see tons of iOS/Mac apps that have no folder organization. Yeah, I know that. Sadly this is the way we got the Xcode project itself. The classes group has 200 objects in it, most of the files being independent .h/.m sets subclassing one of the AppKit components. Basically there's a component subclassed for every little bit of weird behavior, despite a lot of it being similar/generic enough that a handful of abstract components would make a huge dent in the class count. Do they give out negative scores for code reuse?
|
# ? Aug 5, 2011 05:43 |
|
I don't know why (or even how) anyone would do this, but I've seen a lot of really hideous, inconsistent indenting in computer science class projects the past few years. All the time, I see code that looks like this: code:
|
# ? Aug 5, 2011 06:36 |
|
Not lined up hints at different tab size, if it was stackoverflow, inane disinterest in effort is quite popular.
|
# ? Aug 5, 2011 06:41 |
|
ultramiraculous posted:Yeah, I know that. Sadly this is the way we got the Xcode project itself. The classes group has 200 objects in it, most of the files being independent .h/.m sets subclassing one of the AppKit components. Basically there's a component subclassed for every little bit of weird behavior, despite a lot of it being similar/generic enough that a handful of abstract components would make a huge dent in the class count. Sounds like they come from a completely different background. Generally you shouldn't even subclass AppKit classes (except a few things like Controllers), but use Delegates and Data Sources and such.
|
# ? Aug 5, 2011 06:55 |
|
MrMoo posted:Not lined up hints at different tab size, if it was stackoverflow, inane disinterest in effort is quite popular.
|
# ? Aug 5, 2011 14:10 |
|
I've seen some IDEs that the alignment looks great when viewing the code in the IDE it was designed with, but then opening it in notepad or anything else just ruins all the formatting. The worst I think was Borland C++Builder. Holy god trying to make that code look good in anything but it's own IDE was a nightmare.
|
# ? Aug 5, 2011 16:02 |
|
I love code which uses 4-space indents but replaces each set of 8 spaces with tabs. It's like they're going out of their way to maximize the chance of it looking it like.
|
# ? Aug 5, 2011 17:40 |
|
Plorkyeran posted:I love code which uses 4-space indents but replaces each set of 8 spaces with tabs. It's like they're going out of their way to maximize the chance of it looking it like. haha what, who would do that instead of just making a tab 4 spaces?
|
# ? Aug 5, 2011 17:47 |
|
Plorkyeran posted:I love code which uses 4-space indents but replaces each set of 8 spaces with tabs. It's like they're going out of their way to maximize the chance of it looking it like.
|
# ? Aug 5, 2011 17:52 |
|
Hey, on average it saves 4 bits per indentation level per line. That's nothing to sneeze at.
|
# ? Aug 5, 2011 18:13 |
|
Embedded C Compilers are TRH. The ones I have to use are at least. It seems like every other day I find a crippling bug or limitation that at best I have to implement a goofy work around or at worst causes a project to stall. Today its function pointers. Wanna use a function pointer? Great! Just make sure it doesn't have any parameters, is assigned a value at declaration and never changed, and isn't called from both main-line and interrupt code. EDIT: The instruction sets of the parts I'm using seem to have been designed for the ease of use of assembly programmers, and newer parts must support the same ISA but they've also added some really powerful instructions for C compilers to take advantage of. Years later, the C compilers still don't support these instructions Jerry Bindle fucked around with this message at 19:19 on Aug 5, 2011 |
# ? Aug 5, 2011 18:23 |
|
I use tabs for indenting, and spaces for aligning, like this. Unless I'm using an editor that can't do that automatically, in which case I just use spaces.
|
# ? Aug 5, 2011 18:23 |
|
mr_jim posted:I use tabs for indenting, and spaces for aligning, like this. There's nothing else that makes any sense. It's like people who insist on only spaces or only tabs can't put aside the emotional need to take a side in a religious war and can't get on board with having the benefits of each.
|
# ? Aug 5, 2011 18:55 |
|
A A 2 3 5 8 K posted:There's nothing else that makes any sense. It's like people who insist on only spaces or only tabs can't put aside the emotional need to take a side in a religious war and can't get on board with having the benefits of each. Same here. Not sure about 'modern' editors like notepad++ or what sane IDE's use, but in VIM you can set it up to present the user with tabs/spaces editing while internally everything is spaces; so you end up with the best of all possibly worlds.
|
# ? Aug 5, 2011 19:29 |
|
dietary supplement posted:Same here. Not sure about 'modern' editors like notepad++ or what sane IDE's use, but in VIM you can set it up to present the user with tabs/spaces editing while internally everything is spaces; so you end up with the best of all possibly worlds. What? From what I've seen, it's the worst of both possible worlds. Maybe I just have it configured wrong, but it always does this poo poo: code:
|
# ? Aug 5, 2011 20:50 |
|
The Super Delegate:
|
# ? Aug 5, 2011 20:56 |
|
beuges posted:At a previous job, I inherited a project with a couple of .cpp files being well over 15000 lines each... one class per file. 27000 lines is the largest I've seen for a single .cpp file so for... and that's one class.
|
# ? Aug 5, 2011 21:13 |
|
wellwhoopdedooo posted:What? From what I've seen, it's the worst of both possible worlds. Maybe I just have it configured wrong, but it always does this poo poo: I have it set up so that when you hit tab, or when it autoindents, it inserts 4 spaces and mapped shift-tab to delete the the value of the tabstop (4). <x> or backspace deletes one space. works for me!
|
# ? Aug 5, 2011 21:16 |
|
code:
|
# ? Aug 5, 2011 21:19 |
|
dietary supplement posted:I have it set up so that when you hit tab, or when it autoindents, it inserts 4 spaces and mapped shift-tab to delete the the value of the tabstop (4). <x> or backspace deletes one space. works for me! But that's not using tabs for indentation at all. Now anyone who reads your code has to use 4 spaces = 1 tab, no matter what their personal viewing preferences are. The idea is use actual tab characters for indentation levels. Then, if you need to move the text on a line farther than that use spaces. That way the way the indentation looks can be customized per IDE/editor without messing up the space-aligned text. The problem VIM has is that when it auto-indents it uses tabs where it should use spaces, or it uses spaces where it should use tabs, depending on your configuration. Your way: code:
code:
code:
|
# ? Aug 5, 2011 21:42 |
|
hieronymus posted:27000 lines is the largest I've seen for a single .cpp file so for... and that's one class. I once wrote a 20k LOC GUI application ... in a single file. (Hey I didn't know any better. And it worked. So nyah.)
|
# ? Aug 5, 2011 21:58 |
|
Room Temperature posted:But that's not using tabs for indentation at all. Now anyone who reads your code has to use 4 spaces = 1 tab, no matter what their personal viewing preferences are. The idea is use actual tab characters for indentation levels. Then, if you need to move the text on a line farther than that use spaces. That way the way the indentation looks can be customized per IDE/editor without messing up the space-aligned text. The problem VIM has is that when it auto-indents it uses tabs where it should use spaces, or it uses spaces where it should use tabs, depending on your configuration. I've only gotten it to work in emacs. I gave up trying to make vim do it.
|
# ? Aug 5, 2011 22:03 |
|
Room Temperature posted:Your way: This poo poo right here is why I use spaces everywhere, despite agreeing in principle with "indent with tabs, align with spaces"; I have never used an editor that doesn't gently caress up in this manner as soon as you start actually aligning things.
|
# ? Aug 5, 2011 22:21 |
|
ToxicFrog posted:This poo poo right here is why I use spaces everywhere, despite agreeing in principle with "indent with tabs, align with spaces"; I have never used an editor that doesn't gently caress up in this manner as soon as you start actually aligning things. Emacs with that package that I linked to earlier does it right. Hit tab, it correctly indents and aligns the current line, and you're all set.
|
# ? Aug 5, 2011 22:29 |
|
tabchat should be in YOSPOS, post more code horrors Today, I stumbled across this line. It made me curious, and I now regret my curiosity. code:
code:
code:
code:
code:
code:
|
# ? Aug 5, 2011 22:29 |
|
Holy poo poo they circumvented the Exception message system by making their own that does... exactly the same thing. Someone should show this person Object.getClass() or instanceof() and watch people start shooting themselves.
|
# ? Aug 5, 2011 22:35 |
|
Thel posted:I once wrote a 20k LOC GUI application ... in a single file. I've got a shared VB web service file; 67,000 lines.
|
# ? Aug 5, 2011 22:38 |
|
Thel posted:I once wrote a 20k LOC GUI application ... in a single file. The very first 'big' program I ever wrote was an app that did a 2D engineering simulation. All of the input file parsing, data structure setup, simulation, and output reporting were jammed into one single method that spanned tens of pages. That method was the "Run Simulation" menu item's OnClick event handler.
|
# ? Aug 5, 2011 23:05 |
|
Had to do some ASM work on a very small MCU today. It has a 33 count instruction set so theres a lot of tricks you have to do to get stuff done, like using a xor and the zero flag to test two values for equality. Better yet, there is only one way to do flow control: if a bit is set/clear skip the next instruction. So you end up with code that looks like this:code:
|
# ? Aug 6, 2011 00:29 |
|
dietary supplement posted:Had to do some ASM work on a very small MCU today. It has a 33 count instruction set so theres a lot of tricks you have to do to get stuff done, like using a xor and the zero flag to test two values for equality. Better yet, there is only one way to do flow control: if a bit is set/clear skip the next instruction. So you end up with code that looks like this:
|
# ? Aug 6, 2011 00:57 |
|
PrBacterio posted:What on earth is it with embedded development using all of these weird, horrific alien nightmares of CPU architectures? Why don't you guys just use some cheap ARM clone or an AVR32 or somesuch, or hell, even just a Z80-clone (I think they still make those?) would be better than some of this poo poo, if a 32-bit risc cpu really is too complex for whatever project you're up to Its all about cost. A cheap ARM is probably $5-$10, this chip I think is around Jerry Bindle fucked around with this message at 01:17 on Aug 6, 2011 |
# ? Aug 6, 2011 01:14 |
|
NotShadowStar posted:Holy poo poo they circumvented the Exception message system by making their own that does... exactly the same thing. instanceof is an operator, not a method.
|
# ? Aug 6, 2011 03:08 |
|
I'm excited that so many people have so much new to say about the groundbreaking topic of tabs vs spaces! I never knew that tabs could actually be DIFFERENT depending on different environments! To actually loving contribute I don't have code but a story. As part of some redundancy building so that some guy could go on vacation for a day or two, I was shown the way that millions of dollars of trades are manually checked by some of my financial buddies, and it turns out that it is a bunch of copy and pasted recorded excel macros that rely on magic numbers, strings, and need to be "tweaked" weekly or it won't work correctly. And the kicker is that they use this process because the people are are supposed to be doing it (who number in the low 100's) are so bad at their job that a recorded macro works more reliably and faster than them. So excuse me while I don't shed many tears for something that doesn't result in mistakes worth more than your lifetime income. Caring about useless poo poo is the horror, go fix something important.
|
# ? Aug 6, 2011 03:08 |
|
Here's everyone's warm fuzzy feeling for the day: We're not insane, other people see these horrible things and agree with us. It helps to remember that, especially when dealing with things that seem stupid but are seen as acceptable by co-workers. Like having merging turned off in TFS, and when an hour-and-a-half lunch locked me out of a file I needed to work on, being told "you should've told me before I went to lunch, LOL" The explanation is "we're a small group, so we can talk to each other!" My response was "I can't talk to you when you're missing for an hour and a half" Response: "..." My favorite moment so far was when I was giving a short talk on unit testing methodologies. One guy said "well, i don't care if it works properly as long as it gives a descriptive error message when it fails," and my response was "If you test properly, you should rarely have failure cases" That shut him up. He hates me now. I hope he gets fired due to a huge, breaking bug he introduces that is reported in a very clear, concise manner so that his replacement can fix it. Changing jobs recently wasn't a mistake (more money, better commute, saner management), but I'm used to being in an environment where my co-workers are badasses who raise the bar constantly. Now I'm the "badass," and I'm not learning dick at work (luckily, I take my career seriously and study on my own time), and the other guys are 10+ years older than me and don't want to learn new poo poo. It's an uphill battle, but at least the CTO is on my side. New Yorp New Yorp fucked around with this message at 07:53 on Aug 6, 2011 |
# ? Aug 6, 2011 07:39 |
|
Ithaqua posted:It helps to remember that, especially when dealing with things that seem stupid but are seen as acceptable by co-workers. Like having merging turned off in TFS, and when an hour-and-a-half lunch locked me out of a file I needed to work on, being told "you should've told me before I went to lunch, LOL" Oh god, gently caress file locking in source control. I'm just working out my notice at a company that uses VSS (well, half of it does; there are literally skunkworks SVN and git servers that not everyone knows about, which I think says quite a lot) and the guy in charge of the VSS server doesn't know how to force-unlock a file (I don't know if that's even possible, but it absolutely should be). So we have ridiculous situations like people forgetting to 'undo checkout' a solution file before going on a three week holiday, and the only way around it is to duplicate that entire source tree in the VCS and work off the new one. This is compounded by how insanely frequently the VSS plugin for visual studio decides to check stuff out for you (e.g. initiate (not complete! just initiate!) a drag'n'drop operation on a project's file list - bang, checked out). There's even one file in our source control permanently checked out to a guy who left the country a few months ago, and I'm pretty sure it will _never_ get unlocked.
|
# ? Aug 6, 2011 09:48 |
|
Actually while I'm bitching about my soon-to-be-ex-job, the coding horror that's been pissing me off for several months (and absolutely contributed to me starting to look for and getting a new job) is ridiculous cargo-cult design. Basically - I wrote an IPv6 fuzzer a while ago. I used YAML to specify the fuzzing rule files, because I'm a ruby dork and I'm lazy. I found a Windows bug and got it reported in a patch tuesday (this is a big deal in a security company). Management decides that the success here was clearly because I used YAML, therefore YAML is now a feature and is literally appearing in the marketing copy for our (completely unrelated) fuzzer product. They assigned another guy to write a YAML-based fuzzer add-on for our actual fuzzer product (the thing I made was just an internal tool for sort of testing the waters in terms of IPv6 vulns); guy wound up writing a horrible C++ mashup of libyaml, bison and flex, mostly using libyaml as a lexer (and nothing else) and parsing a very much non-YAML language he's concocted himself that has idiotic types and sigils on variables and braces for scoping and ick. The reason why it's been pissing me off, aside from the whole 'this is not yaml but you keep calling these yaml files' thing, is that I got tasked with solving the memory leaks that occur in this genius design, because the entire execution is actually carried out inside the bison grammar. Meaning it is insanely difficult to figure out the program flow, and where allocations happen and where pointer ownership is passed (to the RAII crew: god I wish and I don't even like RAII). They're probably going to have to go to some sort of autopointer or whatever, but there's no time to get company approval to include another library in the project (yes that sentence means what you think it means. even BSD-style licensed libraries.). I've got three days left at the company and I've taken this software from leaking 350MB per run to leaking 8MB per run and they can just live with it.
|
# ? Aug 6, 2011 10:13 |
|
|
# ? May 15, 2024 02:17 |
|
dazjw posted:... and the guy in charge of the VSS server doesn't know how to force-unlock a file (I don't know if that's even possible, but it absolutely should be). I hope it's not as easy as it seems but about thirty seconds of Googling revealed this solution.
|
# ? Aug 6, 2011 23:49 |