Paul Aspinall wrote:
In an environment such as VS which allows great integration of the
Database design components visually in the IDE, and given that a
target app is will be deployed on a single machine (ie. not n-tier or
client server), I'm debating the concept of using a DAL.
Other than logical design, I cannot see a benefit of using it.
Can anyone offer any opinions?
Well, this is a typical coder's approach -- go with the tools and be
done with it. But unfortunately, once you wear a tester's hat, or an
architect's hat, things aren't that easy anymore.
First, you cannot unit test your application in a meaningful way,
because you're unit is the entire application. There's no way to "mock"
or "stub" the DAL without a proper DAL. This also means that there's no
easy way to swap out implementations (e.g. Oracle vs. SQL Server), if
that ever becomes a requirement -- there's no abstraction layer
protecting the rest of your application from data access implementation
details.
Second, unless you're data access code is utterly trivial, I'm sure
that you'll find repeating similar data access code all over the place.
It doesn't matter whether it's handwritten or generated by tools. It
violates one of the most fundamental design principles: Don't repeat
yourself. And it quickly becomes a maintenance nightmare.
If you're asking as a hobbyist though, things are different -- do
whatever you're most comfortable with ;-)
Cheers,
--
http://www.joergjooss.de
mailto:ne********@joergjooss.de