I think Hal's point (and it's one I agree with) is that rather
than have your interface code work directly with the database and
record calls that you wrap the database in a module that exposes
the objects in an abstract way.  I've got into the habit of doing this
with every database - you end up with a fairly standard set of
Initialise, Open, GetFirstx, GetNextx, GetxByIndex, Savex,
Createx calls - and have found it very useful later when altering the
way the data is stored or indexed.

As well as covering Hal's point about allowing the data to exist
in a database or VFS I've also found that it simplifies changes to
the database structure.  As an example, I recently had to extend
a database to store two types of record.  Because I'd created
a wrapper module the code using the existing record type didn't
change at all.  This is fairly standard code modularity, so this isn't
a revolutionary suggestion, just a reminder that doing things
properly will save you time in the long run.

Chris Tutty

From: "alexrousseau_jta" <[EMAIL PROTECTED]>
> Thanks for your good advice. I am completely ignorant of VFS
> (still focusing on OS 3.5+ support at this time).
>
> How would it help the user if I supported VFS?
>
> Also, I intend to support OS3.5+ and I guess that I'll still
> need a Dm-conversant layer in there, like you did.
>
> Thx!
> Alex
>
>
>
>
> Hal Mueller <[EMAIL PROTECTED]> wrote:
> > I needed some similar linking in one of my products.  I also did
> > _not_ need record categories.  So I ended up using the category
> > support to designate my record type.  Where you have addresses of
> > records, I used record IDs (supplied my own record ID).
> >
> > I ended up with an enumerated type that listed all of the record
> > types, and a sort routine that sorted records by category (and then
> > appropriately within category).  I also tagged "first polygon
> > index", "first line index", etc to boost lookup speed.
> >
> > I suggest you design from the beginning with VFS in mind.  For me,
> > this meant writing two levels of encapsulation routines for record
> > access (e.g. FindPolygon(database, poly #), FindLine(database, line
> > #), GetRecordHandle(datbase, recordIndex)).  The lower level of
> > routine chose either Dm or VFS calls, depending on where the
> > database was located (VFSFileDBInfo/DmDatabaseInfo,
> > VFSFileDBGetRecord/DmGetRecord).  I also wrote my own VFS version
> > of DmFindSortPosition.  I don't do any on-device editing of these
> > databases, but if I did I would want to transparently copy a VFS DB
> > to RAM, work with it, and then return it to RAM (allowing for the
> > possibility that power could die or card could be removed at any
> > moment).
>
>
>
> -- 
> For information on using the Palm Developer Forums, or to unsubscribe,
please see http://www.palmos.com/dev/support/forums/


-- 
For information on using the Palm Developer Forums, or to unsubscribe, please see 
http://www.palmos.com/dev/support/forums/

Reply via email to