IWETHEY v. 0.3.0 | TODO
1,095 registered users | 0 active users | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Re: Ideal world
You can't do everything through a view. Sometimes you want your reads coming through stored procedures as well.

Keeping the data access out of the business objects makes unit testing easier.

If you need to serialize your business objects (by putting them in a session, for example) you can't have references to non-serializable objects in them, like database connections and the like.

There's also a lot of management that goes into the data access, like transactions, exceptions, and so on. A good deal of the code associated with data access is managing this stuff, and a data manager lets you do that centrally as opposed to having things scattered across umpty million business objects.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New Right, meant "view or procedure"
This does solve our current problem of how to unit test the classes with db access. I'm guessing at some point, though, the data access classes themselves can't really be unit tested.
===

Purveyor of Doc Hope's [link|http://DocHope.com|fresh-baked dog biscuits and pet treats].
[link|http://DocHope.com|http://DocHope.com]
New No, those can be tested as well.
As long as the data is amenable. There are certain things in our system that defy easy testing because of the setup involved.

CRUD stuff is fairly easy to test. Use one data manager method to create the test data and another to remove it. I usually make the data include something that designates it as a unit test record, eg. prepending user names with "utest_". Then in the tear down test method I run a delete where user_id like 'utest_%'.

I usually build the data manager classes first, with unit tests. Then I build a mock data manager to the same interface. As a result, when I get to the controller and JSP portions I don't have to worry about data issues.
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
     Is this guy right about Spring? - (drewk) - (13)
         Uneducated guess - (ChrisR) - (9)
             Here's what's wrong with it - (drewk) - (8)
                 But there wasn't a subclass for every query. - (admin) - (7)
                     It *is* about the size, then - (drewk) - (6)
                         What that achieves. - (static)
                         Which is this? - (admin) - (4)
                             The jdbc/connection pooling shtuffs - (drewk) - (3)
                                 Re: Ideal world - (admin) - (2)
                                     Right, meant "view or procedure" - (drewk) - (1)
                                         No, those can be tested as well. - (admin)
         Somewhat. - (admin) - (2)
             Is the sample code right? - (drewk) - (1)
                 Fixed. - (admin)

New Viagra brand coffee! Wakes you up and keeps you up!
123 ms