Why some web frameworks don’t distinguish between GET and POST

Daniel Hinojosa asks What the hell ever happened to doGet() and doPost()

It occurs to me that perhaps the framework authors believe that if you use the same class (an Action in Struts-speak) to process both GETs and POSTs, then perhaps you’ve got a design flaw.

The argument here would be that the URI you go to generate a form perhaps shouldn’t be the one you submit the form back to. When using a web framework, creating new URIs is cheap, after all.

This would obviously revolve around alignment of responsibility; a class that needs to handle GET and POST differently is possibly taking on too much responsibility.

Now, I should make a disclaimer here: I don’t program like that myself. In fact, the custom base class I use for my Struts Action splits up the request handling into GET/POST methods; a classic use of a supertype. But I’m wondering if my webapps would improve if I didn’t make this distinction.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s