Ruby on Rails vs Grails vs. Spring ROO vs. Spring App [closed] - java

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 9 years ago.
Improve this question
I'm planning on writing a simple web application that will be used by lots of users (as complicated as a simple bookmarking app) and I'm trying to decide which framework/language to use.
I'm very experienced with Spring/Hibernate and Java in general but new to both Grails and RoR (and Spring ROO).
The only reason I'm considering RoR is because Java hosting is MUCH more expensive than RoR hosting (which is supported by almost any hosting vendor for 5$ per month).
Assuming the price wasn't an issue, which one of the frameworks/languages mentioned above would you recommend for a Java developer (who knows how to configure Spring/Hibernate etc.)?
I'm afraid that by using RoR I won't be able to easily support many users who are using the website at the same time.
thanks

First you can have a look to these related questions :
Rails or Grails?
Learning Ruby on Rails any good for Grails?
https://stackoverflow.com/questions/1283935/what-technology-asp-php-joomla-rails-grails-for-a-website-from-scratch
Is Grails worth it?
Is Grails (now) worth it?
Now, I will try to answer you according to your requirements you have communicated and the information I have gathered from the internet and my own experience.
Ruby on Rails
I do not advice you to start with RoR because you are a Java developer and you will have to learn a new language (Ruby) and a new environment (Rails). The hosting issue is not a real issue. You can have a VPS hosting plan for $10 (www.enjoyvps.com) perfectly suited for small grails app. If you application needs more memory, you might need to add another 10 Bucks.
If you hosting is really THE critical factor, go with Python/Django or PHP/Kohanna (a very good MVC framework). Otherwise, according to your background, Grails is more suited for you than Rails.
Grails
Few months ago, I had the same dilemma as yours and I decided to have my way with Grails. Why?
Because it's cool !! I mean, community is very helpful and dynamic, Groovy is a pleasure to develop with (be careful : thereafter , there are good chances that you will loath Java). Also, it is a state-of-the-art framework based on very-well established technologies (Hibernate, Spring, Java) and hence, it can improve considerably your market value as a developer. Grails is my favorite
Spring Roo
Roo is Grails for Java. So if you don't want to learn Groovy and if you need pure Java application (that will always run faster than a Groovy-based app), go with it. The community is smaller than Grails but the project is supported by SpringSource who is quite active in the community. I think that if you want to go as fast as possible, this is the solution for you.
Spring Application
You should choose this option only if you don't like Spring Roo integrated technologies (Hibernate, JSP, Maven...) and you want Java absolutely. Otherwise, there is no interest (except for educational purposes) of spending hours of configuration and tuning when you can build sophisticated enterprise applications in a best-practice manner within minutes (with Rails, Roo or Grails).
Each of the options above will provide you enough performance for the application you want to build. A lot depends on best practices for website applications like good architecture design, correct usage of caching strategies and requests optimization...
My Bottom Line
If you have some time to spend for learning new concepts (Groovy, RAD...), go with Grails. If not, go with Roo. Forget about Spring App and Rails.
If hosting is THE issue, so go with Python/Django. You can deploy on GAE, it's free scalable, performant and you will deal with the same concepts as Rails or Grails.

I don't understand the obsession with runtime performance. Given your scenario your primary focus should be on your performance, as in your ability to get things done with the chosen technology.
You will get more done in a given period of time with Groovy than with Java any day. Often one line of Groovy code will equate to 10 lines of Java code etc etc
Very rarely will byte code execution time be your performance issue, most often its...
Bad algorithm implementation or design.
Bad DB design and / or queries
Taking to long to get things done and then having all sorts of commercial relationship issues because of it.
With web applications you are usually not performing lots of long running CPU bound operations. Most of your request / response time is spent in the wire (internet routing etc) and in the DB (executing queries).
Choose a technology that takes a load off your mind and one that frees you from writing mountains of boiler plate code, so that you can rather concentrate on designing and implementing good algorithms, DB's and queries etc etc
Id personally choose Grails.

