<html>
  <head>
    <meta content="text/html; charset=utf-8" http-equiv="Content-Type">
  </head>
  <body bgcolor="#FFFFFF" text="#000000">
    <div class="moz-cite-prefix">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>
      <br>
      A script is a script is a script.  Make it readable, add functions
      to make it cleaner, make your functions readable.<br>
      <br>
      And make some rule for forbidding direct DB accesses, so that
      future DB changes do not require to change many scripts.<br>
      But please, do not forbid functions in scripts.<br>
      <br>
      As for tests, writing them for very complicated, very very
      specific function only applicable to a script could have value,
      but it certainly does not balance the extra complexity your
      bringing to the code.<br>
      <br>
      <div class="moz-signature">
        <style type="text/css">
.moz-signature {
 color: #FFFFFF;
}
.sig_inlibro {
 padding-top : 2px;
 color: #888888;
 font-family : "Trebuchet MS", verdana;
 font-size: 90%;
}
.sig_content {
 border-top: 2px solid #DDDDDD;
 border-bottom: 2px solid #BFD13D;
 background-color : #F6F6F6;
 padding-left:10px;
}
.sig_inlibro a:visited, .sig_inlibro a:hover, .sig_inlibro a:link {
 text-decoration: none;
 color: #005B85;
}
.nom {
 color: #005B85;
 font-weight : bold;
}
.inlibro, .in {
 color: #BFD13D;
}
.libro {
 color: #005B85;
}
.in, .libro {
 font-size : 120%;
}
.desc {
    margin-bottom: 0;
    padding-bottom: 5px;
}
.small {
 font-size: 80%;
}
.tagline {
 color : #00BCE4;
}
.sig_footer {
 padding-left : 10px;
 background-color : #EEEFEA;
}
</style>
        <div class="sig_inlibro">
          <div class="sig_content"> <span class="nom">Philippe Blouin,</span><br>
            <span class="tagline small">Responsable du développement
              informatique</span><br>
            <p class="desc small"> Tél.  : (888) 604-2627<br>
              <a href="mailto:philippe.blouin@inLibro.com">philippe.blouin@inLibro.com</a>
            </p>
          </div>
          <div class="sig_footer"> <span class="in">in</span><span
              class="libro">Libro</span> <span class="tagline small">|
              pour esprit libre |</span> <a class="small"
              href="http://www.inLibro.com">www.inLibro.com</a> </div>
        </div>
      </div>
      On 09/29/2015 07:35 PM, David Cook wrote:<br>
    </div>
    <blockquote
      cite="mid:002a01d0fb0f$85ba3a80$912eaf80$@prosentient.com.au"
      type="cite">
      <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
      <meta name="Generator" content="Microsoft Word 15 (filtered
        medium)">
      <style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:"Trebuchet MS";
        panose-1:2 11 6 3 2 2 2 2 2 4;}
