[plt-scheme] Looking for suggestions on how to approach an issue

From: David Storrs (david.storrs at gmail.com)
Date: Thu Sep 17 18:53:57 EDT 2009

Sorry for the relatively uninformative subject line...couldn't think
how to summarize this cleanly.

Problem Description:
We are writing a closed-source system to pull data from multiple data
sources.  Those sources might be RDBMSes, flat files, Excel files,
whatever we eventually write an interface to.  This will be used in an
MVC web framework built on the PLT web server.  (I'm aware of the DBI
/ DBD collection, but we opted not to use it as SQL isn't really the
language of choice for talking to non-DB datasources.)

Requirements:
All knowledge of how to connect, how to do the read / write calls,
etc, should be encapsulated within the model.  The model should expose
a generic interface that the controller can use to read / write data
to whatever source.  Our original thought was to do a polymorphic OO
system.


All fine and good; we've been making good progress on that.


Problem:
Now that we have a working prototype, we would like to add contracts
to guarantee the correctness of data passed into and out of our
read-data and write-data routines.  But contracts only apply across
module boundaries.  Since the call to 'new' is within the module where
the read / write calls are made, we don't see how to make this work.

We're starting to think that OO may have been the wrong approach, and
are considering reworking the prototype.  No sacred cows--we're
looking to optimize for programmer time.  I asked in the IRC channel
and got two useful pointers:  typed scheme or contract regions, but it
was also suggested to ask on list, so I'm asking.


Any thoughts?  Anyone have experience doing anything like this?


--Dks


Posted on the users mailing list.