Any and all feedback on the use strict 'sql'; presentation would be welcome. It still needs some work and naturally, since it's only slides, much of the context is absent. Plus, I biffed a few images and need to clean up the KPresenter HTML. Hopefully, I can get this done before Wednesday.
Miscellaneous notes for context:
The idea that I am working on is combining a very lightweight persistent object system with phrasebooks. This is hardly a novel solution, but what if the phrasebook SQL is built dynamically and cached to disk? Each object knows its table and column names and by running a registration system, each object can register its dynamic SQL via a registration class. However, in production, the registration class is not used and instead the cached copy of the SQL is used. If you need to change something in the database, you can update the information in one spot, reregister the changes and everything automatically picks it up. The SQL would be readily available to hand to a DBA and much less dynamically generated SQL would be required at runtime.
This would be very useful for building projects with much refactoring or redesigning an existing database, but might have less utility with a larger system that's already in place and fairly static. Also, trying to come up with a clean, simple API is going to be a challenge. Is it even worth it? Would anyone be interested in something like this?
Some of the POOP modules seem to have performance issues because they try to do so much. Currently, my core code is only about 400 lines, it's fast and wouldn't grow too much. I think it's a good idea, but it can easily be brought down by a poor implementation.
Re:Slyness
Ovid on 2003-04-07T19:54:03
You have made my day
:) Given that much of the context is left out (i.e., you don't get to here the presentation), did the slides make sense?
Re:Slyness
Ovid on 2003-04-07T19:54:39
s/here/hear/Shoot!
Re:Slyness
petdance on 2003-04-07T21:11:03
I pretty much skimmed the slides. I'm interested in the Class::Phrasebook stuff, but not sure how I'd actually want to use it in real life.As to the DHH reference, it's extra funny 'cause I sent geoffeg some mp3s from that album the other day...
Overall, I liked it, but I was a database/SQL guy before I was a Perl guy, so I do have some comments. Don't worry, I'm not going to be harsh.
select *
and insert
without a specific column list is very well taken. The problem you specify next, though, is that columns don't contain what they sound like they should. This is the same problem as mis-named variables, or abuse of globals in a Perl program. (Equally bad ideas, in other words.) However, it's not clear than any of the techniques you present later will fix this. If you're afraid of modifying the database, you may be equally afraid of modifying the class. "Let's just shove it in here" can be accomplished in any programming language, with any tool!Now, it may not be clear from the above, but I really liked it. I think you make good overall points, and these are minor points I'm raising. But they may be raised by others as well, so be ready.
Re:A few comments
johnseq on 2003-04-08T13:57:29
A slightly different, possibly complementary approach to schema change management would be parsing the phrasebook SQL to identify the field/table name dependencies. If I change phone to home_phone, I just run my phrasebook through a SQL parser to determine effected queries, and optionally to rewrite them.
I like that approach (as opposed to inlining references to a fieldname registry) because it keeps the SQL a more readable, and the adoption curve lower.