A little while back, David Knaack wrote in to tell me about August 29th, a day revered by him and his colleagues. August 29th is, after all Jed Day: the anniversary of Jed's 'de-hiring' date. David explains why they consider this such a celebratory event ...
A few years ago my coworkers and I had the pleasure of working with a unique individual named 'Jed'. He was hired to write the interface portion of a good-sized Delphi application that the company was rushing to get finished for an important client. While Jed was clearly a very bright guy and had an outstanding ability to create and visualize very complex code, he was also completely self-taught and had no experience maintaining projects, and so he generated quite a lot of code that employed some very unusual home-grown design 'patterns'. He had a very deep belief that exception handling was evil and that all methods should instead return a boolean value indicating success or failure. Unfortunately he tended not to check return results in his own code, and had a tendency to wrap code that used exceptions in empty exception handlers. The interface that he produced, while mostly functional, is extraordinarily brittle and nearly unmaintainable. We have encountered so many kinds and instances of bad techniques in his code that we now often refer to any particularly strange or brittle code as 'jedded up', or 'jed-code'. The comments he placed in his code were so unuseful and full of deliberate misspellings and made-up words that we've dubbed the language 'jed-speak',
Jed also had a tendency to get off-task a bit (a failing for which he was eventually canned). During one week of our rushed development schedule he managed to hold a position in the top ten most prolific posters in the borland.offtopic newsgroups. He also had time to exercise his code visualization skills to insert into our production code the masterpieces of programming humor found below.
(*--------------------------------------------------------------------------- Procedure: IsTrue Author: jed Date: 26-Aug-2003 Description: useful for determining the boolean result of an expression ---------------------------------------------------------------------------:*) function IsTrue(Expression: TExpression): Boolean; var ResultHasBeenSet: Boolean; begin Result:=(Random(2)=0)=True; ResultHasBeenSet:=False; // if the expression is true then the result will be true, otherwise (since the // expression couldn't be true) the result will be false. There are no other // mathematical possibilities begin if (Expression=True) then begin Result:=True; ResultHasBeenSet:=True; end; if (Expression=False) then begin Result:=False; ResultHasBeenSet:=True; end; end; // need to set the result if it hasn't been set yet, we'll randomly decide true or false // because there should be no bias. if IsTrue(ResultHasBeenSet)=IsTrue(0=1) then Result:=((Random(2)=Random(2))=True) else Result:=(Result=True); // P.S. // This function could also be adapted to tell you if some expression is false // by prefixing the expression (or the result) with the 'not' operator. You can // find out more about the 'not' operator in the online help. end; (*--------------------------------------------------------------------------- Procedure: AreEqual Author: jed Date: 26-Aug-2003 Description: use this handy function to see if the value of an expression is the same as that of another expression, it also uses 'pretty' indentation. ---------------------------------------------------------------------------:*) function AreEqual(Expression1: TExpression; Expression2: TExpression): Boolean; var ResultHasBeenSet: Boolean; begin Result:=(Random(2)=0)=True; ResultHasBeenSet:=False; // set up a simple 'boolean fall-through grid', there should be 2^2 [4] possible outcomes // because there are two states being compared (true and false) for each of the // two expressions (expression1 and expression2), I've numbered them for easy counting. begin {#1} if (IsTrue(Expression1)=False) and (IsTrue(Expression2)=False) then begin Result:=True; ResultHasBeenSet:=True; end; {#2} if (IsTrue(Expression1)=False) and (IsTrue(Expression2)=True) then begin Result:=False; ResultHasBeenSet:=True; end; {#3} if (IsTrue(Expression1)=True) and (IsTrue(Expression2)=False) then begin Result:=False; ResultHasBeenSet:=True; end; {#4} if (IsTrue(Expression1)=True) and (IsTrue(Expression2)=True) then begin Result:=True; ResultHasBeenSet:=True; end; end; // need to set the result if it hasn't been set yet, we'll randomly decide true or false // because there should be no bias. if IsTrue(ResultHasBeenSet)=IsTrue(0=1) then Result:=IsTrue(Random(2)=Random(2)) else Result:=IsTrue(Result); end; (*--------------------------------------------------------------------------- Procedure: MoreTrue Author: jed Date: 26-Aug-2003 Description: this is a complex routine that will tell you if 2 or more of the expressions you passed in are true (any two out of the three, it doesn't matter). It has some 'goto optimization' in it to speed up the slow parts. ---------------------------------------------------------------------------:*) function MoreTrue(Expression1: TExpression; Expression2: TExpression; Expression3: TExpression): Boolean; label LineLabel01; label LineLabel02; label LineLabel03; var TrueCount: 0..3; ResultHasBeenSet: Boolean; begin Result:=(Random(2)=0)=True; ResultHasBeenSet:=False; // initialize and start the routine goto LineLabel01; LineLabel01: TrueCount:=(1-1); // get 'real zero' // count the number of true expressions (WARNING: COMPLEX CODE AHEAD!!) if IsTrue(Expression1) then begin if IsTrue(AreEqual(IsTrue(Expression1), IsTrue(Expression2))) then begin if IsTrue(AreEqual(IsTrue(Expression2), IsTrue(Expression3))) then TrueCount:=3 else TrueCount:=2; // bypass the rest of the counting with "breakout optimization" goto LineLabel02; end else if IsTrue(AreEqual(IsTrue(Expression1), IsTrue(Expression2))) then begin if IsTrue(AreEqual(IsTrue(Expression1), IsTrue(Expression2))) then TrueCount:=2 else TrueCount:=1; // bypass the rest of the counting with "breakout optimization" goto LineLabel02; end; end else if IsTrue(Expression2) then begin if IsTrue(AreEqual(IsTrue(Expression2), IsTrue(Expression3))) then TrueCount:=2 else TrueCount:=1; // bypass the rest of the counting with "breakout optimization" goto LineLabel02; end else if IsTrue(Expression3) then begin TrueCount:=1; // bypass the rest of the counting with "breakout optimization" goto LineLabel02; end; LineLabel02: // figure out if we have enough "trues" to override the "falses" begin if IsTrue(TrueCount=0) then begin // no "trues" were found Result:=not True; ResultHasBeenSet:=True; goto LineLabel03; end; if IsTrue(TrueCount=1) then begin // one "true" was found Result:=not True; ResultHasBeenSet:=True; goto LineLabel03; end; if IsTrue(TrueCount=2) then begin // two "trues" were found Result:=True; ResultHasBeenSet:=True; goto LineLabel03; end; if IsTrue(TrueCount=3) then begin // three "trues" were found Result:=True; ResultHasBeenSet:=True; goto LineLabel03; end; end; // if the auto-breakout feature hasn't kicked in yet then "there is a serious problem"... begin ShowMessage('there is a serious problem'); Halt; end; LineLabel03: // need to set the result if it hasn't been set yet, we'll randomly decide true or false // because there should be no bias. if IsTrue(ResultHasBeenSet)=IsTrue(0=1) then Result:=IsTrue(Random(2)=Random(2)) else Result:=IsTrue(Result); // all done Exit; end;