[Koha-devel] Koha and DBIC

Kyle Hall kyle.m.hall at gmail.com
Thu Sep 11 02:51:38 CEST 2014


>
> > 1) Allow find and simple searches in pl.
>
> IMO, this is not a good idea. You're coupling database schema with code
> that's closer to display.
>

It's funny, I've been trying to think of an example search to justify this
and I can't really think of one where we can't use existing Result
relationships to get our data. Maybe find() and single() are really all we
need from pl files, but I don't think a hard and fast rule against search()
is a good idea.


>
> All access should be via an API into the C4:: or Koha:: namespace, and
> the modules there are the only ones that know/care how the database is
> actually laid out. This means that if we want to change how things are
> stored[0], only one module needs to know about the change, and it can
> still present the same interface to code.
>

Result and ResultSet are part of the Koha namespace. I also feel that you
aren't quite correct about how one modules need to know the change a
present the same interface. I can't count the number of times I've added a
new parameter to an existing subroutine and had to update every function
call in many perl files. Now that hashref's are more common, it's become
less of a problem but it's still a problem that exists. I just don't think
this is a entirely valid point. Remember, Result and ResultSet methods are
no different than methods anywhere else in Koha and C4.


>
> The moment that you have more than one place talking to a fairly
> low-level system like the database, you are going to have problems (e.g.
> the issues in the current system where so many modules touch the account
> code that refactoring it is a huge nightmare.)
>

Exactly. If you look at my accounts rewrite you'll see I didn't try to
shoehorn everything into Result and ResultSet. I used a Koha module that
uses Results and ResultSets in a sane fashion.

Kyle


>
> --
> Robin Sheat
> Catalyst IT Ltd.
> ✆ +64 4 803 2204
> GPG: 5FA7 4B49 1E4D CAA4 4C38  8505 77F5 B724 F871 3BDF
>
> _______________________________________________
> Koha-devel mailing list
> Koha-devel at lists.koha-community.org
> http://lists.koha-community.org/cgi-bin/mailman/listinfo/koha-devel
> website : http://www.koha-community.org/
> git : http://git.koha-community.org/
> bugs : http://bugs.koha-community.org/
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.koha-community.org/pipermail/koha-devel/attachments/20140910/885566f5/attachment.html>


More information about the Koha-devel mailing list