Apr 08

Apache Beehive PageFlows vs. Spring WebFlow

Java, Lightweight Containers, Open Source, Tech, Web Frameworks 5 Comments »

Way back in time I worked on early releases of BEA’s Portal server. At the time they had their own MVC framework webflow, and it was a little painful to use (Remember the Rational ROSE tools for the Commerce product?).

However, that was many many years ago, and it has gotten better each release.

Now a lot of the same learning, is in place with Apache Beehive NetUI and PageFlows frameworks.

The Spring guys came out with a WebFlow component, which covers some of the same ground. How do they compare? At a high level their pro’s are:

Spring WebFlow:

WebFlow, although immature, does have an interesting goal in that it works on top of ANY web framework, and isn

Mar 28

Continuation on the Web explained

Tech, Web Frameworks 7 Comments »

Mikael has got an interesting perspective wrt Continuations on the Web.

He talks about his path, taking a simple command line app which takes response from a user, and seeing how it maps to the world of the web.

I have been interesting in this marriage for awhile. I do like thinking of the users session in this way.

There are some good frameworks out there that support this style, such as:

And many others dabble…

Mar 22

META-INF/context.xml

Java, Tech, Web Frameworks 21 Comments »

It is always frustrating if you have to munge a server.xml in Tomcat, or the equivilent in other servers. At that point, your nice deployable .war file requires a README that says “oh, and make sure your server.xml is setup like this…”.

At least now we have a feature that lets us put context information in the war file. I didn’t know that Tomcat supported this until recently:

<?xml version="1.0" encoding="UTF-8"?>
<Context>
<Resource
auth="Container"
description="DB Connection"
name="jdbc/ebackbay"
type="javax.sql.DataSource"
password=""
driverClassName="com.mysql.jdbc.Driver"
maxIdle="2"
maxWait="5000"
validationQuery="select * from testdata;"
username="root"
url="jdbc:mysql://localhost/ebackbay"
maxActive="4"/>
<WatchedResource>WEB-INF/web.xml</WatchedResource>
<WatchedResource>META-INF/context.xml</WatchedResource>
</Context>
Mar 08

Better, Faster, Lighter Ruby

Java, Ruby, Web Frameworks 16 Comments »

Justin Gehtland, co-author of Better, Faster, Lighter Java, has blogged about his experience porting an application running on a Java stack (Java/Spring/Hibernate/JSTL stack), to Ruby on Rails.

On speed of development

First of all, I

Mar 03

Selenium: javascript test tool for web applications

JavaScript, Open Source, Tech, Web Frameworks 3 Comments »

ThoughtWorkers have released a test tool for web applications named Selinium.

Selenium tests run directly in a browsers, just as real users do. And they run in Internet Explorer, Mozilla and Firefox on Windows, Linux and Macintosh. No other test tool covers such a wide array of platforms.

  • Browser compatability testing.

    Test your application to see if it works correctly on different
    browsers and operating systems. The same script can run on any Selenium
    platform.

  • System functional testing.
    Create regression tests to verify application functionality and user
    acceptance.

Selenium uses a unique mechanism which allows it to run on so multiple
platforms. Installed with your application webserver, Selenium automatically deploys it’s JavaScript automation engine — the Browser Bot — to your browser when you point it at the Selenium install point on your webserver. Thus, you must have write access to the machine your web application server is running on to install Selenium.

To get a quick feel, checkout an example TestRunner and run all of the tests. You will graphically be walked through the tests, with changing content letting you know what is passing and failing.

How does Selenium work?

Selenium uses JavaScript and Iframes to embed a test automation engine in your browser. This technique should work with any JavaScript-enabled browser. Because different browsers handle JavaScript somewhat differently, we usually have to tweak the engine to support new browsers.

Feb 28

Railing on performance with lighttpd

Ruby, Tech, Web Frameworks 1 Comment »

TJ Vanderpoel has stepped up to the commenter to my earlier entry who claimed bad performance:

As far as scalability, apache with fcgi certainly isn’t the best option, for rails. In our environment we have one lighttpd process serving requests in a round-robin fashion to from 10 to 100 fastcgi rails listeners. We move anywhere from 300 req/second to 1000 req/second with a dual opteron webserver and the fastcgi listeners can be well in back of the webserver. The only feature i’d like to see added to lighttpd is to be able to add fastcgi listeners on the fly, currently you have to restart the webserver to add listeners. Nonetheless, if you’d talked to rails developers you’d have learned lighttpd is the recommended hosting platform for production applications, as it takes care of many of the speed, and all of the scalability issues.

Mod_Perl

There are many options (apache, FastCGI, mod_ruby, builtin dev server, etc), and these options make me think way back to when I was developing a large scale application with mod_perl. This was when mod_perl just came out, and man was it a pain to test our app under it.

The biggest problem was that at the time, many module writers, and coders in general, didn’t have to care about memory leaks that may occur in CGI scripts. The process is nuked in a few ms, so why both trying to hunt them down?

mod_perl showed everyone how much bad stuff was around :) It was a little like taking someone who has only developed with “implements SingleThreadModel” and taking that out of their servlets. Items they never ran across would now rise up :)

