Re: Decouple SQL queries from class in OOP design



>> In a god architecture, the database is owned by the application.
> That absolute assertion is incorrect. Many systems that provide
> significant, measurable business value are based on architectures that
> include an enterprise or otherwise shared database.

Of course there are existing applications that uses many different
architectures and still provides measurable business value. But we are
talking about how to develop new applications, right? I think most
architects agree that not every enterprise application should access
every database directly. If application A want to access data from the
database belonging to application B, application A has to interact with
application B in some other way but directly access the database
belonging to application B.

> I'm surprised you would need examples.
So why don't you give any?

> Database schemas change
> for a wide variety of reasons, including support of new applications,
> support of modifications to existing applications,
As I pointed out before, new tables or columns will not break any
existing application. But I would like to see an example of some other
kind of schema change that would be possible to encapsulate in the
persistence layer. If you remove tables or columns, I can guarantee you
that you have to rewrite your business object model too.

> and optimizations made by DBAs
Changes in indexes, caches, etc will not break any existing SQL
statemenets.

> Because SQL embedded in one application is not reusable in
> another.
If they are using the same database schema, it is obviously reusable.

> Decoupling the provision of that functionality from the
> details of how it is implemented allows the same functionality to be
> provided by a wide variety of different underlying implementations.
A database schema is not an implementation. It is an interface. The
RDBMS is an implementation. By using ANSI SQL, you decouple the
application from any specific implementation.

> Are you seriously suggesting that tightly coupling an
> application to a database schema is good practice?
Of course. Unnecessary decoupling will only cause you a code bloat. The
database schema implements a lot of business logic, and the database
schema only change when the business rules change. Still you have not
provided any example of a schema change that would only effect the
persistence layer and not the rest of the application.

Fredrik Bertilsson
http://butler.sourceforge.net

.



Relevant Pages

  • Re: Ms Access 2003
    ... employees to build a database application or use their department budget to ... I find that some businesses will pay, ... a small business which employs five consultants. ... when I was a corporate Access developer for a little more than a year. ...
    (comp.databases.ms-access)
  • Re: polymorphism (was: Poly Couples)
    ... but this is not really "business software"... ... Most of such applications are built as a combination of ... database with flat files or a different RDBMS vendor?" ... couldn't care less if I do it in using structured programming or OOP ...
    (comp.object)
  • Re: How should I generate a primary key?
    ... Obviously the designer did not get all of the business rules from the ... Should the database ... A Work Order records the transaction of a truck service at a given ... This has got nothing to do with bad design, it is about the developer trying ...
    (comp.databases)
  • RE: BCM for Outlook 2K3 vs Dynamics CRM SB edition (v.3) on SBS2K3
    ... with other users who are on different computers in BCM version 1.0. ... To share BCM database, you can refer to the following steps. ... you may refer to Business Contact Manager Help. ... Verify the connection between the Microsoft Firewall and the BCM ...
    (microsoft.public.windows.server.sbs)
  • Re: Data Layer architecture
    ... > the first week of>> any serious database course). ... rules were described to be inside the RDBMS, ... is not a theory which states anything about business ... > The Relational Model is nothing but a direct application of set theory ...
    (microsoft.public.dotnet.languages.csharp)