<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Wed, Sep 30, 2015 at 10:18 AM, Tomas Cohen Arazi <span dir="ltr"><<a href="mailto:tomascohen@gmail.com" target="_blank">tomascohen@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="ltr"><div class="gmail_extra"><br><div class="gmail_quote"><span class="">2015-09-30 9:20 GMT-03:00 Philippe Blouin <span dir="ltr"><<a href="mailto:philippe.blouin@inlibro.com" target="_blank">philippe.blouin@inlibro.com</a>></span>:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    <div>Because the code would be extremely
      specific to a specific functionality, whereas the code in the
      libraries is there to be reused.<br>
      And let not go overboard with OO.<br></div></div></blockquote><div><br></div></span><div>We embrace the OO paradigm for most of the CRUD operations, but we also have libs containing functions that are used statically, like Koha::Util::MARC, that do specific things and are testable. And is only used in a couple places.</div><span class=""><div> </div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div bgcolor="#FFFFFF" text="#000000"><div>
      A script is a script is a script.  Make it readable, add functions
      to make it cleaner, make your functions readable.<br></div></div></blockquote><div><br></div></span><div>We have two main kind of scripts: command line scripts, and controller scripts that got too complicated during Koha's life, and we are trying to simplify "as we go".</div><div><br></div><div>I think both should be testable.</div></div></div></div></blockquote><div><br></div><div>I would like to make a plea here from a support / trouble-shooting perspective:</div><div><br></div><div>The controller scripts are hard to trouble-shoot, because they're CGI -- it's theoretically possible to run the perl debugger across them, but that requires a fair amount of mucking with the environment... If I'm trying to figure out what's happening with some chunk of code, I'd like to write a command line wrapper around a library, and trigger the bits that I want in a controlled manner. I can't do that with any of the code inside the controllers.</div><div><br></div><div>Keeping the code in the controllers thin is important not only for test-ability from a unit testing perspective, but also from a trouble-shooting perspective, because they end up being black-boxes that only run inside of Apache.</div><div><br></div><div>--Barton</div></div></div></div>