I always used to be skeptical of giving job candidates a take-home code test. The reason was that the assignment needed to be simple -- no in-demand developer would spend more than a few hours on it -- and even the most incompetent developer could surely throw together an elegant solution if he put enough hours into it. But leave it to Nikolay Simeonov(*) to show me the way. Following are some examples (warning: Delphi ahead) that job candidates turned after several days of working on a simple take-home assignment ...
One candidate demonstrating familiarity with code reuse of the copy/paste variety ...
procedure Tfrmobr.Edopolm3KeyPress(Sender: TObject; var Key: Char); begin if not (key in [#8,#44,#48..#57]) then key:=#0; if key=#46 then Key:=#44; if key=#44 then if pos(key,edopolm3.text)<>0 then key:=#0; end; procedure Tfrmobr.Edopolm4KeyPress(Sender: TObject; var Key: Char); begin if not (key in [#8,#44,#48..#57]) then key:=#0; if key=#46 then Key:=#44; if key=#44 then if pos(key,edopolm3.text)<>0 then key:=#0; end; ... snip ... procedure Tfrmobr.Edopolm23KeyPress(Sender: TObject; var Key: Char); begin if not (key in [#8,#44,#48..#57]) then key:=#0; if key=#46 then Key:=#44; if key=#44 then if pos(key,edopolm3.text)<>0 then key:=#0; end;
Another candidate who apparently never figured out what the equivalent of "dotting the i's and crossing the t's" is ...
panel20.visible:=false; panel19.Visible:=true; panel12.Visible:=false; panel11.Visible:=false; BUTTON1.Visible:=FALSE; panel10.Visible:=false; panel9.Visible:=false; panel8.Visible:=false; panel7.Visible:=true; panel6.Visible:=false; panel4.Visible:=false; panel5.Visible:=false;
Nikolay was trying to figure why one candidate turned in only this code file, when the assignment was a small app that demonstrated database connectivity in Delphi ...
/* ** hellowin.csx (C#) - example: axwscript hellowin.csx ** Demonstrates the use of Windows Forms to display a messagebox ** ** See also hello.csx */
And finally, another candidate demonstrating her extensive knowledge of the For-Case Paradigm ...
procedure TSelFrm.FormClose(Sender: TObject; var Action: TCloseAction); var i:byte; b:boolean; begin if selection then begin for i:=1 to 13 do begin if s1[i] then case i of 1,2,3,4,5,8,9,10,11:s1[i]:=s2[i]>0; 6:begin s2[i]:=strtoint(edit6.text); s1[i]:=s2[i]>0; end; 7:begin s2[i]:=strtoint(edit7.text); s1[i]:=(s2[i]>0)and(s2[12]>0); end; 12:begin s3[1]:=edit12.text; s1[i]:=length(s3[1])>0; end; 13:begin s3[2]:=edit13.text; s1[i]:=length(s3[2])>0; end; end; end; b:=false; for i:=1 to 13 do b:=b or s1[i]; selection:=b; end; savef(selfrm); end;
(*) Some fun past submissions from Nikolay:
- The Hotel (reservation system) From Hell (Part II)
- The Meteorological Station In Hell
- Loonily Coupled