This is Sick. And Wrong. :) My first pumpkin: VOTE
Oct 29

Trails and Matt’s AppFuse

Java, Tech, Web Frameworks Add comments

Matt has written about Trails – like Rails, but with Tapestry, Spring and Hibernate.

I put in a cheaky comment to see what a video on setting up a simple web application would look like. Matt thinks it would be 20 minutes long. That is on a good day, with no mistakes. Compare this scenario to the Rails demo.

Matt talked about how we seem to produce so many files in Java, due to the way we architect things:

model.Person
dao.PersonDAOTest
dao.PersonDAO
dao.hibernate.PersonDAOHibernate
service.PersonManagerTest
service.PersonManager
service.impl.PersonManagerImpl
webapp.action.PersonActionTest
webapp.action.PersonAction
web/pages/personList.jsp
web/pages/personForm.jsp

The last two JSPs can be generated, but that’s still a buttload of classes (9) just to CRUD (and test!) a database table. Not too mention all the files you need to edit for Spring and i18n.

dao/hibernate/applicationContext-hibernate.xml
service/applicationContext-service.xml
test/web/web-tests.xml
web/WEB-INF/classes/ApplicationResources_en.properties
web/WEB-INF/menu-config.xml

Ouch. Matt also pointed out that he has had requests to add support in AppFuse to generate all of these files for you. This would look good in a demo, but how about maintainence?

This is an issue with code gen in general, and one that you see a lot in languages like Java. Even with tools such as great IDEs (IntelliJ/Eclipse) and and code gen, that only helps when you are writing the code. What about reading it (which you do a lot more of in a applications life time (hopefully!)).

What I like about Rails is that it isn’t about code gen. It is about smart defaults which are extension points. For simple CRUD dynamic web sites the defaults can work well, and your application is done quickly. If you need to extend the functionality then you get in there and put in the extension points (in this case, you normally just create the right methods / objects).

I have always liked the mantra of:

make simple things simple, and hard things possible

I think that a lot of frameworks don’t allow this.

I also think that there is a HUGE difference between a dynamic website, and a web application, and would choose very different tools depending on which of these I am building.

There are many great choices out there.

Leave a Reply

Spam is a pain, I am sorry to have to do this to you, but can you answer the question below?

Q: Type in the word 'ajax'