Arsenalist

The Toronto Raptors Blog with an Arsenal touch

Archive for April 17th, 2007

Fabregas for President; Rosicky for VP

Posted by Arsenalist on April 17, 2007

Cesc should shoot the ball way more, definitely more than Baptista or Hleb and probably just slightly less than Rosicky. Both scorers from Saturday registered again and Rosicky’s goal was eerily similar to the one against Bolton. This time the defender was poor Nedum Onuoha (who?). Onuoha waited for the ball like it was a bus while Rosicky just dashed in to strike it home. Check out the beauty that was the Fabregas goal:

But let’s face it, Manchester City is a shit team that was way too content on not being relegated to actually come in and steal some points. Arsenal could’ve probably scored three more goals (as is typical Arsenal) but I’ll settle for three. Adebayor should’ve definitely scored after being setup by Rosicky but he hammered it straight at the defender, anywhere else and it’s a goal. The man most hated by Arsenal fans also scored which came as a shock but on further notice you’ll see that Hleb did most of the work.

It’s worth a mention that we’re in third place right now but it really doesn’t matter, maybe if somebody wants to hold it over the Kopites that we’re one better, but I couldn’t be bothered. This was the first game in a while that Jens looked like a nervous wreck, his girly clearance was the reason for City’s goal and a couple times he tried to catch the ball by going over his own defenders. Alls well that ends well though. Gallas did a good job on Vassell by using his strength to his advantage. After City scored Arsenal didn’t look too good and Gallas and Toure had to do some clever work to prevent further damage.

The commentators were ripping Arsenal fans for being so quiet and said the atmosphere was similar to the “Highbury Library”. The game wasn’t sold-out (or if it was, they didn’t show up) but it didn’t sound that quiet when I watched it. C’mon you Londoners, make some f***ing noise!

This one goes out to my only loyal reader Sex Fabregas.

Here are the complete highlights and analysis. Check out Shebby Singh though, after Baptista scores, he goes that’s “routine for him”. Putting away chances is routine for Julio Baptista? What games has this guy been watching?

Full Time Report including highlights and analysis from ESPN

If you do care about the Tiger Halftime Report, I’ve uploaded that as well.

Posted in arsenal, man city, premiership | 4 Comments »

Are JSPs dead?

Posted by Arsenalist on April 17, 2007

That’s supposed to be a rhetorical question, of course they’re dead. They died a long time ago when it dawned on us that they were nothing but untestable, overweight slobs that only ever existed because of ASP. Anybody who ever used JSPs has at some point, sworn by them, marveled at how great they are and felt really, really excited to write actual Java code inside pages. But it was only a matter of time until some of the lesser known facts about JSPs became more and more prevalent to the point of that templating languages were forced into creation to combat the shortcomings of Java Server Pages.

JSPs are the ultimate contradiction to Java reusability, there is simply no mechanism in J2EE which allows even an honest man to reuse a JSP. If you’re thinking of <jsp:include>, you’re missing the larger point of reuse - reuse as in other components of the application or even different applications. Of course being confined to a Servlet container kills off any chance of reuse in the SE world along with making testing so hard that you’re forced to mock an application server just to see what’s rendered. The direct binding to a Servlet is also something that never amused me nor did I find the behind the scenes conversion from JSP to Java to Class file ever a needed exercise. Why bother with an extra compilation stage when you’re already serving your page from a compiled Servlet?

Be advised that if you’re still considering using JSPs as the V part in MVC for even a mid-sized application, you’re making a mistake. This is especially true if you’re using JSPs as purely a view mechanism (no actual code in the pages but just taglibs) since you’re not even taking “advantage” of the ability to write Java code in them. If you are one of those folks who thinks the <c:sql> library wasn’t the ultimate example of bad ideas, you might actually still be using scriptlets in your pages and passing them off as acceptable software. You, you just keep doing what you’re doing, there’s no help for you.

Not too long ago a colleague of mine stumbled upon a major bank website (TD Canada Trust) who had managed to seriously screw up their application server configuration and ended up serving the raw JSP page instead of actually executing the code in it. Needless to say the code looked like crap with request.getParameter() being used more often than white space to compute user states in a banking application. It was one of those “this page can do a lot of stuff so I’ll just write a lot of ifs to figure stuff out” type things. What I’m trying to say is that JSPs promote shoving control logic in your pages no matter who you are simply because it’s so easy to fall into the pitfall that are scriptlets. It’s best to eliminate the temptation and use a dumb templating tool to render your views because let’s face it, they’re views!

What to use if not JSPs? Plenty of choices including Velocity, Jamon, Freemarker, StringTemplate, JByte etc. All good options with Freemarker being my favorite because of it’s lightweight nature, templating prowess and out-of-the-box support for Taglibs. Whether you’re templating a simple email to be sent out or a full-fledged page, the concept remains the same. Add in very easy Struts 2 integration for both Velocity and Freemarker and there’s little reason to rely on JSPs to do anything.

I used Selenium as a functional testing tool and realized that I was falling into the pitfall of checking the content displayed on the page to test whether the correct business logic was being performed rather than whether the correct view was being returned (think about it, there’s a difference). If you use a templating engine other than JSP, you can quite easily test the former without having to resorting to a functional testing tool.

As AJAX is becoming more and more popular, JSPs are getting further phased out. Lot of developers prefer to return chunks of HTML from the server rather than an actual dispatched forward. A lightweight and powerful template language is much more suitable here as your AJAX interface view will be an aggregation of snippets of HTML returned from the server. Doing this using JSPs would add a level of complexity that is both undesired and unneeded.

Having said all that, you can produce the same product with both JSPs and other lightweight template engines, but the latter stay much truer to the MVC philosophy and result in a much cleaner code base.

Note: Comments are disabled as this is a posting from my java.net blog.

Posted in java, jsp, tech | No Comments »