@font-face
        {font-family:"Segoe UI Symbol";
        panose-1:2 11 5 2 4 2 4 2 2 3;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
p.moz-signature, li.moz-signature, div.moz-signature
        {mso-style-name:moz-signature;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:white;}
p.siginlibro, li.siginlibro, div.siginlibro
        {mso-style-name:sig_inlibro;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:11.0pt;
        font-family:"Trebuchet MS",sans-serif;
        color:#888888;}
p.sigcontent, li.sigcontent, div.sigcontent
        {mso-style-name:sig_content;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        background:#F6F6F6;
        border:none;
        padding:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
p.nom, li.nom, div.nom
        {mso-style-name:nom;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:#005B85;
        font-weight:bold;}
p.inlibro, li.inlibro, div.inlibro
        {mso-style-name:inlibro;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:#BFD13D;}
p.in, li.in, div.in
        {mso-style-name:in;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:14.5pt;
        font-family:"Times New Roman",serif;
        color:#BFD13D;}
p.libro, li.libro, div.libro
        {mso-style-name:libro;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:14.5pt;
        font-family:"Times New Roman",serif;
        color:#005B85;}
p.desc, li.desc, div.desc
        {mso-style-name:desc;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        margin-bottom:0cm;
        margin-left:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
p.small, li.small, div.small
        {mso-style-name:small;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:9.5pt;
        font-family:"Times New Roman",serif;
        color:black;}
p.tagline, li.tagline, div.tagline
        {mso-style-name:tagline;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:#00BCE4;}
p.sigfooter, li.sigfooter, div.sigfooter
        {mso-style-name:sig_footer;
        mso-margin-top-alt:auto;
        margin-right:0cm;
        mso-margin-bottom-alt:auto;
        margin-left:0cm;
        background:#EEEFEA;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;
        color:black;}
span.nom1
        {mso-style-name:nom1;
        color:#005B85;
        font-weight:bold;}
span.tagline1
        {mso-style-name:tagline1;
        color:#00BCE4;}
span.in1
        {mso-style-name:in1;
        color:#BFD13D;}
span.libro1
        {mso-style-name:libro1;
        color:#005B85;}
span.EmailStyle32
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
      <div class="WordSection1">
        <p class="MsoNormal"><a moz-do-not-send="true"
            name="_MailEndCompose"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US">Philippe,
              could you explain how it’s more messy to have code in
              modules? <o:p></o:p></span></a></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US">Generally
            speaking, I can’t think of a reason why there would be code
            that is extremely specific to some script. I think the
            preference these days is to use object oriented code, which
            does isolate mess, so the code should be in the class. <o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US">As
            Tomas points out, it also makes it more difficult to write
            unit tests for functions, if it’s isolated in a script with
            no other way of calling that code.<o:p></o:p></span></p>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">David
              Cook<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">Systems
              Librarian<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">Prosentient
              Systems<o:p></o:p></span></p>
          <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext">72/330
              Wattle St, Ultimo, NSW 2007<o:p></o:p></span></p>
        </div>
        <p class="MsoNormal"><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext;mso-fareast-language:EN-US"><o:p> </o:p></span></p>
        <div style="border:none;border-left:solid blue 1.5pt;padding:0cm
          0cm 0cm 4.0pt">
          <div>
            <div style="border:none;border-top:solid #E1E1E1
              1.0pt;padding:3.0pt 0cm 0cm 0cm">
              <p class="MsoNormal"><b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"
                    lang="EN-US">From:</span></b><span
style="font-size:11.0pt;font-family:"Calibri",sans-serif;color:windowtext"
                  lang="EN-US"> Philippe Blouin
                  [<a class="moz-txt-link-freetext" href="mailto:philippe.blouin@inlibro.com">mailto:philippe.blouin@inlibro.com</a>] <br>
                  <b>Sent:</b> Wednesday, 30 September 2015 12:52 AM<br>
                  <b>To:</b> Tomas Cohen Arazi
                  <a class="moz-txt-link-rfc2396E" href="mailto:tomascohen@gmail.com"><tomascohen@gmail.com></a><br>
                  <b>Cc:</b> David Cook
                  <a class="moz-txt-link-rfc2396E" href="mailto:dcook@prosentient.com.au"><dcook@prosentient.com.au></a>;
                  <a class="moz-txt-link-abbreviated" href="mailto:koha-devel@lists.koha-community.org">koha-devel@lists.koha-community.org</a><br>
                  <b>Subject:</b> Re: [Koha-devel] Add rule for no
                  subroutines in PL scripts<o:p></o:p></span></p>
            </div>
          </div>
          <p class="MsoNormal"><o:p> </o:p></p>
          <div>
            <p class="MsoNormal" style="margin-bottom:12.0pt">The
              alternative would be to add some code extremely specific
              to some script (like parsing some line of data) into a
              Koha/ library?  Seems more messy.<br>
              <br>
              I like to isolate my mess.<o:p></o:p></p>
            <div>
              <div>
                <div style="border-top:solid #DDDDDD
                  1.5pt;border-left:none;border-bottom:solid #BFD13D
                  1.5pt;border-right:none;padding:0cm 0cm 0cm 0cm">
                  <p class="MsoNormal" style="background:#F6F6F6"><span
                      class="nom1"><span
                        style="font-size:11.0pt;font-family:"Trebuchet
                        MS",sans-serif">Philippe Blouin,</span></span><span
                      style="font-size:11.0pt;font-family:"Trebuchet
                      MS",sans-serif;color:#888888"><br>
                    </span><span class="tagline1"><span
                        style="font-size:11.0pt;font-family:"Trebuchet
                        MS",sans-serif">Responsable du
                        développement informatique</span></span><span
                      style="font-size:11.0pt;font-family:"Trebuchet
                      MS",sans-serif;color:#888888"><o:p></o:p></span></p>
                  <p class="desc" style="background:#F6F6F6"><span
                      style="font-size:11.0pt;font-family:"Trebuchet
                      MS",sans-serif;color:#888888">Tél.  : (888)
                      604-2627<br>
                      <a moz-do-not-send="true"
                        href="mailto:philippe.blouin@inLibro.com"><span
                          style="color:#005B85;text-decoration:none">philippe.blouin@inLibro.com</span></a>
                      <o:p></o:p></span></p>
                </div>
                <div>
                  <p class="MsoNormal" style="background:#EEEFEA"><span
                      class="in1"><span
                        style="font-size:13.0pt;font-family:"Trebuchet
                        MS",sans-serif">in</span></span><span
                      class="libro1"><span
                        style="font-size:13.0pt;font-family:"Trebuchet
                        MS",sans-serif">Libro</span></span><span
                      style="font-size:11.0pt;font-family:"Trebuchet
                      MS",sans-serif;color:#888888"> </span><span
                      class="tagline1"><span
                        style="font-size:11.0pt;font-family:"Trebuchet
                        MS",sans-serif">| pour esprit libre |</span></span><span
                      style="font-size:11.0pt;font-family:"Trebuchet
                      MS",sans-serif;color:#888888"> <a
                        moz-do-not-send="true"
                        href="http://www.inLibro.com"><span
                          style="font-size:9.0pt;color:#005B85;text-decoration:none">www.inLibro.com</span></a>
                      <o:p></o:p></span></p>
                </div>
              </div>
            </div>
            <p class="MsoNormal">On 09/29/2015 09:24 AM, Tomas Cohen
              Arazi wrote:<o:p></o:p></p>
          </div>
          <blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
            <div>
              <p class="MsoNormal"><o:p> </o:p></p>
              <div>
                <p class="MsoNormal"><o:p> </o:p></p>
                <div>
                  <p class="MsoNormal">2015-09-29 9:23 GMT-03:00
                    Philippe Blouin <<a moz-do-not-send="true"
                      href="mailto:philippe.blouin@inlibro.com"
                      target="_blank">philippe.blouin@inlibro.com</a>>:<o:p></o:p></p>
                  <blockquote style="border:none;border-left:solid
                    #CCCCCC 1.0pt;padding:0cm 0cm 0cm
                    6.0pt;margin-left:4.8pt;margin-right:0cm">
                    <div>
                      <div>
                        <p class="MsoNormal">Hi!<br>
                          Morning here, maybe my brain is not ignited
                          yet.  But why such a rule? (if i understand
                          its meaning correctly).<o:p></o:p></p>
                      </div>
                    </div>
                  </blockquote>
                  <div>
                    <p class="MsoNormal"><o:p> </o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">Because that way there's no way
                      to properly write unit tests for the function. And
                      code gets messy too.<o:p></o:p></p>
                  </div>
                  <div>
                    <p class="MsoNormal">I'll call for a dev meeting and
                      add this to the agenda.<o:p></o:p></p>
                  </div>
                </div>
                <p class="MsoNormal"><br clear="all">
                  <o:p></o:p></p>
                <div>
                  <p class="MsoNormal"><o:p> </o:p></p>
                </div>
                <p class="MsoNormal">-- <o:p></o:p></p>
                <div>
                  <div>
                    <div>
                      <p class="MsoNormal"><span style="font-size:9.5pt">Tomás
                          Cohen Arazi<o:p></o:p></span></p>
                    </div>
                    <div>
                      <p class="MsoNormal"><span style="font-size:9.5pt">Theke
                          Solutions (<a moz-do-not-send="true"
                            href="http://theke.io/" target="_blank">http://theke.io</a>)<br>
                        </span><span
                          style="font-size:9.5pt;font-family:"Segoe
                          UI Symbol",sans-serif">✆</span><span
                          style="font-size:9.5pt"> +54 9351 3513384<br>
                          GPG: B76C 6E7C 2D80 551A C765  E225 0A27 2EA1
                          B2F3 C15F<o:p></o:p></span></p>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </blockquote>
          <p class="MsoNormal"><o:p> </o:p></p>
        </div>
      </div>
    </blockquote>
    <br>
  </body>
</html>