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.

Author: Robert Watkins

My name is Robert Watkins. I am a software developer and have been for over 20 years now. I currently work for people, but my opinions here are in no way endorsed by them (which is cool; their opinions aren’t endorsed by me either). My main professional interests are in Java development, using Agile methods, with a historical focus on building web based applications. I’m also a Mac-fan and love my iPhone, which I’m currently learning how to code for. I live and work in Brisbane, Australia, but I grew up in the Northern Territory, and still find Brisbane too cold (after 22 years here). I’m married, with two children and one cat. My politics are socialist in tendency, my religious affiliation is atheist (aka “none of the above”), my attitude is condescending and my moral standing is lying down.

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 )

Facebook photo

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

Connecting to %s

%d bloggers like this: