Re: Decouple SQL queries from class in OOP design
- From: "frebe" <fredrik_bertilsson@xxxxxxxxxxx>
- Date: 22 Nov 2005 05:25:16 -0800
> If the data is owned by the application, embedding SQL might be
> justified. In most environments of even slightly above trivial levels
> of complexity, information such as this is maintained in a database
> that is shared across the enterprise.
In a god architecture, the database is owned by the application.
Applications should interact using messages. For example, a common
pattern in many enterprise applications is to have separate production
(transactional) database and datawarehouse databases. A data mining
software does not interact directly with the production databas.
> It couples the application to the database schema. Changes to
> the schema (due, for example, to requirements of completely
> different applications or database administrator decisions)
> could break the application.
Can you please some example of this? Besides, your application will
break anyway.
> The "validate employee ID" functionality is likely to be used
> in more than one application. Encapsulating it as a reusable
> component or service reduces the complexity of each application
> and provides more consistency across the enterprise.
Why would this not be possible if you are emedding SQL in your
application?
> Embedded SQL requires more than a simple SQL statement. The
> application must deal with database connections, transactions,
> cursors, etc
Connection, transaction and cursor handling can still be done by
pre-made generic class libraries. This has nothing to do with embedding
SQL.
> Encapsulating SQL in components or services that expose
> required functionality instead of the underlying database
> schema makes impact analysis much more straightforward and
> reliable. When SQL is embedded in applications across the
> enterprise, it becomes virtually impossible to determine the
> effect of any proposed change to the database schema.
Adding tables and columns will not effect existing clients. Removal of
tables or columns will, but it will most likely also change the service
API and give you the same problem with finding all clients to the
service API methods.
Fredrik Bertilsson
http://butler.sourcefore.net
.
- Follow-Ups:
- Re: Decouple SQL queries from class in OOP design
- From: Patrick May
- Re: Decouple SQL queries from class in OOP design
- References:
- Decouple SQL queries from class in OOP design
- From: Hongyu
- Re: Decouple SQL queries from class in OOP design
- From: Robert C . Martin
- Re: Decouple SQL queries from class in OOP design
- From: Mikito Harakiri
- Re: Decouple SQL queries from class in OOP design
- From: Bruno Desthuilliers
- Re: Decouple SQL queries from class in OOP design
- From: Mikito Harakiri
- Re: Decouple SQL queries from class in OOP design
- From: Patrick May
- Decouple SQL queries from class in OOP design
- Prev by Date: Looking for a good book on object-oriented GUI programming
- Next by Date: Re: Looking for a good book on object-oriented GUI programming
- Previous by thread: Re: Decouple SQL queries from class in OOP design
- Next by thread: Re: Decouple SQL queries from class in OOP design
- Index(es):
Relevant Pages
|