Doing the right thing should be easy
It’s the framework maker’s job to make doing the right thing easy. I was reading an article this morning, and came across this quote:
The right thing should be the right thing partly because it’s easy and natural to do. If the right thing is unnatural, that is kind of an environment smell. It’s beyond a code smell. It’s telling you something.
– Rod Johnson (Founder of the Java Spring framework).
Which is another way of saying:
There should be one — and preferably only one — obvious way to do it.
– The Zen of Python
I think TurboGears is actually pretty good about making the right thing seem natural. Heck Bruce Eckel has said:
I think this is the first time a web framework’s functionality has been so obvious”.
But just because we’ve done a pretty good job in the past does not mean that we shouldn’t be working to do better. And there’s one area which has been bothering me a bit recently.
I want RESTful web services to feel more natural to write in TurboGears. The new TG2 lookup method allows you to use the URL as a way to instantiate a resource object and call methods on it, which is an important first step. We probably should also extend the object dispatch mechanism to call different methods based on HTTP verbs, which I think will help.
And of course in TG2 you can just use Routes to create more restful resources, but this feels a unnatural to some TG users who are very invested in object dispatch.
Either way, REST is something that is often (though not always) the right thing to do, and we need to make it so that it needs to feel natural to TG programmers.
1 Response to “Doing the right thing should be easy”
[...] it seems to be more alive than I expected and hopefully, we’ll see a 2.0 soon. In “Doing the right thing should be easy” by Mark Ramm, you can find more [...]