A Future Web Development Framework – Storage

Path: mv.asterisco.pt!mvalente
From: mvale…@ruido-visual.pt (Mario Valente)
Newsgroups: mv
Subject: A Future Web Development Framework – Storage
Date: Sun, 26 Aug 07 15:55:21 GMT

The way I see it, there are two problems regarding
storage in web frameworks that are orthogonal to
each other:

– one problem is the fact that we need storage at
each level of the 3-tier architecture and/or at
each component of the MVC pattern. We need to store
the presentation templates/views, to store the
logic/model and to store the data itself. Right now,
and this is one of the problems of current frameworks,
different types of storage are used at different levels.
Usually templates and code are stored using files at
filesystem level and data is stored using a relational
database.
This generates two subproblems: one is that you have
a disconnect between types of storage used (and dont
tell me that you could use the relational database to
store scripts and templates; you just look silly) which
gets even more ugly when the data you want to store is
not structured/relational (files? images? documents?).
If you suggest using blobs in the relational database
you wont just look silly but also stupid.
The second subproblem is the disconnect you get from
using a relational database to store the object oriented
models from the MVC pattern. The infamous object relational
impedance, usually solved by the use of OR-mappers (that
only go so far because they store objects properties but
not objects methods.

– the second major problem is the type of storage to
use, preferably at all levels of the 3-tier architecture.
As I said before, usually filesystem files are used for
templates and code and relational databases for data.
But this is just “legacy” thinking and it generates
impedance problems, not only between MVC/OO thinking
and relational storage but also between managing files
and managing tables.

What should or could be the way to tackle these two
problems? Well, I think that using a single uniform
storage would be the way to do it. You either decide
that you’re going to use files all the way, relational
database all the way or whatever other option all the
way.

I think that relational is out of the question. Not
only is it stupid to store templates and/or code in
this way, but you also get the OR impedance problem
and the “binary files in blobs” problem.

So its either filestorage for all or a second option.

Filestorage is quite atractive. Templates are already
there, code is there, easy to store documents/blobs…
The problem is structured data, usually stored in
relational databases.
One option to solve this would be to use a file level
abstraction of relational storage. Plan 9 stuff comes
to mind; an interesting option would be the use of
libferris, since that would also bring aditional file
abstraction views of several resources.

http://witme.sourceforge.net/libferris.web/

Doing “ferrisls -0 pg://localhost/xmldotcom2007/customers”
to get a listing of the Customers table in PostgreSQL is
quite cool…

Another option would be to use plain old files to
store data. This data could be stored formatted in XML
(as is now in fashion), although with current interest
in REST and JSON, it comes to mind that plain old RFC822
formatted files would fall in quite nicely (even the
separator ‘:’ is the same…).

For this option I can think of at least two tools
that might come in handy. APE and plain old IMAP/NNTP
storage…

http://hathawaymix.org/Software/Ape
http://deflexion.com/messaging/
http://pessoal.org/papercut/

Filestorage would have aditional benefits of not being
opaque, easily accessed by other tools. There would also
be the benefit of being able to use “normal” tools (like
vi) or more “advanced” ones (like versioning and backups)

The second option for storage: object oriented databases.

Their time is now more that due. Early ones had huge
performance problems and didnt have the SQL version du
jour. But there are now some OO databases that have quite
good performance, possibility of XML and document storage
and even SQL queries.

Some standard relational databases, like PostgreSQL,
already have the OO usage option.
Another possibility is the use of native XML databases
like eXist.
Finally, the way that my longtime favourite Zope has
chosen, the use of a native OO database (ZODB in Zope’s
case)

I can tell you that I’ve been a bigger fan of Zope/ZODB
in the past. At the end, the fact that ZODB is opaque (ie.
you can only get at your data using Python as tool)
actually becomes a problem. You get nice “things” like
acquisition, persistence, versioning, etc but you miss
out on accessibility (using vi, doing a grep on all your
code, etc). Unfortunately the development of APE and
related tools seems to have stopped, since that would seem
to be the perfect solution.

http://www.zope.org/Members/jdoyon/svnapezope

In conclusion: a future web framework would have to
have a single storage system for all its components. This
could either be a filesystem based system providing an
interface acceptable to the code level (SQL? XML?)
or an OO database with storage viewable as filesystem
objects. An important thing: the interface provided to
the code level could have SQL, SPARQL, XPath, whatever,
as options; but as time goes by its becoming clearer that
a REST interface is obligatory.

http://www.25hoursaday.com/weblog/2007/07/13/GoogleBaseDataAPIVsAstoriaTwoApproachesToSQLlikeQueriesInARESTfulProtocol.aspx
http://exist.sourceforge.net/devguide.html#N1021D
http://phprestsql.sourceforge.net/

— MV