Implementing Business Module: advice needed

Derek Atkins warlord@MIT.EDU
07 Nov 2001 12:23:51 -0500


In thinking about how to implement a business module, I've been trying
to come up with the best way to integrate it into the Gnucash engine.
I'm trying to come up with a solution that is both simple to implement
but also simple to maintain.  Similarly, it would be nice if the
business features were optional.

The most obvious way to implement this would be to extend the engine
to directly know about all the various new objects that I plan to
implement.  The problem with that approach is that it doesn't scale or
expand very well.  In particular, if you want to add new business
objects later, you have to add them into the engine.

Moreover, this approach also doesn't lend itself to modularization.
The engine itself needs to know about the business objects and hense
cannot easily be compiled without it.  The UI portions can be kept
separate, but the engine will still have all this extra stuff even
when you don't need it.

Another approach is to have a 'business hook' in the engine.  This
would provide a way to have a business-engine that sits alongside the
main engine.  The business engine could then implement the core
business objects and hook into the main engine through a gnc-book
"business-objects" hook.

The problem with this approach is that the engine will have data
pointers that it may not understand.  It also means that the engine
will need special instructions to load and save the business class
objects.  In particular, how would 'book-load()' know whether to load
the business objects or not?

The biggest issue is that while the UI is fairly modularized, the core
engine is not.  This means that the core needs to know about
EVERYTHING.  I don't mind implementing my list of objects inside the
engine, but I'm not convinced that it's the _right thing_ to do.

Any suggestions from the core developers?

-derek
-- 
       Derek Atkins, SB '93 MIT EE, SM '95 MIT Media Laboratory
       Member, MIT Student Information Processing Board  (SIPB)
       URL: http://web.mit.edu/warlord/    PP-ASEL-IA     N1NWH
       warlord@MIT.EDU                        PGP key available