Torsten Curdt wrote:

My major complaint against flowscript isn't the concept--its the feeling that I am flying without a net. I don't have a convenient way of testing the javascript. I can't use an IDE to make things even easier. There is something to be said for using the autocomplete function of your favorite IDE as apposed to trying to remember how everything is mapped to the FOM.


Well, then use javaflow :)


I still feel that flow is not the right tool for the simple mapping of action to view. It might be worth it to take a little time, play with Rails to get a feel for it. Imagine the following scenario workin in Java:

class ApplicationController extends BaseController // a Sitemap implementation
{
   // override the default layout for this application
   protected String layout = "mysite";

   protected boolean shouldSayHello()
   {
       return Random.nextBoolean();
   }
}

class hello_controller extends ApplicationController
{
   public void index(FOM context) // note FOM is not a type, but the equiv.
  {
      // the default--fall through
  }

   public void hello(FOM context)
   {
       // This attribute is now ready for the view
       FOM.request.setAttribute("hello", "world");
   }

   public void redirectToController(FOM context)
   {
// The first parameter is the controller, the second parameter is the action
       sendPage("othercontroller", "index");
   }

   public void redirectToActionOnCondition(FOM context)
   {
       String action = shouldSayHello() ? "hello" : "index";
      sendPage(action);
   }
}

We have done a few simple but powerful things here:
* We have one location to update the layout of all the controllers--although an individual controller can override it if they want * The method does any setup necessary, and then the system just "falls through" to the corresponding source file.
* All we need to do to add a new action is implement a method.
* We still have the "redirect" ability if we want to send a specific page (i.e. the sendPage()) method inherited from the base class. * We also have a way to add methods available to all the application's controllers in the ApplicationController base class using the protected methods.

All of these take advantage of the world we already know without having to learn something new. It provides some convenient method of extention.

Reply via email to