6 ms·
About half the bugs I've seen were caused either by poor variable naming or single entry/single exit violations I honestly can't remember seeing a bug caused b
by mynameishere 19y ago
About half the bugs I've seen were caused either by poor variable naming or single entry/single exit violations
I honestly can't remember seeing a bug caused by either. Sorry. Obviously, experiences vary quite a bit in this respect. From what I've seen, the most common causes of bugs are:
1. Off-by-one errors.
2. Platform incompatibility.
3. Allocation issues (C/C++)
4. Shared state problems.
5. Not releasing/closing resources.
Function returns? Variable names? They just don't figure.
- edw519 19y agoSingle entry/single exit refers to ANY process, not just functions. Don't underestimate the hell who can go through with poor variable naming. Case in point: 2 months ago, a client needed significant changes to a major process in their app. (I had 2 weeks.) This process was a BASIC subroutine called by 16 other processes. Now get this: It was 2800 lines of code with one entry and 16 different exits. It was written in 1991 and had been modified 68 times before I came along. Here are a few of the variables: A, AA, AAA, AAAA, B, BB, BBB, BBBB, C, CC, CCC, CCCC, INFO, FORM1, FORM2, FORM3, HOLD.FORM2, OLD.FORM2, ORIG.FORM2, STUFF, DUMMY1, DUMMY2, DUMMY3... You get the idea. I spent 4 days renaming variables before I could start refactoring. There were some variables I never did figure out. I rewrote the program (550 lines) and hit the deadline. I uncovered over 20 undocumented bugs. I wonder what it will look like 5 years from now. Everything I write new is either Javascript or PHP. Now that my startup is ramping up, soon I won't have to deal with any of this old stuff any more. (Aside: I wonder how much production code in the world today is over 10 years old. And how much has been modified over 10 times?)