Watch lighttpd and the updated Rails 0.10.0

There is an updated screencast of Rails 0.10.0 which features lighttpd.

You will see some of the changes in the new release, and as always, it is always interesting to see when ‘errors’ show up and how the man behind the screencast solves them. I am always surprised when browser windows are started, that the default page isn’t always about:blank or about:mozilla ;)

Great stuff :)

Feb 28

Stop the FUD on Rails Performance :)

Java, Ruby, Web Frameworks 2 Comments »

Well, Matt has done his job on blood boiling :)

He has run with the comment from one person on this blog which claims slow performance of Rails.

We all know how bad random performance claims are. After all, I think we should show that a Rails PetStore app is a lot faster than “J2EE” ;)

Look at the apps that are written using Rails, and there are more and more showing up on the mailing lists. If it was so slow then they would be shouting about it.

Tadalist and co, all seem to run very nicely from my end too, and I have never experienced a problem with a Rails app.

It is also pretty easy to scale most web apps that people are building. How many are truly ‘enterprise apps’ that people like Mike Spille work on :)

Let’s stop the mud flinging a la ‘JVMs are too slow. How can you not write this in C!’ and let people make their own mind up with testing on their own apps!

My guess is that if someone gave it a try they would be very impressed with the productivity gains, and the app would surely run ‘fast enough’ ;)

Feb 25

Rails for the poor Struts guys #2

Java, Ruby, Web Frameworks No Comments »

Brian has written his second part article, Rails for Struts-ters, Part 2: The Views.

As the title implies, he goes into detail, comparing the view side of Struts vs. Rails. If you grok Struts, you will understand the rails side from this.

It also clears some myths such as “Rails doesn’t have SiteMesh capability” which I have heard from quite a few Java developers.

Rails Layouts

Final thing to look at in views is layouts.
The quasi-official tool for this in Struts is Tiles, but I prefer Sitemesh, so will use a sitemesh example.
Rails has Layouts, which are the same conceptually as Sitemesh decorators. Here is one

<html>
<head>
<title>Brian and Joy's Wedding</title>
<link href="/stylesheets/scaffold.css" rel="stylesheet" type="text/css" />
</head>
<body>
<%= render_menu %>
<%= @content_for_layout %>
</body>
</html>

The layout gets wrapped around any rendered output, with the output going at the <%= @content_for_layout %> point.
The easiest way to use a layout for all views is to just have a layout named application.html, and it will be used implicitely.
You can explicitely use a layout by declaring it in the controller, a la

class GiftController < ApplicationController
layout 'scaffold'
before_filter :require_logged_in

which will have it look for scaffold.rhtml to use as a layout. Sitemesh uses an external XML file to configure these, under typical usage, but it is conceptually the same.

Great stuff Brian!

Feb 24

Rails 0.10 Released

Ruby, Tech, Web Frameworks No Comments »

David and the Rails team have announced Rails 0.10.0: Routing, Web Services, Components, Oracle.

There are lots of good new features, but one I am excited about (thanks to Brian Mc for pointing it out) is the Action Web Service.

Now I can be in my corner writing more Ruby code, and having other folks talking to me via SOAP (ok, I am not a big fan of SOAP… but hey).

Congrats to the Rails team.

Feb 22

Drinking the Ribena rather than Koolaid

Ruby, Tech, Web Frameworks 341 Comments »

There is yet another blog discussion about Ruby on Rails vs. Java web frameworks.

I think you find this type of discussion all over with the generic version being:

Technology X is simpler than Y so it either:

  • Is too slow
  • Is TOO simple
  • It doesn’t scale
  • It’s dad got beaten up by my dad

We are getting some of that at the moment. David Geary of JavaServer Faces fame (and fellow NoFluffer), and Matt Raible started on the rants.

Then the Rails creator, David Hannson came back at them.

It is interesting that David isn’t sure that showing the scaffolding piece in his demo was a good thing. Scaffolding lets you do a quick “there is my database, give me active record access to it now please”. You will end up with actions/views for your model at this point, which is nice for getting started / prototyping, or for simple “Naked Object” access for admins. Even David admits thats it probably shouldn’t be used in ‘real projects’.

So, my view on this?

Is Rails too simple?

It is simple in a good way. You can get started very quickly. You can incrementally tweak your architecture and extend Rails where needed BUT NOT BEFORE. I can start with scaffolding and then move to handling the model more myself. Basically everything is there for you to hook in.

Is Rails too slow?

Although I haven’t had the pleasure in deploying a Rails solution to a high end site, I have never had any problems, sites that run it are speedy and consistent, and there is NO REASON why Rails would force a slow application. Of course, a badly developed application that uses Rails could easily be slow (as with everything).

Can Rails Scale?

Web sites can easily scale as long as you have written your application in a way that can handle scalability. Ruby, and/or Rails, has nothing implicit about it which says “this can’t scale”. I know that the Java camp tends to think that it is the only scalable solution for “enterprise” apps, but it isn’t ;)

Rails isn’t the be all and end all of web frameworks. There are always going to be pro’s and con’s between two frameworks. I personally sometimes like rich components (a la tapestry), although there is nothing stopping you from building these components that you could reuse in Rails.