Overview of Java Technology Seminar Follow-up


Many thanks to all who attended the free one-day seminar where we looked at the range of Java technologies and where things are headed with some of the recent changes.  During the session there were many great questions and I decided it was just too difficult to follow up by email so I decided to create a blog post.

JSF

Clearly I think many of the questions that came up had to do with JSF.  I think this was a combination of people who were not yet familiar with JSF trying to understand the benefits in combination with people wanting to know about JSF 2 and how that might change the “should I use JSF?” question.

One thing that is definitely true is that people should no longer struggle with what I call “raw Servlet/JSP” which is using Servlet/JSP without any other framework.  There is just so much you have to do “manually” that you can’t concentrate on the business requirements of the application.  Perhaps this tendency is because the book “Core J2EE Patterns” was written before JSF was required by J2EE servers and tried to stay away from using any “de facto” standards like Struts.  If you look at that book it basically shows you how to write your own web framework built on Servlet/JSP.  Why do that when there are so many “pre-packaged” frameworks out there?  In fact, many of our Java EE 5 training classes focus on how to use technologies like JSF, EJB 3, and JPA to be more effective at programming Java EE applications and Java EE 6 will continue this trend.

  • What makes you choose one web framework over another? – The “classic” question for which there is probably no one all-encompassing answer.  Certainly there are lots of different factors to consider and it would be arrogant for me to try and suggest one.  Certainly JSF is a capable “general purpose” framework (even more so with JSF 2) but ultimately it comes down to what makes sense for YOUR project, with the skills of YOUR developers, and YOUR preferences.  One thing I will say is that even though there is a lot of this kind of comparison out there online, remember that JSF 2 solves many of the JSF problems so look at whether any discussion is comparing JSF 1.x and listing some of these issues that were fixed in JSF 2.
  • Which JSF extension, IceFaces, RichFaces, PrimeFaces, etc do you recommend? – Since all of these are JSF component libraries a lot of it depends on which has components that may be most useful for the type of application you are using.  All have rich Ajax support and IceFaces has an interesting “Ajax Push” model which lets you push data from the server to registered Ajax clients which can be useful for live updates if you actually need that in your application.  This also depends a little on if you are using JSF 2 or not as with the native Ajax support of JSF 2 these libraries may inter-operate better.  If you are using an earlier version of JSF you want to stick with only one for Ajax functionality.  PrimeFaces and IceFaces also have support for mobile applications which is certainly interesting given the growth of mobile development.
  • What is MyFaces? Is it another JSF implementation? – MyFaces is primarily a JSF implementation that is an alternative to the “standard” JSF implementation called ‘Mojarra’.  MyFaces also has a number of JSF component libraries that provide extensions to JSF.
  • What web framework is better, JSF 2 vs. Struts 2? –  I think if you say JSF 2 I would say JSF hands down.  We have Ajax integration with JSF built right in, rich ecosystem of JSF component libraries, much better options for managing state within an application, and those are just off the top of my head.
  • Any recommendations for resources to use when upgrading from JSF 1.x to JSF 2? – We are going to offer a “What’s new in JSF 2” training class.  In general I think what is different is you have different options for validating partial data sets or even changing the content of a form using the JSF 2 AJAX support which was much more difficult prior to this.  So I think the JSF 2 Ajax integration is where to focus a lot on.
  • Is JSF concept similar to .net aspx? – It is similar in that we are linking more directly the visual elements on the web page to variables and methods in objects on the server.
  • Are you aware of any companies/websites using JSF ??? – http://www.jsfcentral.com/trenches/ has some articles about people using JSF. Many of these are from when JSF was new but JSF 2 will make JSF more popular and not less.
  • Are people moving from struts 1.x to Struts 2 or are they moving more to JSF? – I think more people moved to Struts 2 when it came out but not as much now. Since Struts is kind of “dead” now I might look into moving to JSF since that will continue to evolve and offer new features for solving problems in the future.
  • How does JSF works with Web 2.0 (Dojo)? – It depends on why you are using Dojo.  If you use it just to get some Ajax functionality without as much JavaScript programming you might look at the native Ajax support in JSF 2.  If you specifically want some of the widgets available with Dojo you might look into DojoFaces which is an integration library for the two.

