Beefy Boxes and Bandwidth Generously Provided by pair Networks
go ahead... be a heretic
 
PerlMonks  

Re: object-relational Perl programming: best practice or compromise?

by pg (Canon)
on Oct 26, 2004 at 17:00 UTC ( [id://402711]=note: print w/replies, xml ) Need Help??


in reply to object-relational Perl programming: best practice or compromise?

"This contrasts with both the database and programming language being object-oriented as well as with both the database and language being procedural."

Sounds like there was a little bit misunderstanding of what the author said. As for database, I don't think he is talking about OO database, and most of the databases around us are not. As for language, he is still talking about OO.

His point is how to mapping database tables to objects.

We had some big discussion in our shop about this, and actually the talking is still going on... The problem you facing when you coding in a language like Java is that, the most obvious way of mapping is make each database table a DCO.

Now there is a big issue with this approach: when you create their DAO's, it becomes so unreal for you to enjoy the benefit of table joins, subqueries (we use Oracle, it supports a wide range of SQL statement, which magnified this issue).

We end up with adding two more concepts: ECO (Enterprise Data Container Object) and EAO (Enterprise Data Access Object). When DCO and DAO encapsulate the data and access mothods against a single table. ECO and EAO allow you to encapsulates data from multiple tables. This closely matches what the author called business object. Design wise, this approach allows you to more freely realize objects in its own way, and not held back by database normalization; Practical wise, it allows you to enjoy the power of a wide range of SQL statement, and your code makes more sense.

  • Comment on Re: object-relational Perl programming: best practice or compromise?

Replies are listed 'Best First'.
Re^2: object-relational Perl programming: best practice or compromise?
by tall_man (Parson) on Oct 26, 2004 at 19:27 UTC
    I agree with this approach. It is a recognition of the fact that in the real business world, database tables are usually the master of the data. Objects may be thought of as a temporary, programming-language-based, in-memory views of database query results. There may be other applications that derive entirely different "objects" from the same tables, and even report applications driven by straight SQL queries with no attempt at object orientation.

    The Class::DBI module commits what C.J. Date calls the First Great Blunder, attempting to equate objects with rows in a relational table. Date advocates using objects only for user-defined types (things like geographical shapes), confined to single column types instead of row types.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://402711]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others wandering the Monastery: (3)
As of 2024-04-24 21:35 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found