26 May
Posted by suresk as JEE, Enterprise Development, Software Development
It seems like once a month or so, someone comes out with an article about the ‘real’ problem with JSF, how JSF is dead in the water, or how bad it is. I think uninformed articles like these are the biggest problem with JSF right now - go to a JEE forum and read JSF threads, and you’ll see the same unfounded, out of date, and inaccurate reasons why JSF ’sucks’. There are certainly a lot of things that could be improved in JSF, and I agree there are a number of things which are frustrating (radio buttons, anyone?), but a lot of articles tend to focus on old problems or the idea that “JSF doesn’t work the way I think it should”.
Probably the biggest misguided complaint is that JSF components aren’t coarse-grained enough, or that “there isn’t a component that does x, y, and z so JSF must suck!” An article on TheServerSide is the perfect example of this. In the article, Joseph Ottinger asks why there are no login or search components, and points to wiki and forum components from ADF (which are not publicly available yet, to my knowledge) as being perfect examples of what JSF should be. Why are all 4 of these perfect examples of bad candidates for JSF components? The whole point of a component is that it is a reusable piece of functionality. With every piece of layout and functionality you try to encapsulate into a component, you make it harder to reuse.
Let’s take the login component as an example. At its simplest, a login screen in JSF is composed of: a input text component, input secret component, and a command button. There will be a backing bean, but it will be extremely simple - the real work goes on in a method the backing bean would call, and could not reasonably be abstracted into a component. Making a component to encapsulate that would seem easy, but how do we allow for positioning of elements? How do we allow customization of the input text and secret boxes? My system may only allow 4 digit passwords (ie, like a PIN), and yours may allow 20 digit character passwords but only 5 digit numbers for the login. Already, we have a fair amount of complexity to take into account, and it hardly seems worth it when you realize how easy it is to do this without a component. Then what happens once we start adding in stuff like: allowing registration, resetting forgotten passwords, saving passwords, captcha validation, various error messages, etc?
The other examples are equally problematic - several of us discussed the search box example in discussion for the article. What you ultimately end up with is a new API someone has to learn for each component, possibly a templating language on top of JSF to allow for customization, and components that are not really that reusable. How do you reuse functionality like that? Well, on a per project (or perhaps, per company) basis, you can create custom components (and their far easier cousin the composition component available in Facelets) to do these tasks. That way, they match the design and functionality of what YOU need.
Over the several years I’ve done JSF development, I’ve found few cases where I felt like I had to write a custom component. I’ve had great success with reusing functionality with composition components, and achieving most tasks with the standard component set has been quite easy. In fact, the most frustrating experiences I’ve had have been trying to integrate coarse-grained components into an app that had already-existing design requirements.
If someone can show me a good prototype of a coarse-grained JSF component that is highly reusable, I’d be willing to change my tune, but I’ve yet to see one. And, for the record, I don’t think this is a problem specific to JSF - when you look at other web frameworks, acheiving reuse with big monolithic functionality is just as difficult.
4 Responses
maxpower
May 28th, 2007 at 7:12 pm
1I don’t like the complexity (I spent a number of hours with a JSF committer to get simple functionality to work) or vebosity (xml hell) of JSF. Where are the tools promised us to make the use of the framework as simple as drag and drop?
The tools for facelets are pathetic.
Could it be that those who quote JSF as “sucking” do so only because they are using a framework that better suits them?
Does the component model and the web really fit?
Note that Struts2 seems to have unified the component and request based frameworks. Struts2, based on the WebWork2 code, has built in support for JSF, using an approach that smoothly combines both frameworks into one configuration file, one framework. This is pretty amazing since we no longer have to choose between component-based or not. Furthermore, it seems to be the most often used framework in famous software products like jira and web sites like infoq and javablogs. There’s also a plugin for Eclipse that can aid in development. Definitely something to test.
suresk
May 28th, 2007 at 8:43 pm
2I do agree that some things in JSF are unnecessarily complex, and there are things that could be improved. Show me a framework that doesn’t have that issue. Ruby on Rails is hailed as the best web framework around right now, and doing some simple things with select boxes (that would take a few minutes to do in JSF) have taken me hours and been totally frustrating.
While I agree frameworks should always strive to make complex things easier and leave easy things easy, I hate to see frameworks judged on a few cases. It is easy for you to look at a handful of situations like that and say, “yeah, this was really hard, so JSF sucks”. On the other hand, how many things has JSF made easier? Compare development time of a particular screen in JSF vs Struts. JSF is almost always faster to develop with. Compare the amount of code you have to write for each - JSF wins by a long shot there. And, it is easy to forget how many things are unnecessarily complex in Struts also.
XML hell - can’t really agree there though. How much XML do you have to use when building pages with JSF?
I don’t take issue with people saying JSF ’sucks’, I take issue with how people mis-represent it, argue based on problems that no longer exist, or simply are wrong about things. I certainly think other frameworks do a better job than JSF does for certain things. I’d hope the JSF EG would implement the things in other frameworks that are better (and judging by Ed Burns’ draft for JSF 2.0, they are).
Perhaps Struts 2 would be better in certain situations, but neither of us have actually implemented anything with it, so I don’t think it is fair to compare the two at this point. You are also ignoring the fact that JSF is a spec that is backed by Sun and a lot of other groups, and has good integration with a lot of new frameworks such as Seam. How would you implement a conversation context with Struts2?
I definitely do think the component model is good for web development. Look at the reuse we achieve with JSF that we couldn’t do with Struts. Look at the amount of code that we do away with. I honestly don’t see how you could look at a page done in Struts and say “Yeah, this is so much better than JSF”.
Tyler
August 9th, 2007 at 12:28 pm
3You have an interesting hypothesis there. In short, the only reason JSF “sucks” is that people think it “sucks”. Frankly, I don’t buy it. The majority of people who hate JSF hate it because of the headaches they’ve had to go through to get some seemingly simple functionality to work correctly.
I know I hate JSF for just that reason. I’ve had nothing but endless headaches trying to build a JSF based interface for a Java system. There are so very many things that just don’t work, there’s little to no feedback on why things aren’t working, and the actual process that goes on behinds the scenes is intentionally opaque. If anything does go wrong, debugging it is sheer hell. When you do get an error message that indicates an actual problem, rather than the wrong error message entirely, there is a total lack of helpful supporting information to help determine what, exactly is wrong.
The _Real_ problem with JSF is that it is immature, buggy, and dysfunctional. It might still be better than Struts, but that’s a case of proving how bad Struts is, not how good JSF is.
Marc
June 26th, 2008 at 9:37 am
4When hundreds of people say “IT SUCKS”, there’s always someone who sais “no, really it doesn’t. you just don’t understand”. While I have no concrete experience in JSF and to me it just “seems to suck”, I think more effort should be going into what developer’s really need in stead of defending something that many people obviously dislike. Let’s not forget: JSF was a vendor/tool-centric attempt to answer the age old problem that Java simply didn’t have any good UI/web tools. What we should be looking for is developer centric UI productivity tools. Get things done quickly, without a lot of setup/hassles/drawing-board-proved-fail-in-basic-everyday-use functionality. For example, I’m currently desperately trying to find a solution that answers the simple question: “if you use JPA, it should be possible to generate a UI and customize it from there”. Looking around there seem to be preciously little solutions out there (e.g. jpa2web) that answer this question, and those that do seem to be very immature. Why are we “building” so much stuff when most of it can be generated?
RSS feed for comments on this post · TrackBack URI
Leave a reply
Categories
Archives
Links
Meta
Recent Entries
Recent Comments
Most Commented
SpencerUresk is proudly powered by WordPress - BloggingPro theme by: DesignDisease