[Koha-devel] Add rule for no subroutines in PL scripts

Barton Chittenden barton at bywatersolutions.com
Wed Sep 30 18:28:11 CEST 2015


On Wed, Sep 30, 2015 at 10:18 AM, Tomas Cohen Arazi <tomascohen at gmail.com>
wrote:

>
> 2015-09-30 9:20 GMT-03:00 Philippe Blouin <philippe.blouin at inlibro.com>:
>
>> Because the code would be extremely specific to a specific functionality,
>> whereas the code in the libraries is there to be reused.
>> And let not go overboard with OO.
>>
>
> 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.
>
>
>> A script is a script is a script.  Make it readable, add functions to
>> make it cleaner, make your functions readable.
>>
>
> 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".
>
> I think both should be testable.
>

I would like to make a plea here from a support / trouble-shooting
perspective:

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.

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.

--Barton
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20150930/9e755015/attachment.html>


More information about the Koha-devel mailing list