I chose Roo over Grails and Rails at my company. Runtime performance, easy debugging, nice Eclipse integration (it's plain old Java after all), no "black magic" happening at runtime. In fact, there is no Roo runtime library needed to run a Roo app, just the library dependencies like Hibernate and AspectJ. You can look at the code that is generated so you know exactly what is going on. Also a biggie for me is that Google has chosen Roo as the preferred tool for creating GWT apps going forward and they are throwing their support behind it. I have been extremely impressed with Roo thus far, I think it will be the tool of choice in the near future.

Performance issues with RoR are going to be caused more by the $5 hosting plan than by the choice of language and framework. Consider Heroku for your hosting, as you can start cheap / free, and then scale up as needed.
For a simple bookmark app, however, Rails is probably overkill. Take a look at the Sinatra framework as well, as you weigh your options.

Have you looked at Gaelyk? http://gaelyk.appspot.com/
It's a lightweight Groovy framework for Google App Engine

I know this post is a bit old. It's 2012 now and Spring Roo just released version 1.2.2 3 months back.
I'm a Java developer & has just started an ambitious project that will see me launching a web application for wide adoption. I'm going through Spring Roo & is getting my hands dirty. My first impressions are nice, but when I read over the Internet about it being a good framework for fast prototyping and only for developing CRUD operations etc. I feel a bit demotivated to use it.
But I personally think that Spring Roo (SP) gets my project started with best practices already implemented with the choice of files created which I can use as template for custom use. Obviously, I'm not afraid to code. We will always have to code ourselves, I don't want any "magic".
I also tried to look around the RoR scene and is easily intimidated by the learning curve involved.
I don't see much traction in the Spring Roo community. Is there any specific reason for it?
Also are there any better alternatives? I'm a bit confused over my decision of finalizing a framework that is both robust and scalable in future. I don't want to be a position where Twitter is now where 2 years worth of RoR code makes them re-think their choice of RoR. Is Spring Roo the best bet for me?

Related

Is it worth changing from java/spring/hibernate to rails for a program that is undergoing massive changes?

I have a project whose core domain is dramatically changing. It's possible to use 50% of the core functionality from this site and just add the 50% new functionality, but I am starting to consider that maybe it might be faster to simply redo the product in Rails. Development speed is very important.
There are some things I really like about java - the performance and scalability are very good. I am not a crappy Java developer, so my apps tend to run very well - better than the Rails sites I've seen. I've always accepted the idea that people probably just throw a little more money at the problem when it comes to using Rails, which probably works itself out in the end because of the insane productivity benefits.
I am actually quite agile with Java. I know it will still take me longer to add a basic entity to the system, but I am quick at it and I don't mind it that much. At least it's easy and straight-forward to do.
What I do mind is:
having to start/stop the server just to fix a route, lazy load exception, controller is going to wrong view, etc.
putting up with the fact that unit/integration tests sometimes have different results than the production environment (because annotations on controllers can't be tested, or lazy-loading exceptions occur during asynchronous service calls, or things like that). Knowing if your Jackson is marshaling your data properly is another Tomcat-only thing because it's handled by Spring. There are lots of things that go wrong after you have tested all that you can, and this frankly annoys the crap out of me.
putting up with the occasional maven/classloader problem that doesn't rear its ugly head until you deploy into tomcat. It gives the false impression that everything is "a-okay" when you are in your IDE.
having to put more effort to do database migrations than the ruby people ever have to.
putting up with framework bugs in Spring that block (it's happened about 5 times on this project since 2009) or Hibernate. I also don't like upgrading Spring Security and having them constantly change the configuration, apis and tag libraries over and over again. This is annoying.
wasting so much time uploading 58 MB war files to the server! These take me 12 minutes to upload whenever I need to deploy changes. If I forgot to do 'mvn clean' before I upload, Spring might complain that 2 beans exist with the same name because I moved one to a new package... and then I have to re-upload the whole stupid war file again. Why isn't "clean" run by default whenever you do 'mvn package' for?!?! Sometimes these frameworks and tools use the stupidest default settings. This is just so common in the Java world.
Having to spend hour(s) to figure out where a framework wants to plug-in your own custom implementation for something. This is very annoying. You can spend 2 hours sifting through Google and crappy documentation trying to figure out how to override Spring Security's authentication mechanism for example... and then spend only 5 minutes writing the actual implementation. Of course, they wrote paragraphs upon paragraphs explaining the architecture and how awesome it is, but nobody cares. For something so common, why not just give example source code and be done with it?
Waiting 10-15 seconds for Spring to start up whenever you want to run your integration tests. This is a drag.
There are a few things I like about Java though. Role-based access is very easy to do with Spring Security. Authentication is never that big of a gain, but I like the implementation inside of Spring.
I also like Spring's form-backing objects and #ModelAttribute. These are huge wins when it comes to controllers, and I don't know if Rails can do these things. I honestly never liked passing request parameters around in every action - Spring MVC is actually a lot easier to use when it comes to this common bloat.
Being able to cache really massive structures in memory and have them stay in memory when you start the application is also highly desirable, especially for this application actually. I have an in-memory thesaurus and grammar checker that needs to get called hundreds of times per request, so in memory is pretty much the fastest option for me.
Even still, I think I could rebuild what I have in 2-3 weeks, and then add all of the new features in a few weeks using rails.
On the bright side, all of the really well-designed css, html and javascript could be ported over with very little problems.
I'd appreciate some advice on the subject before I continue.
PS: I could also go to Spring-ROO... but that would also be a considerable rework. I was never using JPA - I was using Hibernate directly. I am also not using JSP's - I am using Freemarker.
It takes more time to get good at Ruby, and Rails. I worked as an independent contractor as Spring and Hibernate expert myself, but I felt strangled by java and it's web frameworks so I decided to learn Ruby on Rails.
I would advice you to learn Ruby, from what I read you would probably master it, although get pretty frustrated with the very different way the use the ORM. I had issues with it, used to working on aggregate roots in Hibernate to the ActiveRecord one class one table kind of pattern. But hey, you could easily try out MongoDB to have some real fun.
Ruby is
less code
it's fast and scalable (slower than java on the specific tasks, but you get rid of stacks of layers.)
the problems are more often; which gem should I use. Luxorious!
a unique, big, sharing and caring open source community
nice frameworks, as Rails and Sinatra
powerful.
fun!
Would I advice you to do the project you describe in Ruby.
NO.
Not if speed of development matters. You will be slower, trust me. There's a lot to learn, it's conventions are not familiar to a java programmer and when you get stuck, lots of hours fly by.
The best option would be to hire a senior ruby developer to pair up with you and teach you. Be a good apprentice and you'll learn fast. Faster than me, I had to learn most by myself, which is really inefficient.
Good luck!
Check out Playframework. Its fun to develop, and you can use your Java experience to develop features way quicker (given than you have 2 weeks) than any other Java-based frameworks out there.
You do not have to start/stop a server. You fix the code in Eclipse and hit refresh on the browser. No dealing with WAR files till you have to actually deploy in production. Do everything from within Eclipse. Easily perform TDD process if thats what you want as you develop code. From an architecture standpoint, it is a fully stateless, RESTful framework from the get-go. Fully JPA compliant (even for NoSQL like Mongo), so you will not have to write complex JDBC code. On the front-end, it has a full featured templating engine, using Groovy as a templating language.
I can go on and on, but I'd recommend going through the site and take a look.
You should take a look at Grails.
You can continue to leverage a lot of your Java code but use a scripting language (Groovy) and many of the paradigms of Rails. E.g. lots of time saved by using convention rather than configuration.
Grails is used by some pretty big web sites E.g. BSkyB the UK satellite broadcaster.
It doesn't really help with some of the startup speed aspects. If you really prize development speed that much - get a faster machine or buy an SSD and fit in your machine. If you work for a big company - sell it to your manager as the cheaper option (E.g. buy a $2000 machine rather than spend 3 weeks rewriting something to save 10 minutes a day).
Java will scale better in the long run than Rails. The Hotspot technology in the JVM is one of the wonders of modern technology.
Also worth checking out is Tapestry5. It allows you to make code changes on the fly (no server restart required) and is easily the fastest & leanest framework to develop with in Java I've used.
I would still give Spring Roo a shot, it will the same rework as with Ruby on Rails or Grails or even less, but you will still stay with something that you are familiar with, which is often the biggest consideration
It has the scaffolding concepts of Ruby on Rails and Grails, but it gives you zero lock in code, just simple, well written (massive use of AOP is matter of taste though) of Spring + Hibernate / JPA (I think you can use Freemarker for the views, Roo has a miriad of plugins, but I'm not 100% sure)

Grails or Play! for an ex-RoR developer?

I plan to start learning a Java web framework (I love the Java API) I have already used Rails and Django.
I want something close to Java but without all the complexity of J2EE.
I've found 2 frameworks that could be good for me:
Grails
Grails looks great, it uses Groovy which is better than Java for web application (I think..) but it's slower than pure-java based frameworks (Hibernate, Strut, Spring) It looks pretty simple to deploy (send .war and it's ok!), the GSP is great! It's a bit harder to debug (need to restart the server at each modification and stacktraces contain a mix of Java and Groovy traces which is not always the easiest to understand)
Play!
This framework also looks great; it's faster than Grails (It uses Java) but I don't really like how it uses Java, it modifies the source code to transform the property calls as setXXX/getXXX, I do not like that... The framework also has a caching function that Grails does not have. I don't really like the Template Engine.
It's also easer to debug (no need to restart the server, stacktraces are clearer)
What do you recommend?
I am looking for something easy to learn (I have a lot of Ruby experience, not so much Java experience but I love the Java API), fully featured (That's no a problem with all the Java Library available, but if it's bundle and integrated I prefer), has good scalability and is not too slow (faster than Ruby) Ideally I would like to use a framework with a decent community to easily find support.
PS: I am not interested in JRuby on Rails
I switched from Grails to Play and I never looked back. My biggest problem with Grails was overall robustness and developer usability. Most of the time I got bitten by the fact that Grails glues together the usual stack of Spring MVC and Hibernate while trying to hide this fact and giving you a Rails-like API (personal opinion of mine). The problem with this is, once something goes beyond the trivial samples, it easily broke and didnt work for me. Developing with it was like walking on eggs (for me). Whenever I googled for documentation of a feature I needed, I was not redirected to samples, tutorials, blogs, but to the Grails JIRA explaining me why the feature wouldnt work for my use case and that the bug was unresolved since two versions before the one I was using.
While that may not be the overall experience for every developer (I am not writing this to bash Grails, but to give my experiences with it here), I needed something that helped me and would not stand in my way or break down on me when I needed it the most. Thats when I found Play and I have quickly migrated my app to it after I found out about it (around the ~1.0 release).
So far it has been a great ride and for the first time in my web development career, I have stopped looking at other frameworks trying to find something that I would like better.
If I had to close with one thing that Play did better than Grails - at least for me - it would be the fact the Play is built from the ground up with developer usability in mind. It does not sacrifice ease of use for enterprise buzzwords. It has the guts to throw away what does not fit into this paradigm (e.g. ditchting Servlet-based runtimes during development for faster turnaround). It is willing to make compromises in order to guarantee awesomeness. And that is something I have only seen in communities like Rails or Django before I found Play.
I'd suggest Grails. It has a bigger community than the play framework does (~350 plugins covering pretty much every basic need). Also, grails is written almost completely in Java, it just lets you use Groovy for your domain specific implementation.
If you do run into a performance issue where the groovy pages that you've created are the bottleneck, you can always just switch to a Java implementation. Then you're in the same boat that you would have been with the Play framework all the time. You've optimized your development time by putting off the coding of things in Java till you know that you actually need to do it (which, in my experience is very rare).
I'm also not sure where you heard that you need to restart your server for each modification, but that's actually not true. Grails supports reloading of controllers/gsps/services/domain objects, etc without restarting your server.
The mixed stacktraces can get a little long, but tool vendors (like Intellij) have made some recent improvements that strip out all the stacktrace portions that you don't care about.
I've been using grails since the .5 days and have been very happy with the platform.
Take note that the Play! framework now supports using Scala as of 1.1
From my experience with Play it's a great framework. My favorite features are the cool controller system and the template system - both are simple but feature-rich and powerful.
However the most important benefit of Play is definitely the rapid development cycle, where virtually no reloading is needed on code changes. But if you're not careful, this greatness won't last much, and slowness will eventually creep into your code.
Why is that?
With Play there is common use of some plugins with pretty heavy initialization, notably EJB (Hibernate) and Spring. The initialization of these plugins is re-run on every code change before the new code is loaded. As a result of this, as your model and your system configuration grow, this heavy initialization starts to seriously slow down your development. In the system I used 20 seconds were a typical startup time on a virtual machine running on a kickass laptop.
What you can do to avoid this depends on your application, e.g. if you're building a NoSQL application then then EJB plugin should not give you trouble. Spring can be replaced with a custom hard-coded Java plugin, which IMHO is also easier to maintain, or run a Groovy script if scriptability is that important. In any case, watch out for these problems and kill them while the're young - and be sure not to be running your own bulky initializations on every refresh.
If you have used Ruby and Python before, you will probably enjoy Grails better than Play. It very hard to get back to Java once you are used to these dynamic languages.
There is also Lift on Scala.
Imho scala is the best static typed language and lift is a pretty nice framework (for a static typed language).

Comparing ASP.NET MVC and Grails for a new project

Greetings, everyone. I consider myself to be an intermediate developer, but, to be candid, probably closer to novice than expert. In any case, I have more experience with C# and the .NET platform, but my current job has me working almost exclusively with Java. This in itself is sort of a problem, but I'm dealing with it fine and I'm not really in a position to change my role at the moment.
On the side, I am starting to work on a highly interactive, database-driven web project. I'm doing it because I feel that it's a great idea and I know that the experience of doing something like this from scratch will help me immensely.
I initially wanted to go with ASP.NET MVC and I am still leaning that direction. I'm not even sure why, but I love the community behind it and, in my opinion, Visual Studio is the best IDE around. However, doing that would be counter-productive to my current job. That brought me to Grails. Even though I realize that Groovy is not Java, it seems to be similar enough (not to mention that it runs on the JVM) that the skills I learn should still help me at my current job. The more I looked into Grails, the more I loved it, especially after having to deal with what I consider to be an extremely complex J2EE environment at work.
But with the good I found the bad. I can't help but notice that there are a lot of developers who are irritated with the amount of bugs in Grails. Being that I am starting a new project and I am fairly inexperienced, do I even want to consider Grails? Is it a liability? And what's the consensus about its longevity? I would really hate to get too involved if there is a good chance of it fading into obscurity within the next few years. And even if the bugs and longevity issues aren't a huge deal, how would you compare the ease of development of Grails with that of ASP.NET MVC? I realize this last part is highly subjective. But for the sake of comparison, let's say that someone with virtually no technical background were in the same position. Would you recommend they take a look at ASP.NET MVC or Grails?
Thanks so much. If anything needs clarified or reworded, please let me know. I sincerely hope I'm not opening a can of worms...
I am the author of this question and I can give you some shares on my own experience.
As it is stated in the question, I had no real preferences and I was opened to any technology/platform that could fulfill my requirements. After many tries of different technologies (at leats few days with PHP, Rails, ASP and Grails) and some answers from StackOverflow, I ended up with the same dilemma as yours : Grails or ASP.NET MVC ?
And I chose Grails. Why? Because of GORM. Almost only because of GORM. This is fantastic to deal only with your domain classes and have your DB schema automatically generated/updated. Of course, it has its limits but this is so powerful for querying and maintening your DB. You do not write SQL anymore and it is very easy to learn.
Now here is my 2-cents comparison of the 2 technologies:
GRAILS STRENGTHS
GORM (see above)
Complete Web Stack Framework : you can generate a website in minutes and everything is already configured
A lot to learn : You have Spring MVC, Hibernate, Sitemesh, Java, JEE, Groovy...Once you have mastered Grails you can add an additional page into your resume
Java world. Whatever you need, if it already exist in Java, you can use it.
Groovy : I really like this programming language. It takes time to get familiar but once done, you will love it.
GRAILS WEAKNESSES
Memory usage. Grails/groovy is greedy for memory and it might cost more than ASP for Web Hosting
Grails bugs : there are some and when you start a new project on a new technology, you assume that most of the problems come from you...until you find out (after 1 or 2 days) that it is a Grails bug. So my advice is to proceed by steps : test as soon as possible and don't try to twist the framework. It is rough on the edge so go after what is generally recommended. However, after 2 months, I do not encounter big problems anymore.
Debugging : due to the multiple layers of frameworks, errors are generally hidden inside tons of exception lines. Also, the only decent IDE debugger is IntelliJ but this is not as easy to debug as .NET under VS
ASP.NET MVC STRENGTHS
The community : it's HUGE ! First it is supported by Microsoft and secondly 30% of the websites out there are built in ASP.NET. You can find any snippets of code, any widgets, any AJAX components, any CMS...Grails community is very active but can you rival against millions ?
Visual Studio : I definitely agree with you : there is no better IDE. IntelliJ is very good for Grails but having using both, I prefered VS
ASP.NET MVC WEAKNESSES
The youthness of ASP.NET : this is a young framework. Built on a stable technology but young enough (less than 2 years) to have also some bugs/some bad practices. Indeed, the next version of ASP.NET MVC is strongly awaited by the community.
Microsoft : even if ASP.NET MVC is open-source, you are totally dependent on their decisions (and prices).
The Bottom Line
If you project has tight deadline and if it is crucial for you to succeed, then go for ASP (according to your background). Otherwise, give a try to Grails..don't worry, you will also succeed but it will take more time. I am also deeply convinced that Grails has just started its long journey and it has a great future (see google trends)
Update by Dmitriy: If your refer to Google Trends you have to compare the 2 of them Groovy Grails and ASP.NET MVC.
Good luck
This is something that's been pretty much asked before here...
http://74.125.155.132/search?q=cache:BpGj8RtSUIsJ:stackoverflow.com/questions/1283935/what-technology-asp-php-joomla-rails-grails-for-a-website-from-scratch+Which+technology+to+choose+%28ASP.net+or+Grails%29&cd=1&hl=en&ct=clnk&gl=us&client=firefox-a
Good Luck though!

recommendation for choosing a new web development stack

I work in a medium to small team ( 10 people ) developing and supporting several web enterprise applications.
We have a dozen of them built with a house-made framework with asp-classic working against ms-sql server.
We are evaluating the migration to a new development stack.
We'd like it to be open (free) and simple.
I've been looking around the java web frameworks, but all of them seem to be extremely overbloated for our needs (with the possible exception of http://www.playframework.org/, which I couldn't study yet...)
We are thinking about porting our own framework to this new stack, rather than adopting a whole new stack that we are unaware of ...
so far now, we though about the following possibilities
plain java - jsp - jsf
groovy - gsp (no grails at all)
jruby (no rails at all)
we feel really comfortable working with dynamic languages (well, as dynamic as classic asp can be) and with a lean and understandable framework...
I see no small and simple web frameworks for java, like there are for php or ruby...
I really like groovy, but I see no web implementations outside of grails... Besides the language documentation doesn't seem to be quite complete (I might be looking in the wrong place, perhaps)
php could be an option, but I think it would be hard to advocate for it in my current work...
any other option, advice, pros and cons?
thanks a lot
--
edit
some related link Can anyone recommend a simple Java web-app framework?
I'd suggest you take another look at Grails. It does use hibernate and spring under the covers, but for most situations, you don't need to know the details of those frameworks. There's a large community and lots of documentation/blogs/mailing lists for support, as well as a thriving plugin community with over 300 plugins solving pretty much any need.
If you're still put off by grails, you could look into the play framework. I don't have any experience with it, but there has been some traffic recently around it on hacker news and the like. I know it uses groovy for the templating language.
I cannot recommend anything, but strongly recommend that you consider these things:
Rapid development. Basically you want to save a page file, and reload it in the browser. Instantly! It can be done, do not settle for long deployment times.
Plain, readable text files!
Convention coding instead of explicit coding - big XML files will eventually drive one or more developers insane. The less, the better.
Good tool support (just having syntax coloring may be a big help)
Consider the long term support of your choice. You are basically remarrying with your software - will it still be maintained in 10 years? By whom? Will you have alternatives (JSR's are great - look at the amount of servlet engines)?
And WHEN you choose - get the source code for it, and ensure that it builds correctly. It will never be easier than now, and some day you WILL need to fix something inside. On short notice! (You may even consider allocating resources for donating documentation/patches/time to the open source project you are building your business on).
EDIT: A few more things:
You want to be able to verify things at compile time. One of the things that make it possible to build cathedrals in Java is that the static typechecking prevents a lot of nasty runtime errors. "Oh, THAT method? Well, it's not here, sorry. Boom!"
You want good error reporting. Built in! Try throwing a NullPointerException deep, deep down and see what 1) the user and 2) the developer is told about it. Anything that requires going to a log file to get the details WILL cause calls at 3 AM eventually.
Look into scalability from the start. Any non-trivial customer will need to and the world goes to multicores, so you might as well think about it already now. What will you do when all the magic pixie performance dust has been used and it just isn't enough: The application requires more than a single box.
And read this: http://www.pragprog.com/titles/mnee/release-it
You're forgetting about the other major player in this field: the LAMP stack (linux, Apache, MySQL and mod_perl). All components are free, there are many books available on LAMP development and each of these components, and there are vast numbers of libraries and components already available.
Apache: the Definitive Guide
Learning Perl: by SO's brian d foy
Practical mod_perl
If you are afraid of Grails and need Java, try Stripes and read the excellent Stripes book (http://www.stripesbook.com/blog/). You can buy the eBook pdf for $23. The book covers the framework in amazing detail. Stripes is a very strong, lightweight MVC framework that deals with all the common problems of web development (templates, url mapping, form validation, security, internationalization, testing) but it won't automagically create the database layer for you unless you want it to by using Stripernate. You can also use Groovy with it. You can use it standalone or with Spring.
I've had great success in simple web projects using Spring MVC with JSTL JSPs. Spring MVC is a framework that can be kept pretty darn simple (1 additional XML file used for configuration). You can eschew all the fancy options and just specify a set of JSPs that you want to associate with view names, then forward to those views by specifying their names in the controller.
Spring MVC can also easily scale up and be as complex as you need, letting you switch from JSTL to JSTL with Tiles, or Struts, or JSF, or Wicket. It can also handle complex web flows using the Spring Web Flow project. But for most projects I just keep it simple -- build a JSTL JSP, create a controller that provides the objects that JSP needs, and associate them by having the controller return that view. Once you get the project set up and you're familiar with the configuration, it takes maybe a couple minutes to wire a new page into place.
If you like Groovy but don't like Grails you could try Gaelyk, which is a lightweight Groovy framework. However, AFAIK you can only use Gaelyk if you're hosting the app on the Google App Engine
If your apps won't be hosted on GAE, and you really don't want to use Grails, another option is to use Groovlets, Groovy template servlet, GSPs.
However, personally I think it's a big mistake to dismiss Grails. It really is a great framework, and you can go a long way without knowing much about Spring and Hibernate. One of your complaints is a lack of Grails documentation. I think you must have been looking in the wrong place, because in addition to all the books available, there's a very extensive reference document and a lot of other documentation available on the website. Finally, there's a very active mailing list.
My platform of choice is JRuby - Rails (3) because of its very rich and powerful ecosystem, but mainly because:
* very easy to use
* many MANY libraries
* fast support via IRC
* deep documentation
You can also check out Scala + Lift Web Framework ( imho best static typed language, nice framework )

Does it make sense to use a framework for a simple java web app?

I've done lots of java web development using jsps and servlets, and I have found this approach to be straightforward and flexible. Some of the groundwork involved though - such as managing database connections - is rather tedious, and it takes a fair amount of work just to get a new web app off the ground.
I'm therefore considering using a framework for the first time, but my impression of frameworks is that they're mostly used for large J2EE applications and involve a lot of complex configuration. What I'm looking for is something simple that (after the initial learning curve) will enable me to get up and running with a new web app as quickly as possible.
So my question is - does it make sense to use a framework for a simple java web app?
Note that I'm not asking which framework to use (if indeed a framework is recommended), as it has already been asked here.
If you don't use a web framework you'll usually end up writing one - poorly.
It makes a lot of sense. My team has spent the better part of five years with our open source stack and no matter and we have a "seed" project (works like appfuse) that we use to create all new web apps. Even the simple two pagers from the pov of maintaining the app, it looks like every other app, just smaller.
The short is you won't get any return on the investment right now, but you will as the project evolves and you maintain it.
Yes, I would use a web framework for the following reasons:
Increased navigation capabilities and controls. Even though you may not need them, they are there for you to use should you require them at any time
As others have indicated, apps grow over time and you will feel the need for the framework at some point in time in the future. When you need to add additional pages and navigation
Features that allow you to plug into other frameworks such as security and DB access frameworks. Spring is a prime example in the Java world. You never have to use Spring but it plugs in so well with Struts, Spring MVC, Hibernate, Acegi etc. It ends up saving you the hassle of doing all of the plumbing on your own.
Support!!! Good frameworks almost always have a vibrant community to support them and ask and answer questions.
It may seem like too much hassle initially but definitely saves you much time in the future
I'd say it actually matters quite a lot which framework you go for. Something like Spring MVC is fairly unobtrusive in your code and allows you existing stuff to run quite a lot as-is. Other frameworks have much more specific ideas about how you should do things.
Yes it does make sense. Apps can grow and change and might require something a framework can provide easily in the future.
For example at my workplace we have simple jsp / servlet app. It needs to be rewritten just because of what I explained above. If someone would have taken the time to just get the framework setup we would be in better shape today.
Yes it makes sense. However implicit in your question is that the wrong (for you) framework can be more pain than it's worth - and that's true. There is a world of difference between some heavy J2EE framework and something light and cheerful like grails.
What's the alternative? Rolling your own? Embedding all the navigation and logic in the JSPs?
I agree with those who say that a web framework is worth it. There are literally hundreds now (e.g., Struts, JSF, Spring, Wicket, etc.). Pick one that suits you.
There are two kinds of applications:
1) the kind that you throw away and never use again, and therefore should not worry about modularity, maintainability and clarity.
2) the real kind.
It may sometimes seem that your app may never have to grow, scale, or service a larger feature set / user base than you currently are planning for....I assure you, that perception is always wrong.
Frameworks, specifically things like Struts for MVC in Java, Spring for MVC and Dependency Injection, Hibernate for Object-Relational Modeling are all extremely valuable tools that lead to modularity, maintainability and clarity in your code. So, to answer your original question.... Yes, emphatically.
No it doesn't unless:
you don't have any java experience
in your team
you are doing just a prototype that
must be ready in hours
you don't trust your developers
enough to let them write your
application
you don't plan to let your
developers learn and improve
Danger in using frameworks include but not limited to:
you'll get all framework defects on
top on your own
you'll be unable to do realistic estimates until you
know perfectly the framework
your team won't learn how to program a
web server
you'll find your team passing more
and more time on google instead that
solving problems by writing code.
The only thing that is worst that choosing a open source framework is having a separate R&D team in the company who should create the "big complete ultimate company framework".
but my impression of frameworks is that they're mostly used for large J2EE applications and involve a lot of complex configuration
Not necessarily true. The good frameworks are built to scale well so that they will take you from small apps to very large apps. Many of the frameworks today are moving towards zero configuration so you will find them easier and easier to use.
You are right that it does take an initial effort to learn the framework itself but that investment pays for itself in the very first application you build. And meta frameworks like AppFuse makes it even easier to get started since it pre-configures the frameworks for you.
Frameworks make sense for most applications. It may be necessary for you to build your own or adopt some other framework. The most important questions is the granularity of your data structures. What I mean by this is do you need to just enter data or do you need to parse, compile and execute dynamic code?
If you think of a frame works as a gauge and to the left is an all ready existing frame work open source or closed and to the right is all custom framework then super impose your code on top of that frame work where the level of complexity increases to the right. The farther right you go the more of a stuggle you will have with the frame work (IMO).
However, you can also slowly migrate from existing to custom framework.
There is also the question about your business. If you work for a business that does not look at software as it's core compentency such as a bank or hospital then you need to way that into how much of a frame work you want to build.
Bottom line a framework of some type will always be useful.
Using a framework may add some overhead to your web-app development due to the learning curve. However, depending on the framework you choose, you may be able to realize the following benefits:
Scalability
Maintainability
Clear Division of your model (e.g. MVC)
Out-of-the-box components(SessionManagement,authentication,etc )
Third party plugins
Modularity inherited from the framework
Many others.
Besides, the learning curve is a variable factor. Some frameworks may be easier to learn than others depending on your skills.
It definitely makes sense to look into using a framework even if for no other reason than it'll give you a new area of knowledge. If you've got the time to invest in learning a framework then you may well find in time that it's easier and faster to use that for new projects no matter how simple they are.
Also, if I could vote for SamBeran's post then I would. Getting started with a framework will involve several moments of "oh great! I don't need to write all that boilerplate again!".
I'd say use one - like you said, it's rather tedious to get stuff up and running for even a simple java web app. If the framework helps you get the job done faster and provides the services you need, I'd say it makes sense.

Categories