[Koha-devel] adding a model abstraction ?

Marc Chantreux marc.chantreux at biblibre.com
Mon Jan 19 11:25:14 CET 2009


On Wed, Oct 15, 2008 at 03:28:12PM +0200, Marc Chantreux wrote:
> hello guys,
> 
> I just rewritten the C4::Bookseller::AddBookseller and it now looks
> like:
> 
> sub AddBookseller {
>     _koha_insert_and_get_id(
>         'aqbooksellers', shift 
>     );  
> }
> 
> 
> _koha_insert_and_get_id is a function where i deal with DBI and all specific
> DBD tricks with reuse in mind. You can see the following code.
> 
> do i try to push it in koha ? and where ? It sounds like Koha::SQL package. 

hello,

Few month ago, i posted a patch to begin to add a minimalistic sql query
helper in koha.

Ryan Higgins comes with le idea to use DBIx::Class which with i'm agree from
the first day i read koha code: i shut up and read the thread. 

Now months have passed, there is no such things as DBIx code in the tree, i
still wants to refactor some parts of the code i have to read/hack and came
back to my first idea.

My reflection about it:

DBIx::Class adds an OO model in the heart of koha and there is no doubt that
it can be a seriouse help to clean the code, add design rules and so on ... in
the other way, i think that if we do that now, we'll loose a lot of gains the
OO model can give to us because we don't make choices.

- choose of an OO framework ( Class::Std, Moose, ...) ... or not: use the OO
  syntax as explained in the perl man.
- choose of an ORM ( Jifty::DBI, DBIx::Class, ... ) ... or not:
  - http://dave.org.uk/talks/lpm/2006/orm/
  - http://kore-nordmann.de/blog/why_active_record_sucks.html
  - ....
- choose an MVC framework to jump into: i think one of the way we have to
  follow is the transplantation of an MVC framework as a new heart for koha.
  After a long reflection, i cames clear to me that we cannot just use a
  butcher knife and some pegs to do it. If we decide to do it, if we choose
  one of these frameworks, we have to make koha compliant to it step by step.
- choose other design patterns: MVC cames just as an evidence in 2009 but we
  can do better: detect the usability of some other design patterns in koha,
  concider the use of helpers for them
- try to find a way to have an up-to-date diagram class
- here your ideas here ...

this is a long reflection which need some tests, perhaps the creation of a
dedicated working group about the koha future ... but the koha bugfixing
and feature addition have to goes on. So, until we have a serious plan, we
have to clean the code as it is, without changing the API, without breaking
everything.

That's why i ask again to add my helper in koha and make a quick (quicker
than this above) reflection about a minimalistic koha::sql::helper (or
something like that) package.

thanks and regards,

-- 
Marc Chantreux
BibLibre, expert en logiciels libres pour l'info-doc
http://biblibre.com



More information about the Koha-devel mailing list