Forcing FunctionIf you’re building a RESTful web app, you’re forced to think about your domain in terms of resources and simple CRUD operations on those resources. Lots has been written on why resource orientation is a good thing, so I won’t rehash those reasons here. I’ll just say that to me, achieving modularity and loose coupling via resource orientation feels like the least labored way to do it. In other words, I rarely feel like I’m straining the resource metaphor when I talk about what resources my app would consume/create. I also find it more natural and more straight forward to reason about, especially when compared to other layering or service oriented techniques.
Free APIAnother benefit of building RESTful web apps is that you get a set of APIs for your domain for free. Want to build a mobile client? No problem, just use these APIs we already developed and tested. This stands in stark contrast to more “traditional” web applications where exposing your data to other consumers requires a whole new development effort. Now, I should note that you’ll likely need to bullet-proof your APIs before exposing them to external consumers. After all, we tend to take shortcuts when we have complete control over both the consumer and the producer of the APIs. This is normal and reasonable because the extra level of rigor is simply not needed. So, you will probably have to go back and add things like additional authentication mechanisms, more robust validations, better logging, more consistent response codes, clearer error messages, etc. That said, the effort to get these APIs prepped for external consumption is considerably lower than building them from scratch.
You may also like:
Did you love / hate / were unmoved by this post?
Then show your support / disgust / indifference by following me on Twitter!