<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<style type="text/css" style="display:none"><!-- p { margin-top: 0px; margin-bottom: 0px; }--></style>
</head>
<body dir="ltr" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:'Courier New',monospace;">
<p>Hi, and thanks for quick feedback folks.<br>
</p>
<p>Good catch, Jonathan, we recently moved to gitlab since they integrate devops and CI build tools. The branch circ_rewrite_master is rebased against master, but havent tested properly yet, so its very WIP but you'll get the general idea.</p>
<p><br>
</p>
<p>Julian,​<br>
</p>
<p>> <span style="font-size: 12pt;">I have some concerns about this approach. You are saying that local</span></p>
<div>> adaptations are reusable for others, but I don't see how. Deichman::*</div>
<div>> will inevitably end up being highly specific. I could probably</div>
<div>> copy/paste some code, but I think we will all have to write our own</div>
<div>> MyLibrary::* stuff.</div>
<div><br>
</div>
<div>Your concern is probably sound, since it is easier to add all local adaptations to a local namespace (Deichman::*) and be done with it. What I'd suggest though is that modules are kept as atomic as possible so that anything can possibly be overridden.
 Its kind of the opposite of todays practise where sysprefs are scattered all over the code to adjust for local variations, at least from what I've seen in the C4::Circulation. I think it would make sense to allow for a Core Circulation that never touch sysprefs,
 while at the same time having a "default" or "full-blown" implementation that can do exactly what C4::Circulation does today.<br>
</div>
<div><br>
</div>
<div>> I'd prefer to extend the capabilities of plugins. This way we could</div>
<div>> combine small generic plugins to answer specific needs.</div>
<div><br>
</div>
<div>Actually, I didnt realize plugins was more than tools to extend reports, kind of a stepwise db tooling. At least the examples I saw was just CGI templates that must be aactively run to modify database. And they seemed based on CGI templating which doesnt
 help us much. In any case, to plug into something central, such as Circulation, the circulation modules would need to be rewritten.<br>
</div>
<div><br>
</div>
<div>> But you also say that you reimplemented all the circulation stuff, and</div>
<div>> that it was not complicated, so I'm curious :) Show us the code!<br>
</div>
<p><br>
</p>
<p>WIP for sure, but as Jonathan found out, here is a single commit on top of master<br>
</p>
<p><a href="https://gitlab.deichman.no/digibib/Koha/commits/circ_rewrite_master">https://gitlab.deichman.no/digibib/Koha/commits/circ_rewrite_master</a><br>
</p>
<p>I see now we use a local caching trick with method attributes (PureFunctions) that is not included, so I will have to remove that or it will not work at present. But if theres some interest, I will open a bug and commit so people can test it. I will try
 to commit at least to make circulation work as in a standard installation.<br>
</p>
<p><br>
</p>
<p>Benjamin<br>
</p>
<div style="color: rgb(33, 33, 33);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>Fra:</b> Brendan Gallagher <info@bywatersolutions.com><br>
<b>Sendt:</b> 10. april 2018 21:34<br>
<b>Til:</b> Jonathan Druart<br>
<b>Kopi:</b> Benjamin Rokseth; koha-devel@lists.koha-community.org<br>
<b>Emne:</b> Re: [Koha-devel] Koha Core anyone?</font>
<div> </div>
</div>
<div>
<div dir="ltr">
<div>
<div>Very excited by this idea.  Lot's to think about.  We're on board with most of it and are ready to help.<br>
<br>
</div>
Cheers,<br>
</div>
Brendan <br>
</div>
<div class="gmail_extra"><br>
<div class="gmail_quote">On Tue, Apr 10, 2018 at 9:30 AM, Jonathan Druart <span dir="ltr">
<<a href="mailto:jonathan.druart@bugs.koha-community.org" target="_blank">jonathan.druart@bugs.koha-community.org</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>Ha, found it!<br>
<a href="https://gitlab.deichman.no/digibib/Koha/commits/circ_rewrite_master" target="_blank">https://gitlab.deichman.no/<wbr>digibib/Koha/commits/circ_<wbr>rewrite_master</a><br>
</div>
I was looking at the digibib github repo!
<div>
<div class="h5"><br>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, 10 Apr 2018 at 13:28 Jonathan Druart <<a href="mailto:jonathan.druart@bugs.koha-community.org" target="_blank">jonathan.druart@bugs.koha-<wbr>community.org</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
<div dir="ltr">
<div>
<div>Hi Benjamin,<br>
<br>
Where is the code of the "working example"?<br>
</div>
<br>
Cheers,<br>
</div>
Jonathan<br>
</div>
<br>
<div class="gmail_quote">
<div dir="ltr">On Tue, 10 Apr 2018 at 12:04 Benjamin Rokseth <<a href="mailto:benjamin.rokseth@deichman.no" target="_blank">benjamin.rokseth@deichman.no</a>> wrote:<br>
</div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex; border-left:1px #ccc solid; padding-left:1ex">
Community hackers,<br>
<br>
on hackfest I got introvertly enthusiastic about the concept of a Koha Core, and<br>
about time I shared some thoughts.<br>
<br>
Background: Deichman (Oslo Public Library) is heavily leaning on bleeding edge Koha<br>
development (REST, Objects, Auth, NCIP and such) and, like at least some others, maintain<br>
a lot of local patches to tweak Koha into our users needs. Some are probably interesting to<br>
Community, others not. Now to keep everything in sync with Community would be amazing,<br>
but not likely to happen anytime soon.<br>
<br>
Great work has been done on refactoring Koha (new namespace, Koha Objects and REST api, etc.),<br>
but we'd like to suggest one more - a Koha core.<br>
The idea is simple: borrow from object oriented languages, java, or actually more ruby, since<br>
we're dealing with a dynamic language, use class/module inheritance and method overrides.<br>
Perl has the "use parent" concept which simplifies inheritance/subclassing and allows for<br>
nested overrides.<br>
<br>
As an example we refactored the current circulation in Koha, since this for us is the core<br>
functionality that we depend on and need to hook our local quirks on top of.<br>
An attempt to illustrate:<br>
<br>
+------------+<br>
| Core::Main |<br>
+--^---------+<br>
   |<br>
