{"id":107,"date":"2005-12-21T09:35:00","date_gmt":"2005-12-21T09:35:00","guid":{"rendered":"http:\/\/adam.rosi-kessel.org\/weblog\/free_software\/code\/doing_it_right.html"},"modified":"-0001-11-30T00:00:00","modified_gmt":"1970-01-01T05:00:00","slug":"doing_it_right","status":"publish","type":"post","link":"http:\/\/adam.rosi-kessel.org\/weblog\/2005\/12\/21\/doing_it_right","title":{"rendered":"Doing It Right: BabyOp, Perl, and OOP?"},"content":{"rendered":"<p> <img decoding=\"async\" src=\"http:\/\/images.rosi-kessel.org\/babyop.png\" class=\"insetright\" \/> I&#8217;m coding a new CGI application, tentatively entitled BabyOp. It is software to run a babysitting coop; I suppose it is a species of &#8220;social software.&#8221; The idea is to be able to track hours credits, schedule babysitting times, centralize contact information and other details about babysitting requirements. <\/p>\n<p> I considered using something like <a href='http:\/\/www.zope.org\/' title='Zopeorg'>Zope<\/a> or <a href='http:\/\/drupal.org\/' title='drupalorg Community plumbing'>Drupal<\/a> for the application, but I&#8217;ve never liked developing exclusively through a web-interface and found myself having to do a fair bit of &#8220;actual&#8221; coding to get the results I wanted. I realize there is a <a href=\"http:\/\/packages.debian.org\/unstable\/web\/zope-zshell\">command-line interface for Zope<\/a>, but it&#8217;s really pretty limited. I had some plans a couple of years ago when I designed my wedding site in Zope to extend it to be more useful, but sadly never got around to it. <\/p>\n<p> So I&#8217;m back in my comfort zone, <a href='http:\/\/www.perl.com\/' title='Perlcom The Source for Perl -- perl development perl conferences'>perl<\/a>. I&#8217;ve written a fair amount of unmanageable perl code, however, <a href=\"http:\/\/adam.rosi-kessel.org\/weblog\/free_software\/code\/cooporder.html\">CoopOrder<\/a> probably being a shining example (it was also my first perl program). I&#8217;ve certainly improved since then, and the fact that I&#8217;ve received several patches from others for <a href=\"http:\/\/adam.rosi-kessel.org\/weblog\/free_software\/code\/randomplay.html\">randomplay<\/a> suggests that my coding style is getting to a half-decent point. <\/p>\n<p> I&#8217;d really like to get it right this time, though. One thing I&#8217;ve learned over the years is always to look for a module to do what you want before setting out to do it yourself, since chances are the module writer is a better coder than you (or at least, than me!). To that end, I&#8217;m using <a href=\"http:\/\/search.cpan.org\/dist\/CGI-Application\/\">CGI::Application<\/a>, <a href=\"http:\/\/html-template.sourceforge.net\/\">HTML::Template<\/a>, and <a href=\"http:\/\/search.cpan.org\/dist\/DBIx-Abstract\/\">DBIx::Abstract<\/a>, among others. I&#8217;m also trying to keep things really granular and avoiding long subroutines. Certainly taking the HTML out of the perl code helps with that. I&#8217;m amazed at how often my code now just &#8220;works&#8221; on the first try, similar to <a href=\"http:\/\/www.linuxjournal.com\/article\/3882\">esr&#8217;s story about his first look at Python<\/a> (&#8220;Brace yourself: this code only took me about ninety minutes to write&#8212;and it worked correctly <em>the first time I ran it.<\/em>&#8221;) <\/p>\n<p> I&#8217;m trying to figure out if it would be sensible to make this application more fully object oriented. Growing up in the &#8217;70s and &#8217;80s and having done a lot of database programming, I&#8217;ve always been unfortunately pathologically declarative. (My first major package was in <a href=\"http:\/\/www.thocp.net\/software\/languages\/clipper.htm\">Clipper<\/a>&#8212;I was 13 years old). I find it a lot easier to modify a pre-existing object oriented package than to design my own. <\/p>\n<p> But then again, does it really make sense to attempt an object-oriented design where there is really only one important &#8220;object&#8221; &#8212; in this case, the babysitting unit? <\/p>\n","protected":false},"excerpt":{"rendered":"<p>I&#8217;m coding a new CGI application, tentatively entitled BabyOp. It is software to run a babysitting coop; I suppose it is a species of &#8220;social software.&#8221; The idea is to be able to track hours credits, schedule babysitting times, centralize contact information and other details about babysitting requirements. I considered using something like Zope or [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[17],"tags":[],"_links":{"self":[{"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/posts\/107"}],"collection":[{"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/comments?post=107"}],"version-history":[{"count":0,"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/posts\/107\/revisions"}],"wp:attachment":[{"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/media?parent=107"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/categories?post=107"},{"taxonomy":"post_tag","embeddable":true,"href":"http:\/\/adam.rosi-kessel.org\/weblog\/wp-json\/wp\/v2\/tags?post=107"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}