Positive reinforcement

brian_d_foy on 2002-09-26T22:30:19

Ever think about your interactions with most computer programs? It is all negative. Error this, seg fault that, core this other thing. What happens when something succeeds in Unix? You get nothing, literally. Zero is the result of successful execution. You get something when things do not work. If cat fails, you get 1, or 2, or something. If you do your job well, the computer does not even notice. Flowers on your birthday? Forget about it. What are you if you can run programs? You are a big, fat Zero.

What if programs rewarded success? It is fine that perl tells me 'syntax OK', but that sounds like a civil servant telling me that I have finally filled out the right forms in the right order before he decides to think about something else for a bit. No "Congratulations" or "you++". No "Good show, old chap." or "Tally ho!".

Well, it is time for that to change, and I start with podchecker.

diff `which podchecker` ~/bin/podchecker
132a133,137
>     elsif($s == 0) {
>       $status = 0;
>       my @adj = qw(awesome cool 3L33t worthy);
>       print "$_: No errors! You are " . $adj[ rand @adj ] . "!\n";
>     }


I ran this on my ISBN module and was instantly, positively reinforced and edified.

localhost_brian[3125]$ perl ~/bin/podchecker ISBN.pm
ISBN.pm pod syntax OK.
ISBN.pm: No errors! You are worthy!


If I can get Hugo really drunk sometime, maybe he will add this to `perl -c`.

% perl -c my_script.pl
my_script.pl syntax OK
brian d foy, you have successfully compiled your Perl script.
You have shown yourself to be worthy.  Your program may join 
the ranks of Compileable Programs and enjoy all the benefits 
thereof. This is a truly auspicious event. Good luck and 
godspeed.


From there I only need a small step to persistent encouragement.

% perl my_script.pl
my_script.pl syntax OK
Congratulations!  This is the 100th program that you have
successfully compiled, which puts you in the top 15 percent
of all perl programmers.  Plover Systems is already
printing your Perl Certification and mailing it to  your 
home address which .Net gave to us.


If I want to track workplace safety, I change the message:

% perl my_script.pl
my_script.pl syntax OK
This is the 5th program you have compiled without errors
since the last script failure. The last program with 
errors did not compile 3 days ago.  You need to compile 
twelve more programs without errors to meet department 
targets for this period.  The Java team is 60 points
behind your team.  You will get a $200 bonus, a free pizza
and a half-day off if you stay ahead of all other
departments. Good luck and may the force be with you.