ONJava.com -- The Independent Source for Enterprise Java
oreilly.comSafari Books Online.Conferences.

advertisement

AddThis Social Bookmark Button
Article:
  Introducing JavaServer Faces
Subject:   Promotes an Old School Way of Thinking
Date:   2003-07-31 06:00:28
From:   sethladd1
Thanks for the great article. I enjoyed having JSF displayed for me.


This technology, and its baby brother Struts, seems to be solving the problem in the wrong way. JSF and Struts are both verb centric. That is, they promote actions being taken. These actions are the Resource themselves. The nouns in this world, the objects we want to act on, seem like second class citizens here.


In a RESTful web, the nouns of the system are the first class citizens. The verbs are just the HTTP methods (GET/POST/DELETE/PUT).


Struts, and from what I can tell from JSF, promote the opposite. The promote things like addUser.do. What Resource is this? How do a GET addUser.do?


I want to interact and identify the User I'm adding, not the method by which I'm adding the User. Identifying the User directly is much more useful in the long run.


Want to see the user?
GET /users/12345


Want to update the user?
POST /users/12345


Deleting is a bit harder, because web browsers don't support DELETE natively. ugh.


My point is, when building web apps, think about them as a hyperlinked collection of Resources and their Representations. There is a heavy emphasis on Nouns here. Don't think of building web apps as a set of callable methods. Early incarnations of SOAP tried to work like that, and it fails.


GUI/Event programming might work great in a local GUI app, but in a distributed information system such as the web, we need a different paradigm. This is where REST helps us.


1 to 3 of 3
1 to 3 of 3