Books, sessions [was: Re: UI independance]

Matthew Vanecek mevanecek at yahoo.com
Tue Apr 8 22:32:40 CDT 2003


On Tue, 2003-04-08 at 20:42, Derek Atkins wrote:
> Matthew Vanecek <mevanecek at yahoo.com> writes:
> 
> > I personally would prefer "Period" to indicate a chunk of time, and
> > "Book" to indicate a set of accounts that are measured for a given
> > entity (e.g., husband, wife, company...).  I haven't looked to see how
> > hard that is to bring the code in line with that, though...perhaps sed
> > could be used, or perl, to change all "GNCBook" to "GNCPeriod"... ;)
> 
> Well, we don't currently have a GNCPeriod object..  Are you suggesting
> that what's currently called a GNCBook be renamed a GNCPeriod?  If so,
> then what does a GNCBook do, and still how does that relate to a GNCSession?
> 

It's changed to GNCPeriod.  The way GNCBook seems to work now appears to
me to be an amalgam of a Period and a Book.  That may have been
intentional, but it's a little confusing at first.  What I was referring
to above, more or less, was just a blanket change of GNCBook to
GNCPeriod, using sed, or perl, or your favorite mass-changing
mechanism.  Just for the sake of terminology.  My understanding of the
current (albeit incomplete) implementation is: You have a set of
Accounts (a Book) which is active for a given and concrete amount of
time (a non-existent Period).  The chunk of time plus the set of
Accounts equals a GNCBook.  Conceptually, I'd rather have the two
separate.  As we've discussed before, though, the Account cloning
process is really the only logical way to implement it.

To make an already-too-long-story a tad shorter, it's simply a matter of
terminology.  We need to define our terms so that we don't talk around
each other.

> > > > Advice, comments ... 
> > > 
> > > My advice is that we should optimize for SQL (either the Postgres or
> > > the to-be-written embedded-MySQL Backends) and relegate the XML "File
> > > Backend" to secondary (interchange) status -- then you don't have to
> > > worry about all the issues that using XML files implies.
> > > 
> > 
> > I second that emotion.  I have noticed, however, that the BookList seems
> > to be the future with Sessions.  If a bunch of files were "loaded" into
> > the BookList (1 file per entry), or if multiple database rows were
> > loaded into the BookList, I think what would remain is to have access
> > methods for the closed Books.  That is, you could use the existing
> > methods, but it looks to me that most of the Book access/update methods
> > restrict themselves to the "open" Book and ignore the others.  That's
> > probably an incomplete assessment, but is something that should be
> > double-checked.
> 
> I don't think I understand what you mean here.  Could you explain
> what you mean by a BookList, and what you mean by "existing methods"?
> I just don't think I understand where you're coming from or what you're
> trying to get across here.
> 

They are defined in gnc-engine.h, and used in gnc-session.c and QueryP.h
(as well as in the SQL backend). In a GNCSession, it's session->books. 
Existing methods are like, gnc_session_get_book(), which returns the
first GNCBook in the list that is open.  That particular method would
need to be changed to handle a choice of which GNCBook to return. The
GNCBook access methods probably wouldn't need to change, as long as the
GNCBook is properly loaded (i.e., the file open, Accounts inserted,
etc).

The other method I could see changing is gnc_session_set_book(), or
perhaps adding a gnc_session_add_book() would do...

A lot of the infrastructure seems to already be there, as I think Linas
and you have mentioned before.  It just needs fleshing out, as well as
the terminology being clearly defined (semantics--such a little
thing!!).

I see that Lots have somewhat of a priority, so that should give me some
time to recover from my hiatus from coding, and contemplate and confuse
the situation some more. =P

-- 
Matthew Vanecek
perl -e 'print $i=pack(c5,(41*2),sqrt(7056),(unpack(c,H)-2),oct(115),10);'
********************************************************************************
For 93 million miles, there is nothing between the sun and my shadow except me.
I'm always getting in the way of something...
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 232 bytes
Desc: This is a digitally signed message part
Url : /pipermail/attachments/20030408/1479e6a9/attachment.bin


More information about the gnucash-devel mailing list