[Koha-devel] Data Persistence and Plack

LAURENT Henri-Damien henridamien.laurent at gmail.com
Fri Dec 17 16:32:26 CET 2010


Le 17/12/2010 15:30, Colin Campbell a écrit :
> On 17/12/10 11:34, LAURENT Henri-Damien wrote:
> 
>> It seems that most of the Circular references in the code are owed to
>> functions which have been created to do some checking before doing an
>> operation...
>> For instance :
>> 	CanItemBeRenewed
>> 	CanItemBeReserved
>> 	CanBookBeReserved
>> 	CanItemBeIssued
>> 	CanItemBeIssued
>> 	....
>> 	Deletion of Serials in DelBiblio
>>
> Most of those routines are far too large and unmaintainable, many read
> the same data repeatedly and all mix business logic and reading data. It
> would probably be good if the "things" they deal with were abstracted
> into proper objects that police their own destruction, it would also
> give you the chance to have a more guaranteed interface to e.g. Item so
> that we dont have to scatter validations about through the business
> logic. Its one of the attractions of an ORM that it does this for you
> but you don't need an ORM to do it. I think if you can abstract away
> some of the current complexity it gets easier keep things clean.
> 
> Colin
> 
Thanks for this feedback.
Nonetheless those functions are quite "generic" and if they need some
refactoring, I guess that they would still need some external calls, for
instance, you can Issue an item if it is not reserved...
So those checks have to be done...
Maybe it could be better abstracted... But I lack some hawkeye to tell
how you would not need those external calls. I think that an exemple
could be helpful in order to show me what could be done in your view.
-- 
Henri-Damien LAURENT


More information about the Koha-devel mailing list