3 ms·
I'll second this. One grad student friend of mine traded me a case of beer for a Saturday of help on his code. It was some code to record spike timings in the
by Balgair 7y ago
I'll second this.
One grad student friend of mine traded me a case of beer for a Saturday of help on his code. It was some code to record spike timings in the olfactory cortex and also control valves (smelly research).
By the 12th nested for-loop, I gave him back the beer.
- stared 7y agoNested 12 loops, is this part of not-so-smart code. Less code-golf, more hackathon-style "one more copy-paste and it should work". It has some use cases, just readability or maintainability are not among these.
- hinkley 7y agoI was helping a guy with some text-based game he was working on that had some pretty clever bits of code for constructing scene description text. The problem was that once in a while you'd just get some garbled text on the screen. Eventually I figured out why: Some of the sentence fragments were malloc'ed, others were returned from the stack. Once the description got over a certain number of bytes he was smashing his own stack. I say 'his' but the problem was introduced by an earlier collaborator. Buddy, I really want to help you with this but I (much younger me) am not up for unwinding a use-after-free bug of this level of recursion. Good luck, I'm out.
- hinkley 7y agoI thought this story was going to end with you consuming the beer on the spot. On several occasions, and with lesser crimes, I've told the person something like "I think you are confusing yourself with your own code. I want you to change to meaningful variable names (stop recycling variables) and factor out a couple of child functions here, and here. If you still can't see the problem, come get me and we'll try this again."
- Balgair 7y ago> I thought this story was going to end with you consuming the beer on the spot. Haha, no way. Grad students are poor as is. Drinking a month's beer budget in front of the guy would be bad, leaving him with that code was cruel enough.