Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Re: A novice's thoughts on applying Demeter to extension code

by pg (Canon)
on Nov 22, 2004 at 20:31 UTC ( [id://409725]=note: print w/replies, xml ) Need Help??


in reply to A novice's thoughts on applying Demeter to extension code

Before I actually took a serious look at Class::DBI, I always thought that it was something like DAO (Data Access Object) in Java. But when I really looked at it, it was not, it was more like a SQL statement generator, or another way to write a SQL statement without knowing the syntax, but then you have to know the syntax of Class::DBI.

I agree that Class::DBI will provide certain help in a way, but not in the sense to keep access close to data.

The DAO's in Java is really what you mentioned, keeping access close to data. The person write DAO needs to know the database table structure, know all the column names etc. But the caller of those DAO's don't need to know those any more, to them, data is data, doesn't matter how it is stored in database.

Class::DBI clearly lacks those merits.

To me, Class::DBI is not a way to keep access close to data, or to hide the table strcutures from the user, but mainly just a way to generate SQL statement.

BTW, in Java, there is nothing similar to this (Even if there is any, it is not popular at all. On the other hand, I doubt that this is a must, and how much benefit it brings to the table.).

Personally I think that the Java way delivers "keeping access close to data".

  • Comment on Re: A novice's thoughts on applying Demeter to extension code

Replies are listed 'Best First'.
Re^2: A novice's thoughts on applying Demeter to extension code
by perrin (Chancellor) on Nov 22, 2004 at 22:16 UTC
    No offense, but it sounds like you haven't looked very closely at Class::DBI. The accessors don't have to match the columns, and mine often don't. You can add logic to your classes, and I usually do. It keeps object state while you edit the data and manages writing it back out to the databases, as well as doing lazy-loading, adding validation routines, etc. It's pretty much exactly like a DAO.

      No, no offense at all. On the contrary, I am glad that different views being presented and discussed. Especially for reply like this, we argue precisely the merit of the issues, and nothing more than that.

      If I don't gain any knowledge from others here, what's the benefit to me? Another example of learning opportunity is that, sporty pointed something new to me in his post above.

      I knew the quality of your posts from the past, and I am glad that you replied.

Re^2: A novice's thoughts on applying Demeter to extension code
by diotalevi (Canon) on Nov 22, 2004 at 20:42 UTC

    pg,
    I meant this question in a more general sense than Class::DBI. Other people originally posed their Demeter problem in CDBI's light. I'm thinking of how to reapply this to YAML.pm, some code at work implemented in a VB dialect, B::Deparse, and perhaps, I suppose, Alzabo or other OO-RDBMS mappers. It wasn't my primary concern.

    Thank you for the amplification on CDBI, however.

Re^2: A novice's thoughts on applying Demeter to extension code
by exussum0 (Vicar) on Nov 22, 2004 at 21:20 UTC
    Yes there is. It's EJB using CMP. You define the classes and how they relate to the database and other columns. In fact, I had to debug the sql being generated when I was getting no data back.

    ----
    Then B.I. said, "Hov' remind yourself nobody built like you, you designed yourself"

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (3)
As of 2024-04-26 01:09 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found