Tim's Weblog
Tim Strehle’s links and thoughts on Web apps, software development and Digital Asset Management, since 2002.
2006-01-19

MVC and web apps: oil and water

Harry Fuecks at SitePoint - MVC and web apps: oil and water:

"CRUD is defined in the context of databases where what you’re dealing with is sets of information—you need to make a distinction between inserting into the set and updating an existing member of the set.

Meanwhile HTTP was designed for access to resources, the “primary key” being determined by it’s URL (vs. having to worry about the insert id). If you think “documents”, it’s clear there’s no need to make a distinction between creating and updating—creating a document results in the first version. Updating means overwriting an existing document with a new version. But in both cases the client is POSTing the same thing and does not need to be aware of whether the document already existed or not.

[...] Perhaps our websites have been driven too far by the database? The point here is, given the mismatch between HTTP and CRUD, we’ve put CRUD first which in turns makes actions first class in our frameworks. We aim to support N different types of action (verbs) when really we should have been dealing with only three—GET, POST and DELETE (the latter being perhaps re-routed to a specific “resource class” method according to some framework / form conventions)."