implements Elegance {

// Elwyn Malethan's musings on software development, mountain biking and general navel–gazing...

SeemoreJ

SeemoreJ is a lightweight MVC2 framework that I have developed as a pet project. This site runs on SeemoreJ, amongst other things. "Another one!?" I can imagine some people exclaiming. SeemoreJ is different, honest! I've developed a lot of apps using Struts 1 & 2 and I‘ve dabbled in some other Java-based MVC2 frameworks. They all have one thing in common. They‘re all terribly verbose and somewhat obese.

SeemoreJ is open–source and freely available under the LGPL on Google Code.

Verbose? Obese?

The one thing that strikes me with the majority of the popular Java web-frameworks is how much effort one has to go just to say “Hello World!”. The number of files that need creating because of how few assumptions are made is a real hindrance to a quick bootstrapping of a new project, Even one as simple as Hello World

I have also developed a number of apps using Rails and Merb. I have my issues with both of these but the one thing they are good at is allowing a developer to concisely and quickly build web applications. This is because that while these two frameworks aren‘t limited in their configurability (well, ActiveRecord is useless for legacy data and Rails more or less requires that you use it) they do make a lot of sensible assumptions that allow a developer to just get on with things. That is my main motivation in developing SeemoreJ.

I initially implemented Seemore in PHP just as an experiment, but quickly rediscovered why I hated developing in PHP (I had a job as a PHP developer for 2 years) so I ported it to Java. I've got a lot to do before it can be considered anywhere near a viable alternative to the current crop of MVC2 frameworks. I'm currently working on a simple annotation-based validation framework (I'm currently using Hibernate Validator for this) and automagic request to bean population, which will lead on to a make_resourceful-style autoCRUD and scaffolding. When I think it is worthy of public view I‘ll make it available for feedback and the critique of my peers.

As a quick illustration of how concise SeemoreJ allows one to be when developing web applications, below is an extract from the controller class for basic CRUD functionality.

package com.malethan.blog.app;

import com.malethan.seemorej.*;
import static com.malethan.seemorej.HttpMethod.*;
import static com.malethan.seemorej.SeemoreJ.request;
import static com.malethan.seemorej.SeemoreJ.response;
i
/* ... */

/**
 * <p>Controller for the website</p>
 */
public class BlogController {
    //----------------------------------------------------------------------- Filters

    @BeforeFilter()
    public void loadPageArtifacts() { /* ... */ }

    @BeforeFilter(include = "new")
    public void clearSesssion() { /* ... */ }

    //----------------------------------------------------------------------- Actions

    public void list() { /* ... */ }

    public void show() { /* ... */ }

    public void edit() { /* ... */ }

    @Accepts(method = POST)
    public void delete() { /* ... */ }

    @Accepts(method = POST)
    public void update() { /* ... */ }

    @Accepts(method = POST)
    public void create() { /* ... */ }

}

A controller is usually a POJO where each action is a public method. By default, a JSP view of the same name will be looked for to render for the action.

Common tasks that need to run before and after actions are configured using Annotations BeforeFilter and AfterFilter respectively.

An Accepts annotation can be used to limit the HTTP method allowed for a given action.

When I have some time I‘ll give a more comprehensive account of what SeemoreJ is and how it works.

First published on Nov 18, 2008. Last updated on: Dec 30, 2009.

Comments (4)

Leave a reply »

 
 

... I‘ve been mentioning SeemoreJ in passing for a while in my posts on here. I‘ve …

 

... In my last post about SeemoreJ I gave an account of how one might bootstrap a ne …

 

... s post I‘m going to be talking about how SeemoreJ deals with deciding what format to present a reso …

 

... e=“”easyb out on testing this website and SeemoreJ in the next few days and I‘ll be posting my …

Leave a Reply

Your name
 
Email
 
Website
 
Comment

You may use Textile notation here
 
 

Please perform this simple arithmetic test to prove you are human
 
 
 
People I like
Other sites