[Boulder.pm] Academic vs Production Code

Ed Dow eddow1976 at yahoo.com
Thu Aug 23 14:01:27 PDT 2012


Walter -- very interesting thoughts on academic vs production code.  In some ways it seems like it should be opposite.  Academia should be a place where you strive to put in long hours and thought into your work.  The real world, the evil exists, production is where after looking and pondering over code which will be used once and thrown away (sometimes), seems more like a time for minimal effort and get back to the more important things like drinking or theology which ever comes first.   ;-) 


Rob -- I am intrigued with your thoughts on a program checking itself. I too am highly annoyed with canceling/reissuing credit cards.  That 10 day period kills me.  I have to actually go to the bank and get something called cash, something I vaguely remember talking about in economics class.  ;-)   However, how is the credit card analogy related to a program checking itself?  Are we talking about simple checks to make sure the correct answers are returned from a function?  Or something more involved?  


Ed


________________________________
 From: "boulder-pm-request at pm.org" <boulder-pm-request at pm.org>
To: boulder-pm at pm.org 
Sent: Thursday, August 23, 2012 1:00 PM
Subject: Boulder-pm Digest, Vol 39, Issue 13
 
Send Boulder-pm mailing list submissions to
    boulder-pm at pm.org

To subscribe or unsubscribe via the World Wide Web, visit
    http://mail.pm.org/mailman/listinfo/boulder-pm
or, via email, send a message with subject or body 'help' to
    boulder-pm-request at pm.org

You can reach the person managing the list at
    boulder-pm-owner at pm.org

When replying, please edit your Subject line so it is more specific
than "Re: Contents of Boulder-pm digest..."


Today's Topics:

   1. Re: Boulder-pm Digest, Vol 39, Issue 11 (Walter Pienciak)


----------------------------------------------------------------------

Message: 1
Date: Thu, 23 Aug 2012 12:07:39 -0600
From: Walter Pienciak <wpiencia at thunderdome.ieee.org>
To: Rob Nagler <nagler at bivio.biz>
Cc: boulder-pm at pm.org
Subject: Re: [Boulder.pm] Boulder-pm Digest, Vol 39, Issue 11
Message-ID: <20120823180738.GG1933 at thunderdome.ieee.org>
Content-Type: text/plain; charset=us-ascii

On Thu, Aug 23, 2012 at 11:52:59AM -0600, Rob Nagler wrote:
> > open MYSELF, '<', $0;
> > print while (<MYSELF>);
> 
> Since this is a perl list, and people have mentioned learning perl,  I
> have a comment about this style.  Walter has known me a long time so
> I'm sure he knows this is in the best interest of the programming
> public:
> 
> * Don't use <>.  It's an ambiguous operator, meaning glob and
> readline.  Searching for all instances of <bla> is almost impossible.
> You might as why would you ever do that?  Well, if you wanted to
> modularize access to the file system, because you now have to share
> state across multiple servers.
> 
> * Don't use implicit $_.  That's something that has bitten us more
> times than I can count.  If you do insist on using $_, make it
> explicit and do a local($_).  Avoid multiple calls when you can.  It's
> convenient to suck in lines and print them out, but that's extra
> parsing, calls, and doesn't describe what you are doing.  Use sysread
> and syswrite, because you don't need the buffering of stdio anyway.
> 
> * Check error codes, always.  If the program can't read itself, it
> should die.  You may say, "it's just a hack?"  Hmmmm... How many of
> you have had a credit card stolen?  Even though it is handled by the
> credit card company, it's a total hassle to not have that credit card
> for 10 days and/or have to update all your autopays to the new credit
> card.  Good code begins with the hacks, and works its way upward.
> 
> * Don't rely on file handles closing.  Do it explicitly. If you are
> relying on a stdio library (readline does), then check the return
> result of the close, because it may return an error.
> 
> Just my $.02.
> 
> Rob

All good points, Rob.

Rob and a few others have also heard me expound on academic
(produce the basic solution for the professor so you can get back
to drinking or whatever) versus production (evil exists) code.  

So -- disclaimer!!! (skull/crossbones and implications of dire
consequences) -- the possibility that I put minimal
effort/keystrokes into my solution(s) should not be discounted.

;^)

We were talking about books a bit ago.  Perl Cookbook and Perl
Best Practices (seems relevant to this thread) are the two I dip
into most often.

Walter


------------------------------

Subject: Digest Footer

_______________________________________________
Boulder-pm mailing list
Boulder-pm at pm.org
http://mail.pm.org/mailman/listinfo/boulder-pm

------------------------------

End of Boulder-pm Digest, Vol 39, Issue 13
******************************************
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.pm.org/pipermail/boulder-pm/attachments/20120823/59c4f8ae/attachment.html>


More information about the Boulder-pm mailing list