OODML Refactor

Russ Tyndall <[email protected]> Thu, 06 Dec 2012 14:22:28 -0500
Newsgroups gmane.lisp.clsql.general
Message-ID <[email protected]>
Over the last couple weeks I have worked through a refactor of the
sql/oodml.lisp code file.

My goals were:
  * unify codepaths for the update-*-from-* functions where possible
  * general cleanup and documentation
  * reduce complexity and improve readability (through smaller,
    functions with less nesting)
  * convert data passed around in cons & lists to instead be
    objects (for readability and in some cases efficiency)

Along the way I found that almost all of the iteration constructs in
the language were used, often nested and in a not-terribly-readable
way.  I chose to standardize on loop unless it was a very simple use
of a different construct, so that hopefully most of the code in this
file looks like the rest of the code in this file.

Normalized view-classes are now better documented as to what
assumptions need to be met.  Also many cases of recursion were
converted to iterative approaches (by recursing in one place and
producing a list that can be iterated over everywhere else). This
separation of concerns simplified the implementation of many other
functions.

While I attempted to minimize semantic differences, I documented any
changes in the ChangeLog entry.  The biggest change was to
update-objects-joins, which now operates on immediate join slots by
default and accepts keywords for :deferred and :all as well as an
explicit list of slots.

After the refactor, I ran some speed tests that implied with fair
certainty that my refactoring did not reduce performance (for my
common workloads).  The test suite in clsql has the same number of
failures (for the backends I can test) as it did before the refactor
(see LATEST-TEST-RESULTS).  I also ran the test-suites for various
of our other projects that make use of clsql and its oodml.  We have
also been using this branch in our projects for a week or so.

I have pushed this branch to github[1] for public review. Please check
it out and report any problems you have. We intend to push this to
git.b9.org for a new clsql release soon. I think a point release
should be fine for this.

[1] https://github.com/UnwashedMeme/clsql/tree/oodml-refactor

You can clone that branch directly:
`git clone https://github.com/UnwashedMeme/clsql.git -b oodml-refactor 
clsql-oodml`

  or checkout a new branch in your existing repo:
`git fetch https://github.com/UnwashedMeme/clsql.git oodml-refactor;
  git checkout -b oodml-refactor FETCH_HEAD`

Cheers,
Russ Tyndall
Acceleration.net