Monday, March 31, 2008

Javascript Libraries - jquery

I had almost never coded in Javascript before a couple of weeks. For my project we wanted to do some functionality on the client side and I needed to work on javascript. And I did not use much of direct javascript. I used a library called jquery. jquery has been around for more than two years now. There are other javascript libraries as well but I have exposure to none other right now.

  • What jquery claims to be different is the way it uses CSS or Xpath selectors to work with the dom (both html and xml). Comes out pretty short and neat. I really liked that part. made things easy for me in many ways.
  • It has support for ajax as well. I used that as well. Can work with html, xml and json output all of which can be manipulated in jquery/javascript pretty nicely.
  • It has support for some ui components like sliders, capability to create curve edges to tables etc. I did not use directly. Other guys in the project have used.
  • Also there are a bunch of plug-ins which are quite useful.

All in all it was a learning experience. And I did not think before that javascript coding could be this much fun… I still have only touched the tip of the ice-berg, so the opinion can change :)

Another great concept I got familiar with was closures. I have sort of got a hang of it. but not completely yet.

Mean to try GWT sometime as well.

Thursday, March 6, 2008

JSF pitfalls article I read

I found a good article on JSF Anti-Patterns & Pitfalls on theserverside. This covers a good set of JSF pitfalls. I am summarizing them here
1. absence of constructor based dependency injection - The developer has to sacrifice some of the OO flexibility - Use spring instead
2. no provision to pass parameters to the managed bean methods - Developer use various hacks like implementing Map
3. dual call to phaselisteners - this is something which i did not realize - looks more like a bug to me :)
4. huge amount of navigation related xml - this is something we faced - Usage of * can help. This is some trick I probably missed in my project
5. using xml causing runtime exception - this is quite true; may be tools could help - author recommends annotation libraries from Shale and Seam
6. thread safety - some important info in this especially about custom converters and validators. something that should be kept in mind
7. creating component renderer tags with behavior - something to be avoided
8. exposing the entire object hierarchy in el - not sure about this one; done this quite a lot. seems more natural
9. coding to the implementation instead of interface - this is something which we must not do at all
10. not doing view state encryption on client side - good point in terms of security
11. jsf code that is bound to the servlet api - something which i have done a lot I think - this makes it non compatible to portlets - workaround mentioned

That is what is covered. The other issues I faced are already covered in a previous post. Folks who use JSF please keep these in mind