Saturday, January 07, 2006

Slashdot | MySQL 5 Production in November: "Triggers are hidden *data* logic, and they should be hidden. They have the added benefit of being asyncronous if you choose, so if you need to write data fast, you can still lay it out in another format, or do something else arbitrary to it.

Stored procedures are like PERL

Agreed. But when you need them, you need them. They also go hand-in-hand with triggers frequently.

Views are a nice feature, but most often used to support business and reporting.

Views are an abstracted view of data. You can have a table called subscribers with lots of columns that tell you the status of the subscriber, and a view called current_subscribers that encapsulates all that logic.

(psuedo sql)
create table subscribers (id, start_date, end_date, cancelled, payment_is_late, is_overdue);

create view current_subscribers as select id from subscribers where start_date now() and cancelled = 'N' and is_overdue = 'N';

You could argue that this logic belongs in you DAO, but that only works if you have one DAO runtime, which is not true for a lot of application environments."

0 Comments:

Post a Comment

<< Home