[Koha-devel] Restructuring C4

Galen Charlton gmcharlt at gmail.com
Wed Apr 6 14:30:29 CEST 2011


Hi,

On Wed, Apr 6, 2011 at 12:11 AM, Robin Sheat <robin at catalyst.net.nz> wrote:
> Additionally, do we want to split things up within the Koha namespace,
> for example database-accessing code vs. the more business logicy stuff?
> My personal inclination is to not do that, and it wouldn't be a terrible
> refactoring to do at a later stage if it were required.

I'd prefer a separation between business logic and data access,
actually.  Perhaps

# data access - though the choice of naming may better follow whatever
pattern DBIx::Class imposes:
Koha::DB::biblio
Koha::DB::accounts

# business logic
Koha::Acounts
Koha::Cataloging
Koha::Cataloging::Biblio

or the like.  Obviously we could debate the hierarchy ad infinitum,
but as long as names are well-chosen and we don't lump unrelated
things together, we can run with what works.

> Oh, something else that's recommended that I tend to do is not export
> anything by default, requiring the module to be included like:
>  use C4::Accounts qw/ get_users_balance /;
> mostly this prevents surprising things getting into your namespace. This
> is more a style suggestion though.

I agree with Colin that this should be more than just a style
suggestion.  We shouldn't include more than the bare minimum in
@EXPORT; @EXPORT_OK is to be preferred.

Even better would be an object oriented design.

Regards,

Galen
-- 
Galen Charlton
gmcharlt at gmail.com


More information about the Koha-devel mailing list