Re: Just one more anecdote
Date: 4 Aug 2005 08:18:32 -0700
Message-ID: <1123168712.154023.153860_at_g14g2000cwa.googlegroups.com>
dawn wrote:
> Marshall Spight wrote:
> > > >
> > > > I suspect that's simply because you/SQL/the world hasn't figured
> > > > out how to tap into the full power of set theory yet.
> > > >
> > > I'm thinking of only using set operations when putting things into and
> > > taking things out of my purse. After all, that approach is based on
> > > set theory and set theory rules! ;-)
> >
> > These analogies between math and the physical world don't work
> > for me.
>
> OK, now I'm confused. What is that we do when preparing a data model?
> We are making an analogy between math and the physical world, right?
> We are preparing a map between the real world and a mathematical model.
> We are making a "mathematical metaphor" for our problem space, right?
Except we weren't talking about preparing a data model; we were talking
about the design of the metamodel. That can be done in pure
mathematical
terms, whereas designing the (non-meta) model for a particular problem
domain *is* done by "analogy" with the physical world.
But if you insist, I hereby do the comparison.
We have a collection of coins in Dawn's purse. Each coin has a value. We want to remove a penny.
Here are two concrete models for doing so. One is declarative/set
theoretic,
and the other is imperative/object oriented. (Neither example has
actually
been compiled and tested, but I'm using two languages I know pretty
well.)
- SQL delete from purse where value = 1 limit 1;
// Java 5, using generics
Purse purse = Dawn.getPurse();
List<Coin> coins = purse.getCoins();
for (int i=0; i<coins.size(); i++) {
Coin c = coins.get(i);
if (c.getValue() == 1) {
coins.remove(i);
break;
}
}
I leave it to the reader to choose for themselves which they would prefer. I would propose they consider the economy of expression of each solution in making their choice.
I would guess that we could make a pretty good case for the second, Java-based solution as being at its core a hierarchical, navigation based solution. I've never worked with a hierarchical database, but I imagine it works something like this. Am I close?
Marshall Received on Thu Aug 04 2005 - 17:18:32 CEST