Java/JVM

I think another big source of questions had to do with the Java JVM, especially the 32-bit/64-bit software difference.

One thing that might help clear up a number of questions is to know that even though you want to install a JVM that matches the environment it is running in it doesn’t change Java itself.  The representation of Java primitive values is the same in all JVMs.  The only thing that changes is how much memory is potentially available to set the “maximum heap size” of the JVM and how the JVM represents memory addresses internally.  But since in Java you are not manipulating the memory directly anyway Java programs will not be affected.  Also, it is possible to run a 32-bit JVM on a 64-bit machine but not the other way around.  Typically the difference is not as important for development machines but would be important to match on the servers that may run Java EE applications where you should use 64-bit JVMs when available.

  • When your server has a specific OS, why do we even bother to run things on JVM? Isn’t JVM an extra layer not needed? – Certainly you lose a little something running in the JVM compared to “native” but with some of the performance improvements in recent JVM versions and even some of the research being done for “Real Time Java” this is less and less.  Besides, the portability you get is not just a “I don’t have to recompile my application for a different platform” portability it is a “I don’t have to rewrite every line of my application for a different platform” kind of portability which is more important when you think of the long life of typical applications.
  • What happens to the primitives in the language like int, will it be 32 bit int? or 64 bit if you declare them with just int? – The representation of primitives like ‘ints’ would be the same in both.
  • So JVM is hardware platform specific? You need to download the right JVM for your platform? – Yes, you always want to match as closely as possible.
  • When an application is run and enters main method, how is JVM handling processes? Do we still get separate PID for each program? – Every time you run the application a separate JVM process will be created by the machine to run the program.  If a program is “multi-threaded” it would run several threads of program computation within the same process.
  • So applets do not run on top of JVM? – Applets do run in a JVM but one that is installed as a plugin to the browser the Applet is running in.
  • Difference between JDK, JRE and JVM? – JVM runs the program. JDK has the development tools to compile apps, JRE just runs stuff.
  • If I develop a program on Java EE 6 or JDK 1.6 can I run it on Java EE 5 or JDK 5/1.4 or lower? – In general no.  Part of it is the code will be compiled against the more recent version and not recognized on the older JVM and the other part because if you use parts of the newer API those will not be available in the older JVM.  The reverse is true though, if you compile or design a program for an “older” version of Java you can run it in a “newer” environment.
  • JVM 64 B program will it run in 32B? – Technically there are no “64 bit programs”, they are just Java programs and will run the same in both environments.
  • Does OS makes difference Unix/ Windows? – Yes in terms of JVM you need to install, no in terms of how you write your program.  One of the portability benefits of Java is you can just write the program against the generic “Java Virtual Machine” and they will operate correctly on different platforms.  One example is working with files where the concept of “open the file, read the file, write to the file, save the file” would be the same.  The only difference might be how you specify the file name but if that is passed in as a program argument there will be nothing different in your code.

Spring

In one poll question there were a high number of people who said they did not use Spring so I’m not surprised this was another area for questions.

  • When to prefer Spring WebFlow, in comparison to Spring MVC? – Spring WebFlow is definitely for when the application has a fairly distinct navigation between pages in the application so this is modeled in a “flow”.  This would be the “Show cart, collect shipping address, billing address, enter payment details, confirm order, display confirmation” type application.  Spring MVC is used for when all of the action needed is handled by a single request that collects all the data needed.  This could be a “list appointments, add new appointment, cancel appointment, etc” application where each action is pretty self-contained.
  • I still do not see, how spring replaced EJB, both are very different technologies. – Both are very different in implementation but similar in some of the benefits you can get by using them. Also, Spring can be used outside of a Java EE server.
  • What are the other features that add value in Spring? – Spring has utility modules for JMS, JDBC (if you don’t use JPA), etc. It also has a few web frameworks that are specific to Spring. Spring is also good if you want a full dependency injection model but can’t migrate to a Java EE 6 server.
  • Tomcat is very popular so people must be using Spring or similar to get EE function like transactions and queuing? – This is true and one of the things Spring tries to “sell” people on.  The reality though is now that there are lots of open source Java EE application servers perhaps the model of “Tomcat is so simple” has outlived the reality.  Now if you want to add any kind of Java EE functionality to Tomcat you spend a lot of time doing this when using a Java EE certified server would give you more functionality “out of the box” and you would need to rely less on Spring or doing it on your own.  Spring originated when you had to pay for Java EE (J2EE) functionality which was some of the original motivations for creating Spring.

