On Jun 29, 2011, at 5:59 AM, "Cédric Krier" <[email protected]> wrote:
> ... but
> you must keep in mind that in Tryton we try to make simple modules that just
> do the basis stuff (but it must be easy to extend them to match the needs).

Cédric,

I'm very interested in this statement and I wondering you can expand
on it a little bit. It sounds like a core statement or principal and
I'd like to understand it well.

I've read Theo de Raadt's principal about OpenBSD, that every program
and function will do what it is specified to do, and *only* what it is
specified to do. Code that does something unexpected is buggy and
almost always a security risk.

Your statement has a similar ring to it, that a module should perform
the essence of a task in an uncomplicated way, leaving the variations
in process to another module that builds upon the original.  Do I have
that right?

What is the most 'trytonic' way to do this? I looked at the carrier
module code you posted, and it appeared to me that it provides
shipping cost using the simplest method - looking up a shipping
(service) product in the database and retrieving the sale price and
purchase price. If I wanted to create for example a module that
retrieved rates from a carrier using their API, I think i would create
a new module that depends on that module, then inherit the Carrier
class, override the carrier_cost property to add an option for rated
costs, and override the get_sale_price and get_purchase_price
functions to get the prices from the API. (An overly simple example I
think.) Do I have that correct, that this would be an example of a
simple module that is extended to meet a need?

Maybe there are developer documents that explain this, and i just
haven't located them yet. If so, I wonder if you might point me to
them.

Rob Martin

-- 
[email protected] mailing list

Reply via email to