Single 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?)