+--+----------------+<br>
| Core::Prefs       |<br>
| Core::Exceptions  |                +-----------------------+<br>
| Core::Circulation <-----+------+---| Deichman::Circulation |<br>
| ...               |     |      |   +---^-------------------+<br>
+-------------------+     |      |       |<br>
                          |      |       |<br>
       +------------------+------+       +--------------------------+<br>
       | Core::Circulation::SIP  |       |Deichman::Circulation::SIP|<br>
       +----------------------------<wbr>------------------------------<wbr>--+<br>
                                 |        use parent qw(<br>
                                 |          Deichman::Circulation<br>
          +----------------------+          Core::Circulation::SIP<br>
          | Core::Circulation::UI|        )<br>
          +----------------------+<br>
                                 |<br>
                                 ~<br>
<br>
* Core::Main is simply an empty class that act as a parent for any child, including Core::Circulation.<br>
* Core::Circulation has a constructor that takes koha objects item and library, optionally patron<br>
  and sysprefs overrides. It can have accessors such as checkout, messages and other things needed for<br>
  intra, SIP or whatever. It has methods Checkin, Checkout and Renew, amongst others.<br>
* then: Deichman::Circulation::SIP in this example is a local override that inherits from parents<br>
  Deichman::Circulation and Core::Circulation::SIP<br>
<br>
now the beauty of this is that Deichman::Circulation::SIP can override anything (even the constructor)<br>
without touching any of the core code, and perl will traverse the inheritance tree until it finds the<br>
first matching constructor and method.<br>
<br>
Pros:<br>
  - simpler, more readable and more reusable code.<br>
  - local adaptations are easy to hande, and reusable for others<br>
  - the slight overhead of using blessed objects and inheritance is easily gained by the fact that any<br>
    operation will only need fetching Koha objects once (item,library,patron etc) instead of refetching<br>
    them numerous times spread across methods calls and loops<br>
  - way less db calls if done right, faster Koha<br>
  - no more C4::Context, hopefully<br>
  - systempreferences can be dramatically reduced, since most of them are about overrides anyways<br>
  - can be done incrementally, replacing one functionality at a time<br>
<br>
cons:<br>
  - refactoring doesnt make end users happy (but needs to be done in any case)<br>
  - a bit of work to keep templates happy<br>
  - requires a basic understanding of oop<br>
<br>
So to sum up: We already have a working example for circulation (though not in production)<br>
that we can demonstrate. It reimplements basically the entire C4::Circulation, just some small<br>
parts missing. So it can be done.<br>
<br>
But we'd love to hear second opinions from the community! We know the fear for breaking changes, but<br>
its neither scary or complicated to implement!<br>
<br>
Benjamin Rokseth<br>
Oslo Public Library<br>
______________________________<wbr>_________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org" target="_blank">Koha-devel@lists.koha-<wbr>community.org</a><br>
<a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.<wbr>org/cgi-bin/mailman/listinfo/<wbr>koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">
http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">
http://bugs.koha-community.<wbr>org/</a><br>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
</div>
<br>
______________________________<wbr>_________________<br>
Koha-devel mailing list<br>
<a href="mailto:Koha-devel@lists.koha-community.org">Koha-devel@lists.koha-<wbr>community.org</a><br>
<a href="http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel" rel="noreferrer" target="_blank">http://lists.koha-community.<wbr>org/cgi-bin/mailman/listinfo/<wbr>koha-devel</a><br>
website : <a href="http://www.koha-community.org/" rel="noreferrer" target="_blank">
http://www.koha-community.org/</a><br>
git : <a href="http://git.koha-community.org/" rel="noreferrer" target="_blank">http://git.koha-community.org/</a><br>
bugs : <a href="http://bugs.koha-community.org/" rel="noreferrer" target="_blank">
http://bugs.koha-community.<wbr>org/</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<div class="gmail_signature">
<div dir="ltr">
<div>
<div dir="ltr">---------------------------------------------------------------------------------------------------------------<br>
Brendan A. Gallagher<br>
ByWater Solutions<br>
CEO<br>
<br>
Support and Consulting for Open Source Software<br>
Installation, Data Migration, Training, Customization, Hosting<br>
and Complete Support Packages<br>
Office: Portland, OR - Office: Redding, CT<br>
Phone # (888) 900-8944<br>
<a href="http://bywatersolutions.com" target="_blank">http://bywatersolutions.com</a><br>
<a href="mailto:info@bywatersolutions.com" target="_blank">info@bywatersolutions.com</a><br>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</body>
</html>