<html><body><div style="color:#000; background-color:#fff; font-family:times new roman, new york, times, serif;font-size:12pt"><div><span>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.   ;-) <br></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color: transparent; font-style: normal;"><br><span></span></div><div style="color: rgb(0, 0, 0); font-size: 16px; font-family: times new roman,new york,times,serif; background-color:
 transparent; font-style: normal;"><span>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?  <br></span></div><div><br></div><div>Ed<br></div>  <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div style="font-family: times new roman, new york, times, serif; font-size: 12pt;"> <div dir="ltr"> <font face="Arial" size="2"> <hr size="1">  <b><span style="font-weight:bold;">From:</span></b> "boulder-pm-request@pm.org"
 <boulder-pm-request@pm.org><br> <b><span style="font-weight: bold;">To:</span></b> boulder-pm@pm.org <br> <b><span style="font-weight: bold;">Sent:</span></b> Thursday, August 23, 2012 1:00 PM<br> <b><span style="font-weight: bold;">Subject:</span></b> Boulder-pm Digest, Vol 39, Issue 13<br> </font> </div> <br>
Send Boulder-pm mailing list submissions to<br>    <a ymailto="mailto:boulder-pm@pm.org" href="mailto:boulder-pm@pm.org">boulder-pm@pm.org</a><br><br>To subscribe or unsubscribe via the World Wide Web, visit<br>    http://mail.pm.org/mailman/listinfo/boulder-pm<br>or, via email, send a message with subject or body 'help' to<br>    <a ymailto="mailto:boulder-pm-request@pm.org" href="mailto:boulder-pm-request@pm.org">boulder-pm-request@pm.org</a><br><br>You can reach the person managing the list at<br>    <a ymailto="mailto:boulder-pm-owner@pm.org" href="mailto:boulder-pm-owner@pm.org">boulder-pm-owner@pm.org</a><br><br>When replying, please edit your Subject line so it is more specific<br>than "Re: Contents of Boulder-pm digest..."<br><br><br>Today's Topics:<br><br>   1. Re: Boulder-pm Digest, Vol 39, Issue 11 (Walter
 Pienciak)<br><br><br>----------------------------------------------------------------------<br><br>Message: 1<br>Date: Thu, 23 Aug 2012 12:07:39 -0600<br>From: Walter Pienciak <<a ymailto="mailto:wpiencia@thunderdome.ieee.org" href="mailto:wpiencia@thunderdome.ieee.org">wpiencia@thunderdome.ieee.org</a>><br>To: Rob Nagler <<a ymailto="mailto:nagler@bivio.biz" href="mailto:nagler@bivio.biz">nagler@bivio.biz</a>><br>Cc: <a ymailto="mailto:boulder-pm@pm.org" href="mailto:boulder-pm@pm.org">boulder-pm@pm.org</a><br>Subject: Re: [<a target="_blank" href="http://boulder.pm/">Boulder.pm</a>] Boulder-pm Digest, Vol 39, Issue 11<br>Message-ID: <<a ymailto="mailto:20120823180738.GG1933@thunderdome.ieee.org" href="mailto:20120823180738.GG1933@thunderdome.ieee.org">20120823180738.GG1933@thunderdome.ieee.org</a>><br>Content-Type: text/plain; charset=us-ascii<br><br>On Thu, Aug 23, 2012 at 11:52:59AM -0600, Rob Nagler wrote:<br>> > open
 MYSELF, '<', $0;<br>> > print while (<MYSELF>);<br>> <br>> Since this is a perl list, and people have mentioned learning perl,  I<br>> have a comment about this style.  Walter has known me a long time so<br>> I'm sure he knows this is in the best interest of the programming<br>> public:<br>> <br>> * Don't use <>.  It's an ambiguous operator, meaning glob and<br>> readline.  Searching for all instances of <bla> is almost impossible.<br>> You might as why would you ever do that?  Well, if you wanted to<br>> modularize access to the file system, because you now have to share<br>> state across multiple servers.<br>> <br>> * Don't use implicit $_.  That's something that has bitten us more<br>> times than I can count.  If you do insist on using $_, make it<br>> explicit and do a local($_).  Avoid multiple calls when you can.  It's<br>>
 convenient to suck in lines and print them out, but that's extra<br>> parsing, calls, and doesn't describe what you are doing.  Use sysread<br>> and syswrite, because you don't need the buffering of stdio anyway.<br>> <br>> * Check error codes, always.  If the program can't read itself, it<br>> should die.  You may say, "it's just a hack?"  Hmmmm... How many of<br>> you have had a credit card stolen?  Even though it is handled by the<br>> credit card company, it's a total hassle to not have that credit card<br>> for 10 days and/or have to update all your autopays to the new credit<br>> card.  Good code begins with the hacks, and works its way upward.<br>> <br>> * Don't rely on file handles closing.  Do it explicitly. If you are<br>> relying on a stdio library (readline does), then check the return<br>> result of the close, because it may return an error.<br>> <br>> Just my
 $.02.<br>> <br>> Rob<br><br>All good points, Rob.<br><br>Rob and a few others have also heard me expound on academic<br>(produce the basic solution for the professor so you can get back<br>to drinking or whatever) versus production (evil exists) code.  <br><br>So -- disclaimer!!! (skull/crossbones and implications of dire<br>consequences) -- the possibility that I put minimal<br>effort/keystrokes into my solution(s) should not be discounted.<br><br>;^)<br><br>We were talking about books a bit ago.  Perl Cookbook and Perl<br>Best Practices (seems relevant to this thread) are the two I dip<br>into most often.<br><br>Walter<br><br><br>------------------------------<br><br>Subject: Digest Footer<br><br>_______________________________________________<br>Boulder-pm mailing list<br><a ymailto="mailto:Boulder-pm@pm.org" href="mailto:Boulder-pm@pm.org">Boulder-pm@pm.org</a><br><a href="http://mail.pm.org/mailman/listinfo/boulder-pm"
 target="_blank">http://mail.pm.org/mailman/listinfo/boulder-pm</a><br><br>------------------------------<br><br>End of Boulder-pm Digest, Vol 39, Issue 13<br>******************************************<br><br><br> </div> </div>  </div></body></html>