<div dir="ltr">I've been looking at our coding patterns, and noticed we haven't discussed/agreed on some stuff. Which is a good oportunity to just do it, now the Koha:: namespace is being filled with cool old-code rewrites with lots of test coverage.<div><br></div><div>- Transactions on heavy business functions that should definitely be wrapped inside a transaction.</div><div><br></div><div>Running </div><div>  $ cd Koha ; git grep txn</div><div>is just sad.</div><div><br class="inbox-inbox-Apple-interchange-newline"></div><div>- Little use of Exceptions in Koha. We introduced them, but still don't extend its use. Maybe related to the next item.</div><div><br></div><div>I think we should keep general exceptions (like Koha::Exceptions::ObjectNotFound) in the general Koha::Exceptions namespace. But move the package-specific ones into its own file. To aid maintenance. A good candidate are Koha::Exceptions::Virtualshelves</div><div><br></div><div>- We don't use a Try/Catch library. It would make it easier to use Koha::Exceptions with a nice syntax.</div><div><br></div><div>There are a couple interesting libraries: Try::Tiny and TryCatch. [1] I prefer the latter because the type check seems nicer to write and eval (instead of an if/ifelse cascade checking ref($exception) eq 'Something'.</div><div><br></div><div>I have my opinions on this items, and it would be great to discuss it openly. There's code in bugzilla waiting for QA, and it'd be great to have some consensus on how to organize the code for the future.</div><div><br></div><div>Regards</div><div><br></div><div>[1] <a href="http://search.cpan.org/~ether/Try-Tiny-0.27/lib/Try/Tiny.pm">http://search.cpan.org/~ether/Try-Tiny-0.27/lib/Try/Tiny.pm</a> and <a href="http://search.cpan.org/~ash/TryCatch-1.003002/lib/TryCatch.pm">http://search.cpan.org/~ash/TryCatch-1.003002/lib/TryCatch.pm</a></div><div><br></div></div><div dir="ltr">-- <br></div><div data-smartmail="gmail_signature"><div dir="ltr"><div style="color:rgb(117,117,117);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12.8px">Tomás Cohen Arazi</div><div style="color:rgb(117,117,117);font-family:'helvetica neue',helvetica,arial,sans-serif;font-size:12.8px">Theke Solutions (<a href="http://theke.io/">https://theke.io</a>)<br>✆ +54 9351 3513384<br>GPG: B2F3C15F</div></div></div>