How to improve productivity when developing Java EE based web applications

前端 未结 14 1670
悲哀的现实
悲哀的现实 2021-01-29 19:47

I\'d like to know how you address the seemingly low productivity of Java EE-based web application development compared to other technology stacks (Seaside, Ruby on Rails, etc).<

相关标签:
14条回答
  • 2021-01-29 20:15

    Well, I'm not really a Java guy, so I can't say much, except for... JSF

    We tried to use it for some time and it was a disaster. Almots all basics steps had to be passed with lots of pain, no documentation, no examples, no community knowledge. We used then one plugin for Eclipse (Exadel Studio), we had a look at a few other JSF frameworks, they were all incompatible and poorly documented. As a matter of fact, of all those we tried, only Sun framework (forgot its name, based on NetBeans) could create a new JSF project even compilable out of the box. The rest required many days of configuration of apache and other things, which for an unexperienced person is a real challenge (though I managed it).

    Our team spent a few months on something which was done later in just a few weeks with ASP.NET. People were both inexperienced in JSF and ASP.NET.

    If JSF ecosystem is still that bad as it was in 2007, I would recommend avoiding it altogether, productivity is out of the question anyway. Maybe stick with JSP or something that is time-proved and well developed?

    0 讨论(0)
  • 2021-01-29 20:17

    I would go with the Lift framework written in Scala. You will see a great productivity boost just by switching to Scala. Scala is also very stable and it's extremely easy to call Java code from your Scala code. Not only that but it's quite similar to Java but with some added features. For some examples you should refer to 5 Things a Java developer needs to know about Scala. Twitter will move part of it's codebase to Scala.

    You will never "get stuck" on a piece of code because you can just think about how you would do it in Java and write similar code. First class functions and actors will give you an even greater productivity boost and are both in Scala. Scala is of course statically typed and has a performance that is similar to Java.

    I will quote the author of the Lift framework for an description of it:

    Lift borrows from the best of existing frameworks, providing

    • Seaside's highly granular sessions and security Rails fast flash-to-bang
    • Django's "more than just CRUD is included"
    • Wicket's designer-friendly templating style (see Lift View
      First)

    And because Lift applications are written in Scala, an elegant new JVM language, you can still use your favorite Java libraries and deploy to your favorite Servlet Container. Use the code you've already written and deploy to the container you've already configured!

    0 讨论(0)
  • 2021-01-29 20:21

    I've used Jboss Seam for the past couple of years and find it to be very productive way to develop in Java EE (utilising EJB3, Hibernate, Facelets). I also do the odd bit of PHP coding on the side and can honestly say that I'm more productive with Seam (although that's probably also an indication of my PHP skills.)

    For me a couple of the highlights would be:

    • Hot deploy of code (an absolute must-have)
    • DRY with Facelets
    • Annotation based configuration
    • Extensive drop-in components (especially ajax4jsf)
    • IDE Support from Jboss Tools

    There are tools in the IDE and from the command line to build skeleton code in a similar way to RoR.

    0 讨论(0)
  • 2021-01-29 20:24

    It's often cited that RoR and similar frameworks based on dynamic languages are more productive environments, but I am really interested to know if there are hard data to back this up. This wouldn't be easy, as one should be made certain that she is not comparing apples with oranges. Things like type of project (web 2.0, enterprise application) and team size should be taken into consideration. However, for small projects it is more than evident that such frameworks are indeed far more productive than Java EE. So this is a short list of arguments used to support this and what you can do for them in the Java world.

    Ruby is a more intuitive and concise language. You can do the same thing with much less code.

    I don't think you can have the same thing in Java, unless of course you use a dynamic language that runs in the JVM (JRuby, Scala, Groovy). Otherwise, your IDE can help. In Jave an IDE is an essential tool and it will pay you back if you learn to use it well (code generation, snippets, refactoring). In fact there are many things you can do with a Java IDE that are simply impossible to do with a Ruby or Python IDE. Plus you have the benefits of a static typed language. It may take more time to type, but it helps you avoid common mistakes.

    Ruby is much more fun to use. Makes the developer happier and more productive.

    Same as above. Highly subjective argument in my opinion though.

    Convention over configuration makes things faster

    A dependency injection framework like Spring or Guice can help

    Scaffolding, MVC already there for you.

    Again Java MVC frameworks can help

    Databases made easy. Load database items as objects. Can change the database on the fly.

    Hibernate, iBatis or another ORM framework can help. With Hibernate Tools you can achieve similar functionality with what you have in RoR with yml files

    Load new modules instantly

    Maven or Ant Ivy can help

    Easy deployment for testing

    Your IDE or Jetty can help. In fact debugging is easier with Java

    Testing integrated with the framework. Use of mock objects facilitate testing

    A dependency injection framework can help with mock objects. JUnit was a pioneer of unit frameworks. I don't think that Java is less easy to test.

    0 讨论(0)
  • 2021-01-29 20:25

    I would definitely go for Spring together with Hibernate for persistency related stuff.

    Why Spring?

    The advantage of using Spring instead of another framework is that Springs philosophy is to be "non-invasive". Usually when you're using a framework most probably you'll start to depend on that framework which can be a bad issue if the application is considered to run for a longer time where you then have also to do maintenance etc. Spring uses the so-called "Inversion of Control" (IoC) pattern. Basically your code doesn't (it can but it doesn't have to) call Spring, but Spring will call you (Hollywood principle: "don't call me, I'll call you"). So for instance you can use normal POJOs (Plain Old Java Objects) and you don't have to inherit from any framework-related classes/interfaces. Another big problem (if not the biggest) in Software Engineering are dependencies. You'll fight for reducing them as much as possible since they will make your life harder (especially in maintenance later on). Spring reduces dependencies among your components drammatically by managing the instantiation of components through configuration files and the dependency injection pattern. I wouldn't want to go on, the best thing is that you start reading some tutorials at the official Spring website. Initially it may need some time in the understanding but once you got it you'll earn a lot of benefits.

    0 讨论(0)
  • 2021-01-29 20:27

    Frameworks like Spring, Hibernate, Wicket certainly help to simplify and accelerate web development as they provide a high degree of testability and integrate very well. But it's not enough to reach RoR productivity, even if you have a good set of development practices. There is still too much technical stuff and plumbing required.

    Grails is maybe the missing piece in this picture to get closer to RoR. It's my next experimentation.

    BTW, my MDA experiences are the contrary of a productivity improvement so I won't mention them (actually, MDA was killing our productivity).

    0 讨论(0)
提交回复
热议问题