|
Smugdog Millionaire posted:How do you write 100,000 lines of code in a single file before you think to yourself "surely there's a better way to organize this"? Horror Maker posted:I have never worked with classes in that way where I create them myself so I am not sure of how to do this actually. And looking back through their posting history to a couple months ago... Horror Maker posted:Hello Given the style, it's someone who has been forced to use programming in the pursuit of a particular goal. They haven't made any attempt to simply learn to program; instead only attempting to expand their knowledge when encountering a problem they don't already know some way to solve, and even then they simply want to be told the solution, either through forums or piecing together tutorials, never attempting to understand why things work they way they do.
|
# ? Oct 27, 2011 18:53 |
|
|
# ? May 24, 2024 23:27 |
|
Optimus Prime Ribs posted:Well I know what it's doing. I just don't know what purpose it serves. pokeyman posted:"Beauty and Rage", Museum of Modern Programming, 2011. https://www.youtube.com/watch?v=5-OjTPj7K54 code:
Bhaal fucked around with this message at 20:34 on Oct 27, 2011 |
# ? Oct 27, 2011 20:29 |
|
Well if we're going down this road I might as well also roll out The Story Of Mel, which is simultaneously a heartwarming free verse tale of hardcore coder skill of days gone by, and a coding horror story about the unmaintainable rat's nest of code that Mel clearly left in his wake, everywhere he went.
|
# ? Oct 27, 2011 21:45 |
|
Plorkyeran posted:Grading is awesome because you get to punish people for writing terrible code rather than having to just sigh and put up with it. Grading is terrible, because you realize that of the 20 people registered for the course, only 16 bothered to commit a solution at all. And of those 16, only one implemented the spec correctly. Over half, on the other hand, submitted something that does not actually run (except in the most charitable sense that "the OS successfully loads the executable"). And all of these are third-year students who have somehow passed several programming courses. (My favorite failure mode was the two programs that are somehow written in such a way that only absolute paths work on the command line. How is that even possible? It's harder to do it that way than to accept both absolute and relative paths! I say "was" because today it was superseded by the program that doesn't check how many nodes are available, and instead starts by assuming it can only create 1 process and then doing some math that results in it trying to create -1 processes and crashing.)
|
# ? Oct 27, 2011 22:05 |
|
ToxicFrog posted:Grading is terrible, because you realize that of the 20 people registered for the course, only 16 bothered to commit a solution at all. This is only a problem when you have academic/political pressure to pass a certain percentage.
|
# ? Oct 27, 2011 22:07 |
|
baquerd posted:This is only a problem when you have academic/political pressure to pass a certain percentage. We don't. And I didn't say it was a problem. It's just drat depressing. Are they that clueless? If so, how did they pass the previous courses? Do they just not care? If so, why did they sign up for this course?
|
# ? Oct 27, 2011 22:21 |
|
loinburger posted:Same industry. Another piece of code I had to rewrite from the same contractor was the box-packing algorithm - the way the contractor's code put items in boxes was "If the items' dimensions fit in the empty box, and there is sufficient unused volume in the box, then the item fits!" In other words, given a 12x12x12 box (volume 1728) and three 8x8x8 items (combined volume 1536), the algorithm would put all three items in the box, even though this is sort of impossible. Heh, I had a similar problem when coding a cost-estimator for the various shipment types. The solution before we put in company specific algorithms? Use the dimensions and weight of the assembled product. So an ikea style desk would estimate at 300% because its assembled size is so much greater than its flat pack size. Mind you some of those company specific solutions were a horror unto themselves. Dim factors for some, LxHxDxWx<magic number> for others. I tell you one thing though, NMFC codes and old school EDI parsers are the real loving horror.
|
# ? Oct 27, 2011 22:37 |
|
baquerd posted:This is only a problem when you have academic/political pressure to pass a certain percentage.
|
# ? Oct 27, 2011 23:23 |
|
ToxicFrog posted:Grading is terrible, because you realize that of the 20 people registered for the course, only 16 bothered to commit a solution at all. "Only" 80%? Fewer than half of the students of first-year mathematics courses that I teach examples classes for bother to hand in the set work for marking. In fairness, in my department that work doesn't count towards the grade (it is all on the exam at the end). Also, I know this is a thread for people to blow off steam, but some of you sound like you have utterly terrible attitudes towards teaching.
|
# ? Oct 28, 2011 00:09 |
|
Hammerite posted:"Only" 80%? Fewer than half of the students of first-year mathematics courses that I teach examples classes for bother to hand in the set work for marking. In fairness, in my department that work doesn't count towards the grade (it is all on the exam at the end). This assignment is worth 10% of their final grade. Yeah, that's peanuts compared to the term project or the exam, but it's not something I'd expect people to blow off lightly either.
|
# ? Oct 28, 2011 00:13 |
|
Hammerite posted:"Only" 80%? Fewer than half of the students of first-year mathematics courses that I teach examples classes for bother to hand in the set work for marking. In fairness, in my department that work doesn't count towards the grade (it is all on the exam at the end). To be fair, I think that's why a lot of us aren't teaching. I know I personally don't have the patience for it; it's bad enough when something as theoretically logical and rule-following as a computer starts throwing poo poo fits.
|
# ? Oct 28, 2011 01:09 |
|
OriginalPseudonym posted:To be fair, I think that's why a lot of us aren't teaching. I know I personally don't have the patience for it; it's bad enough when something as theoretically logical and rule-following as a computer starts throwing poo poo fits. Have you ever seen a computer not be logical and rule following? Excepting hardware failure I mean.
|
# ? Oct 28, 2011 01:39 |
|
Even hardware failures are perfectly logical and rule following -- if you understand the rules.
|
# ? Oct 28, 2011 01:51 |
|
baquerd posted:Have you ever seen a computer not be logical and rule following? Excepting hardware failure I mean. No, but a system call might which is just as bad.
|
# ? Oct 28, 2011 01:56 |
|
TasteMyHouse posted:Even hardware failures are perfectly logical and rule following -- if you understand the rules. Tell me that when you've got an IP address conflict.
|
# ? Oct 28, 2011 02:01 |
|
qntm posted:Well if we're going down this road I might as well also roll out The Story Of Mel, which is simultaneously a heartwarming free verse tale of hardcore coder skill of days gone by, and a coding horror story about the unmaintainable rat's nest of code that Mel clearly left in his wake, everywhere he went. I want to believe
|
# ? Oct 28, 2011 02:03 |
|
baquerd posted:Have you ever seen a computer not be logical and rule following? Excepting hardware failure I mean. To be fair, every issue has a sane and logical reason for happening, but those reasons don't necessarily have to be sane and logical. For example, if you have a cron script that cleans up your server by rm -rfing every file with a ".swp" extension at midnight on alternate tuesdays, then that will cause issues, and if you don't know about the script, then you'll have no idea why it's happening. Or if someone decides that the fan in their computer is making too much noise and pulls it out, thus leading to overheating and irrational behavior. The irritation generally stems from attempting to find the reason for it, assuming that you have the time and resources necessary to, but occasionally irrational behavior is too deeply embedded to do anything but work around (like, for example, when you have a 10 gig codebase that's maintained in sourcesafe, and occasionally sourcesafe says "this checkout is too large" and stops doing the checkout with a messagebox that simply states "(NULL)").
|
# ? Oct 28, 2011 02:36 |
|
Scaramouche posted:Heh, I had a similar problem when coding a cost-estimator for the various shipment types. The solution before we put in company specific algorithms? Use the dimensions and weight of the assembled product. So an ikea style desk would estimate at 300% because its assembled size is so much greater than its flat pack size. Eventually we came up with a way to split up the box's free space after putting in an item, e.g. after putting an 8x8x8 item in a 12x12x12 box you've got an 8x8x4 free space, a 12x8x4 free space, and a 12x12x4 free space; that way we could still use the free space without running into the problem of overlapping items
|
# ? Oct 28, 2011 03:59 |
|
Zombywuf posted:Tell me that when you've got an IP address conflict. That has absolutely nothing to do with hardware failure (e.g. capacitors exploding, dielectric breakdown and electromigration in CMOS transistors, very noisy inputs to a crappy power supply causing odd spikes in voltage at seemingly-random intervals).
|
# ? Oct 28, 2011 06:05 |
|
loinburger posted:I checked around online to see how other people were solving the problem, and was surprised at the number of people who were brute-forcing it. I had a quarter-second deadline to come up with an estimate for 50 items, so brute force obviously wasn't going to work. This might be acceptable for your application, but a naive implementation of this sort won't be able to achieve optimal solutions in a few cases. In the example you cited, for example, you might have a hard time detecting that an 8x8x8 and 3 12x8x4s will fit.
|
# ? Oct 28, 2011 06:07 |
|
SlightlyMadman posted:"svn blame" is possibly the best thing to ever have happened in computer history. Testers found that (old) poo poo's broken when they were testing my new component. Blame to the rescue. Wasn't my fault. Another dude had changed the Makefile and it was no longer copying the old component from the source tree to the build environment. brosmike posted:This might be acceptable for your application, but a naive implementation of this sort won't be able to achieve optimal solutions in a few cases. In the example you cited, for example, you might have a hard time detecting that an 8x8x8 and 3 12x8x4s will fit. http://en.wikipedia.org/wiki/Bin_packing_problem Yeah, it's not easy.
|
# ? Oct 28, 2011 08:24 |
|
Yeah, we had no hope of finding the optimum. Instead we wrote the algorithm so that it more-or-less randomized the order in which items were packed, the item rotations, and the way that free space was partitioned, and then ran a few hundred iterations of it and returned the best result. (For fifty items were could run about 500 iterations and still fall within the quarter-second deadline; for fewer items we increased the number of iterations accordingly)
|
# ? Oct 28, 2011 13:33 |
|
pokeyman posted:Ah yes, I can see it now.. Allow me to contribute with something I found, in honor of McCarthy: code:
|
# ? Oct 28, 2011 14:45 |
|
TasteMyHouse posted:Even hardware failures are perfectly logical and rule following -- if you understand the rules. You mean... physics?
|
# ? Oct 28, 2011 15:59 |
|
qntm posted:You mean... physics? Yeah, that was my point (though I was specifically thinking of materials science, electronics, signals and systems, etc); although computers are "logical and rule following" that doesn't help you when the logic and the rules are obscure or beyond easy comprehension.
|
# ? Oct 28, 2011 16:58 |
|
Smugdog Millionaire posted:How do you write 100,000 lines of code in a single file before you think to yourself "surely there's a better way to organize this"? A former coworker of mine learned the hard way that VB6 can't load more than 65,534 lines of code in a single module. To give you an idea of how terrible the code was: whenever he received data with a deeper level of recursion than his program could support, he added another nested while loop to all of his functions.
|
# ? Oct 29, 2011 00:45 |
|
DaTroof posted:whenever he received data with a deeper level of recursion than his program could support, he added another nested while loop to all of his functions.
|
# ? Oct 29, 2011 02:10 |
|
DaTroof posted:A former coworker of mine learned the hard way that VB6 can't load more than 65,534 lines of code in a single module. To give you an idea of how terrible the code was: whenever he received data with a deeper level of recursion than his program could support, he added another nested while loop to all of his functions. I'm not really sure what is worse here: that you need to load that many lines, that they apparently used a 16 bits integer even though I'm pretty loving sure VB6 never ran on 16 bits platforms, or that the number of lines is 65,534 and not 65,535. EDIT: Actually I guess it would make sense that you'd code your for loop as < 65,535, so nevermind on that last one.
|
# ? Oct 29, 2011 02:38 |
|
VB supported 16-bit through 4.0 and I doubt it got a full rewrite when it went 32-bit only so some lingering 16-bitisms isn't surprising. Excel being limited to 65536 rows until 2007 is quite a bit worse.
|
# ? Oct 29, 2011 03:14 |
|
VB 4.0 was also the first version to support 32-bit (since there was no 32-bit Windows for previous versions to support).
|
# ? Oct 29, 2011 04:31 |
|
Plorkyeran posted:Excel being limited to 65536 rows until 2007 is quite a bit worse. 1) The Excel binary format has roots in classic MacOS. The 128k mac had a 32-bit processor, but at the time saving two bytes per cell index was pretty significant. 2) I vehemently believe that anyone who wants more than 65,536 rows in an Excel worksheet is a Bad Person in the same way as someone with 120,000 lines of code in a single file.
|
# ? Oct 29, 2011 04:47 |
|
Internet Janitor posted:2) I vehemently believe that anyone who wants more than 65,536 rows in an Excel worksheet is a Bad Person in the same way as someone with 120,000 lines of code in a single file.
|
# ? Oct 29, 2011 04:57 |
|
Happens a lot when you're an ME who does a lot of data logging with lovely tools that just save big CSV files and whose boss won't let you have matlab or anything nice Thank god that life is over.
|
# ? Oct 29, 2011 05:14 |
|
Just got another one of these today at work. code:
|
# ? Oct 29, 2011 06:03 |
|
YeOldeButchere posted:I'm not really sure what is worse here: that you need to load that many lines, that they apparently used a 16 bits integer even though I'm pretty loving sure VB6 never ran on 16 bits platforms, or that the number of lines is 65,534 and not 65,535. The VB limitations were unfortunate, but that guy's code was definitely the worst part of it. There was absolutely no excuse for that module to be more than 5000 or so lines of code. Copy/paste was his version of Maslow's hammer.
|
# ? Oct 29, 2011 06:10 |
|
fez2 posted:Just got another one of these today at work.
|
# ? Oct 29, 2011 13:54 |
|
Internet Janitor posted:2) I vehemently believe that anyone who wants more than 65,536 rows in an Excel worksheet is a Bad Person in the same way as someone with 120,000 lines of code in a single file. Er, should we just truncate our datasets if they get to big? (of course the real horror is trying to do anything on windows)
|
# ? Oct 29, 2011 14:18 |
|
Should we just truncate our source files if they get too big? Basically if you have a dataset that big you should be looking at different tools and approaches than Excel.
|
# ? Oct 29, 2011 14:22 |
|
Internet Janitor posted:Basically if you have a dataset that big you should be looking at different tools and approaches than Excel. Name one and why I should use it.
|
# ? Oct 29, 2011 14:25 |
|
|
# ? May 24, 2024 23:27 |
|
-Put your dataset in a database and use a query language to find out what you actually want to know. It will consume fewer system resources, be less likely to lock up for minutes at a time and your results will be repeatable. Even interactively, if you can search and filter data more quickly, you can extract more information from it. -Use a programming language meant for data processing. R, for example, can easily deal with millions of rows of data in a fraction the time and space Excel would require.
|
# ? Oct 29, 2011 14:36 |