On 01/30/2010 12:02 AM, Vladimir Dronnikov wrote:
> To say the truth, I'd even prohibit use of DELETE to actually delete
> smth. Deletion is way dangerous operation. Especially when cascading
> is on.
>   

While I agree that deletion is a dangerous operation, how dangerous
depending on the data being deleted, I disagree on prohibiting it. In
fact, I believe it is saner to use that verb over POST or gods forbid --
GET (which is, unfortunately, not uncommon)!

Why? Because it is a distinct verb. No doubt about its purpose. The
alternative is to pass a flag through POST which can lead to sloppy
design especially if POST accepts also creation and/or alteration of
data. Complex controller code only increases probability of mistake. I
don't even want to begin a rant on delete via GET.

You mention cascading. I assume foreign key cascading in the db? One of
the mistakes when doing REST is to consider the transactions in the
scope or sense of a database transaction. They are not the same.

However, delete should not be dangerous if you know what you're doing.
Mapping the action to the DELETE verb only facilitates the attention:
there's no doubt about what the action should do, so you proceed with
safeguards. You don't do IFs and IFNOts, checking extra flags to see
what the action might additionally mean (unless it is to represent a
condition of delete, but nothing else).

Additionally, having a "deletion resource" or queue, or marking subject
for deletion before actual deletion is something that can be perfectly
handled by stored procedures and table/row triggers: no soup for you if
the flag/deletion resource is missing! That way you can't even
"accidentally" go to the SQL prompt and to DELETE whatever FROM
wherever, because the trigger would prevent deletion without proper
flag/resource set. Gods forbid that you forget a where clause. :)




Vlad

-- 
You received this message because you are subscribed to the Google Groups 
"pylons-discuss" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to 
[email protected].
For more options, visit this group at 
http://groups.google.com/group/pylons-discuss?hl=en.

Reply via email to