Eclipse

Eclipse was the most popular development tool of people attending the session so some questions about that also.

  • Can you comment on Eclipse. does it have a highly productive drag and drop tool? – Eclipse does have great drag and drop for JSF. When you use the “Web” perspective with the “Palette” view and open a JSF page with the “Web Page Editor” (not the JSP editor).
  • Are the Eclipse plug-ins downward compatible? – I think this is asking if a plugin is compatible with one version of Eclipse would it be compatible with previous versions and generally the answer is no.  The good thing is now Eclipse has a very good way to add new software from “update sites” and these can check your version of Eclipse and make sure to install the correct version.  Eclipse has also gone to “naming” the yearly releases and this is the place to start when looking for compatible Eclipse plugins and environments.  If there is a specific plugin you want to use make sure to use an Eclipse version that is supported.
  • What tools would you suggest for a brand new Java web application? – Since there are free Eclipse plugins for every major server now this is definitely the place to start.  The place to start would be the ‘Eclipse IDE for Java EE Developers’ from the Eclipse downloads section.  Make sure you get a version that is compatible with the plugin that would allow you to work with your server and you may need to start with a slightly older Eclipse version.
  • What is a recommended version management Eclipse plug-in? – Assuming your version control system is set you would get an Eclipse plugin to match this.  Often they are provided by the source of the version control system.  If your version control system is not set evaluate based on the features of version control systems as this will affect things more.  Certainly you can use “availability of Eclipse integration” as a criteria but generally all provide some kind of plugin.  Also remember that the Eclipse plugin is not the version control system itself but just how you can work from within Eclipse and perform actions in the separate version control system.
  • Does regular Eclipse have a WebSphere plugin? – IBM just released a FREE Eclipse plugin that provides server management tools for WebSphere 7.0 and 8.0.  This is so groundbreaking I wrote a separate post about it.

Misc. Questions

  • What is POJO? – POJO stands for “Plain Old Java Object” and means generally that a Java component does not need to extend another class or implement an interface of some technology.  In general POJO has been used to indicate “simple” Java components that may at most have an annotation enabling certain features although some might argue that even the presence of an annotation links it to a specific technology or framework.
  • Java SE vs Java EE – which one has more API? – Since Java EE extends Java SE it includes everything from Java SE and therefore is always more.  In terms of comparing Java SE to (Java EE – Java SE) I’m not sure.  Probably depends on version somewhat.
  • Hibernate struggles with stored procedures in the RDBMS. Is JPA any better? – JPA does not add anything specific to stored procedures.  The closest is running a “native query” where you are supplying the SQL directly which could then be a stored procedure.  The support for this is pretty much going to be up to the JPA implementation which would be different by default on different servers.
  • Can EJBs be nested? – Yes, you can have one EJB invoke methods on another EJB

Resources

