Re: Mixing OO and DB
Date: Mon, 3 Mar 2008 22:15:44 -0800 (PST)
Robert Martin wrote:
> On 2008-03-02 13:19:34 -0600, frebe <frebe73_at_gmail.com> said:
> > If testing without the DB should be interesting at all, it means that
> > you don't use the db for application logic.
> It means that you don't use the database for *all* application logic.
> Consider, for example, determining the simplest travel schedule for 100
> sales people visiting 500 cities. You wouldn't want to write that
> algorithm in SQL. And you'd want to test it against many different
> data regimes. Testing it without the database in place could be useful.
You are fishing a bit here. Existing RDBMS generally don't work that well with graph-traversal problems, and it is indeed a known weakness of the existing crop. But, this is largely because heavy-duty graph traversal is somewhat uncommon for most biz processes. If it was more common, more vendors would focus on adding declarative traversal. (I drafted up a possible interface for such in my pet query language.)
However, I see nothing wrong with using a RDBMS to store multiple *test cases*. That may even be a more natural place for test data than a bunch of hard-coded set/gets, especially if there's a lot of it. Perhaps the expected results can also be kept in the test DB, and then basic JOIN's and/or sums used to compare expected with actual. Or, would you rather write such comparing algorithms using hand-coded loops and counters? DB's come in useful for a variety of reasons, even IF they are not used for core processing. You are thinking of DB's in a rather narrow sense.
> Robert C. Martin (Uncle Bob)��| email: unclebob_at_objectmentor.com
> Object Mentor Inc.� � � � � ��| blog:��www.butunclebob.com
-T- Received on Tue Mar 04 2008 - 07:15:44 CET