- Feature Articles
- CodeSOD
- Error'd
- Forums
-
Other Articles
- Random Article
- Other Series
- Alex's Soapbox
- Announcements
- Best of…
- Best of Email
- Best of the Sidebar
- Bring Your Own Code
- Coded Smorgasbord
- Mandatory Fun Day
- Off Topic
- Representative Line
- News Roundup
- Editor's Soapbox
- Software on the Rocks
- Souvenir Potpourri
- Sponsor Post
- Tales from the Interview
- The Daily WTF: Live
- Virtudyne
Admin
F'ing Lot of Code?
Admin
In the mid-90s I had a job where the project's lead programmer told me to remove lengthy comment blocks from the tops of the .c and .h files... because they make the compile take longer. No shit. And he was serious.
Admin
vim file.javaisshit ^V[rape Page Down]sA^[ZZ
Done.
Admin
At least it zips nicely.
Admin
yaoçidugato
Admin
+1 for descriptive variable names.
Admin
Admin
I'm assuming it was an Atari 800 with 5 1/4 inch floppies capable of holding a grand total of 609 sectors of 125 usable bytes each. Given that it takes about a second to seek to the right cylinder, wait for the sector to come around, and read it, you could easily be talking an extra 20 seconds if you have a lot of comments.
Of course you also need to remember that it is going to take at least that long to open the same file in an editor, so you can clean it up, plus the time for writing the (now much shorter) file back out -- resulting in a fragmented disk -- plus some hopefully nontrivial reserve for programmer salary. So he's not going to break even on the first few compiles. But after that... the investment might start to pay off.
Admin
Admin
while(1) { printf("data dependency\n"); }
Is this sufficient amount? ;D
Admin
Admin
I'm guessing he modified the parameter value of FeedSearchTransactionLogResult() inside the function using call-by-reference, and couldn't understand why his for-loop didn't work right. Also, the real value of the parameter is probably not important or it's not used for any other purpose at all.
Admin
That's a tire mistake he made there...
Admin
You missed the a
Admin
I like this one. Did you generate it? With:
Admin
//Hey, folks complained that I didn't put enough comments in my CodeSODs. Hopefully I've addressed your complaints.
Actually you appear to be 676 lines short....
Admin
Admin
As for the poem, that was probably inserted by someone who'd taken so many arrows from incompetent managers that he needed an iron knee.
Admin
Admin
Or, more likely, threaded by requiring exclusive access to next.
Admin
The funny thing is that a loop would be faster.
Actually, you don't know that the .Add() changes any state at all on the basis of the information actually providedAdmin
FacePalm(); if (code.ExecuteJava().ParseSytaxError != null) code.ExecuteCSharp();
Admin
Ahem:
Admin
Admin
Admin
In C# (which I assume this is), int is a value type.
Admin
This could be fixed easily with just a little recursion.
Admin
NO...Assuming it was a Teletype feeding paper tape at 10 CPS, the time is MUCH Longer. A single 80 char line takes 10 second. 20 such lines would add over 3 minutes...
[And, yes, I have been doing this long enough to have worked in that environment, and STILL own working hardware from that era - circa 1971]
Admin
Damn, I cant do arithmetic today [cant type for S*%T either]... Regardless it was quite a slow process compared to anything "modern" but was quite amazingly fast compared to anything that ever existed before..
Admin
We also don't have to count up to 40 fullwidth Kanji or kana characters, and count mixtures, make sure that a backspace deletes an entire character not just half of one[*], not have any characters split half at the end of one line and half at the beginning of the next line, not have the "more" program screw up[**], etc. Lucky us. Except, of course, for some of us.
Well for those of us who don't own the hardware, we can still emulate it. Sigh.[ Linux I'm looking at you.] [ Windows I'm looking at you.] [ I'm pretty sure one or the other did still split a character on me in this decade.]
Admin
But you are right, of course. We shouldn't assume that just because the variable is of a type named after a sort of container and we are calling a method called 'Add' on it, we will actually modify any state at all. It might just be an elaborate way of allocating a lot of memory that will be released or not at the whim of the garbage collector, and setting next to 1000 (or 1001, or whatever). Or, indeed, it may just be that we will, by calling .Add all those times, try to remove 1000 (1001?) elements from it, unsuccessfully because we didn't previously add them using .Remove.
Admin
I think it might be exactly that. I would say it as tempramental in my Scottish accent so that might be the UK way to say it.
Admin
these are the WTF's that really wind me up as loops are so basic to programming
We need to know more about the co-worker, what was his/her background?
Admin
I was eating my sandwiches was inspired into writing random WTF-ish code. By trial and error , using recursion and Duff's device and a few other things.
I came up with this. Along with some not useful comments.
It manages to avoid the magic constant 1000.
Sorry.
Written in good ol' C
Admin
allDataSimulated.Add(new FeedSearchTransactionLogResult(profit++));
allDataSimulated.Add(new FeedSearchTransactionLogResult(profit++));
allDataSimulated.Add(new FeedSearchTransactionLogResult(profit++));
...profit.
Admin
Don't you mean:
Admin
In the first edition of Programming Pearls, Jon Bentley mentioned a similar case. His comment on it was that 'managers who pay by the line may feel free to faint now'.
He did go on to mention that in Ye Olden Days, this was very common in COBOL code. Why? Because COBOL programmers were taught to initialize tables once, and never change them, so using them like you would an array in FORTRAN was anathema to them.
The example remains in the 2nd edition of the book, but the comments on COBOL and fainting managers are now absent, presumably since both COBOL and pay-by-line are largely things of the past. Now if only this particular idiom were, as well...
Admin
Dear sirs, I hereby submit my rendition of your codes. Optimized for reusability. As you see, it implements a highly configurable iteration value.
bazinga!
Admin
Horrible nightmare...