A few people had questions about good books/resources.

  • Can you recommend a good book for Spring 3 MVC? – I don’t have a specific one but make sure you get one that covers the exact version of Spring you will use.  Spring MVC is part of the main Spring project and is not it’s own project.  Spring MVC also changed quite a bit in Spring 3.0 which is why it is so important to match versions.
  • Can you recommend a good book for JSF 2? – I have started looking at ‘Core JavaServer Faces’ 3rd edition which is updated for JSF 2.  This book has always had good reviews and what I like about the new edition is it clearly identifies what is new to JSF 2 so those that are experienced can get to the new stuff while those new to JSF get value from the whole thing.  This is also one of the ONLY Java EE books (on any part of Java EE) that even mentions the JSR 299 – Contexts and Dependency Injection (CDI) standard and how it integrates with JSF.  CDI is a major new technology and I’m shocked how it is really not covered practically at all in the current Java EE 6 books available so this was a big selling point for me.
  • Can you recommend any good resources for going from java 1.4 to java 1.6? – I don’t have any specifically but if you are talking the difference between Java SE 1.4 and Java SE 6 (1.6) the main differences were actually introduced in Java SE 5.  This introduced things like generics, enhanced for loop, etc and many more things that affect the language itself.  Our Advanced Java class has always had a chapter on major changes in the last few Java versions and the differences for Java SE 5 are more than those for Java SE 6.  Now if you are talking about differences between J2EE 1.4 and Java EE 6 that is a different story as there are many more changes from Java EE 5 to 6 in my opinion.

Poll Questions

I think it would be good to also recap the results of the poll questions for some idea of what tools and technologies people were using.  Although most poll questions only got a 40-50% response rate I would assume they were fairly representative.

Question – Which IDEs do you use?

  • Rational Application Developer (RAD) – 40%
  • “Regular” Eclipse (free) – 66%
  • MyEclipse – 11%
  • SpringSource Tool Suite – 3%
  • NetBeans – 10%
  • JBoss Developer Studio – 15%*
  • IntelliJ – 12%*
  • JBuilder – 31%*

* – These responses were part of a second question I created which had a much lower response rate.  These responses may have been elevated by people who answered the first question and didn’t use any additional tools not answering this question.

Analysis – This confirms what I see with our clients which is that RAD is still popular because most WebSphere shops have had to use it.  The release of the FREE Eclipse plugins for WebSphere 7.0 & 8.0 may change this.  The “Regular” Eclipse is the most popular although there is some usage of just about all of the other major tools available.

Question – Which Java EE Technologies are used by your applications?

  • EJB 3.x (Java EE 5/6) – 52%
  • EJB 2.x (J2EE 1.3/1.4) – 30%
  • JavaServer Faces (JSF) – 35%
  • JAX-WS web services – 49%
  • Java Persistence (JPA, Java EE 5/6) – 27%

Analysis – I was pleasantly surprised to see the EJB 3.0 adoption so high.  Given that, however the JPA rate seemed a little low.  Maybe migrating to JPA, which is a completely new technology, is different than simply programming existing EJBs a different way.

Question – Which web framework is used for NEW applications?

  • Struts – 7%
  • JSF – 23%
  • Spring MVC – 20%
  • Servlet/JSP (without anything else) – 11%
  • “Other” – 19%

Analysis – Obviously for this one what constitutes the “Other” response would be reason to open up a new skirmish in the “framework wars”.  My main goal though was to see how some of the new frameworks like JSF and Spring MVC held up against the “old” choices of Struts and Servlet/JSP.  It is clear that JSF is the new “standard” although Spring MVC had more responses than I expected.  In my opinion too many people are still using Servlet/JSP since that just forces you to do too much work or maintain your own custom “framework” anyway.  Based on how many people weren’t really aware of JSF when we discussed that perhaps that will change.

Question – Which Spring version do you use?

  • Don’t use Spring – 63%
  • Spring 3.x – 16%
  • Spring 2.5.x – 14%
  • Spring 2.0.x – 11%

Analysis – I was surprised to see so many people not using Spring at all.  Of those that did use it however the biggest percent was on the most recent Spring 3.x version proving that it is easier to move to a new Spring version than a new Java EE/server version.

Question – How soon until you move to a server that supports Java EE 6?

  • We are using one now – 14%
  • Within 0-3 months – 2%
  • Within 3-6 months – 4%
  • Within 6-12 months – 22%
  • More than a year from now – 59%

Analysis – This confirms that using a new server version is not something that happens overnight although a surprising number are already using one.

  1. No comments yet.
(will not be published)

*