[Israel.pm] Class::DBI Talk

Yuval Yaari yuval at windax.com
Tue Jun 15 00:24:36 PDT 2004


On Mon, 2004-06-14 at 19:39, Shlomo Yona wrote:
> On Mon, 14 Jun 2004, Yuval Yaari wrote:
> 
> > 1) CDBI in general, how it saved my life, things in theory
> >    (relationships, etc). To make a long story short: less code.
> 
> i'd love to read it on the mailing list.

I would give a preface for that anyway.
Just a much shorter one.

> 
> > 2) Hands-on: how do I make a CDBI project? How do I define my DB/tables?
> >    How do I create relationships? More code, less talk.
> 
> This is more interesting to see in the lecture.
> 
> > Having 0 (z-e-r-o) SQL is great.
> > Database changes that doesn't necessarily "hurt" your code is devine.
> > Not writing SQL makes development time so much shorter.
> 
> If you can demonstrate these issues on a hands-on lecture it
> will be very useful.

A hands-on lecture could be nice, BUT:
- I need my editor.
- I need perl, and CDBI installed
- I need a DB (MySQL works great with CDBI, you don't need to define
your table structure)

Laptop donations are widely welcome :)

> 
> > Anyway, I guess Gaal will make you understand the "why use CDBI" part :)
> 
> Gaal? Can you explain why?

He has a Maypole lecture.
I will explain "why".

> 
> > Tell me of everything that you would like to know about it (I am no CDBI
> > guru, but I guess I could dig stuff up if I don't know them) or forever
> > hold your peace.
> 
> 1. What is the roadmap to follow when you have data
> structures that you'd like to query or maintain through a
> database? How would you map them to database tables? Are
> there things to keep in mind when you do that?

Class::DBI is a DB interface, not an interface for your data-structures
(unless you mean... databases...).
I assume your databases are well-designed, but after 1 test project with
CDBI I already knew how my tables are going to look in the next
projects.

> 2. Given a mapping between your data structures and your
> database tables, what sort of interface to the database is
> preferable?

I don't understand your question...

> 3. How to maintain (read: survive) changes in your data
> structures? What can you do in advance in order to reduce
> the amount of code to be changed in such cases?

Basically, if your database is well-designed and gives you all the data
you need, you shouldn't get into these situations.
I will show what happens when you need to change your tables.

> 4. What is the roadmap of dumping a database full with data
> back into your original data structure(s)?

Use storable :)
Basically, I never start with a datastructure and then put it in the
database, and then load it back.
I personally use storable;
Give me an example, and I will demonstrate how I'd do it in CDBI...

> 5. How do you hide your SQL? Where do you end up writing
> your SQL after all?

I don't hide and I don't write SQL - that's the beauty of it!
I have complete projects with no SQL in them, that are completly based
on database values.
I knew you're misunderstanding CDBI, come to the lecture :)

> 6. When doing a project which involves a database, what
> things hace to be known up front? What things are best to
> workour later?

You won't be using CDBI w/o a database. I don't think that's possible.
Desigining your database and tables to store all the data you'll need is
a good start.
Since we're not naturally born DBAs, we do make mistakes.
Personally, I find myself thinking of my data and asking myself "do I
represent it in my DB?".
So I will show how to change your tables, relationships, etc.

> 7. Are there any portability issues? How one can handle
> them?

I don't think so, but then again, it's based on a few modules, so it
could be.
I wouldn't know, I use one OS.

> 
> I think that one can relate to these in a lecture in a
> theoretical way or in a practical way. I'd be more
> interested in seeing the practical side of things, having
> theory only mentioned briefly, so that we end up seeing real
> engineering decisions and implementations rather than
> theorms.

I think the practical way would answer more questions.
Now keep 'em coming because I have to add stuff to my lecture.
[Did I mention that I'm not a CDBI guru? I just use it...]

  --Yuval




More information about the Perl mailing list