Wednesday Mar 04, 2015

MVC JSR SNAPSHOT builds

The MVC JSR (JSR 371) is progressing nicely. A key architectural decision was taken a few weeks ago: the MVC JSR will be based on JAX-RS. And since then, the Experts Group has started to publish SNAPSHOT builds :

If you want to lean more about the MVC JSR, make sure to bookmark this page where Manfred Riem (MVC co-spec lead) is tracking all relevant MVC information and resources.

It's still early but you now have everything on hand to start initial testing of this new API. As always, community feedback is a critical factor for the long-term success of this JSR!

Monday Feb 16, 2015

Manfred Riem Discusses JSF and Java EE MVC on JSF Central Podcast

Manfred Riem was a guest on the most recent JSF Central Podcast. For those unaware Manfred is the co-specification lead for both JSF 2.3 and Java EE MVC 1.0. Manfred talked about Mojarra, JSF 2.2, JSF 2.3 as well as MVC 1.0. The podcast is available here and you can read the transcript here.

The podcast is led by Kito Mann - well respected enterprise consultant, author, blogger and JSF community member. Kito has been a long time supporter of JSF with a long track record of contributing as a JCP standards group expert.

The newscast is in fact part of the JSF Central portal and covers topics of interest for the JSF ecosystem. Past contributors to the podcast have included folks like Ed Burns, Cagatay Civici, Neil Griffin, Lincoln Baxter and Shay Shmeltzer. All of the podcasts are archived here.

Besides the podcast, the JSF central portal itself is a very valuable resource for the JSF community you should explore. It does a very nice job listing JSF articles, books, projects, products and other resources.

Wednesday Feb 04, 2015

Java EE MVC to be Based on JAX-RS

One of the key Java EE 8 APIs, MVC 1.0 (JSR 371) is solidly moving forward. A key decision for the expert group to consider was whether to base the specification on Servlet or JAX-RS. MVC clearly has many semantic commonalities with both specifications such as HTTP method mapping, mime-type handling, session/request/cookie manipulation and so on. Specifications like JSF and JAX-RS are based on Servlet so it is not unnatural to base MVC on the foundational Java EE specification too. However basing MVC on the lower level Servlet specification would likely mean introducing many APIs that are potential duplicates of what is already available in the higher level JAX-RS API. On the other hand basing MVC on JAX-RS would mean significantly minimizing the possibility of API duplication. It would also mean the programming model between JAX-RS and MVC would be very similar, reducing the learning curve for both newcomers and experienced Java EE developers.

For these reasons it is not too surprising that the expert group has decided to move ahead by basing MVC on JAX-RS. MVC expert group member Ivar Grimstad shares the details including an early view on how the API may wind up looking like in a recent post. Do you have an opinion to share on this?

Thursday Nov 20, 2014

Tools for MVC in Java EE 8

Last week at Devoxx, Manfred Riem (MVC 1.0 Co-Specification Lead) did a session on MVC 1.0 (JSR 371) to a packed room. During the session, Geertjan Wielenga (Principal Product Manager in the Oracle Developer Tools) did a cameo appearance to discuss the tooling in the context of MVC. Amongst other things, Geertjan is looking at some of the potential features an IDE could bring to simplify the development of MVC based applications.  During the session, Geertjan did a demo based on a prototype he wrote for NetBeans. This demo was also using Manfred’s experimental action based prototype.

So clearly, it's early days! After all the MVC Experts Group has just started and is now discussing important orientations for the specification (e.g Should the Controller be based on the Servlet API or should it be layered on top of JAX-RS?). Nevertheless, it is interesting to follow Geertjan's explorations around tooling in that space.  This also demonstrates that adding new features to NetBeans is not necessarily a daunting task!

You can find more details on Geertjan's blog: Tools for MVC in Java EE 8 - Part 1 and Part 2.

Monday Oct 20, 2014

Why Another MVC Framework in Java EE 8?

Some of you may be aware that MVC 1.0 was launched as JSR 371. Targeted for Java EE 8 the goal of the JSR is to provide a standards based action-oriented web framework for Java EE. 'Why' and 'why now' are two perfectly reasonable questions to explore carefully with regards to this JSR. After all JSF has long been included in Java EE as a standards based MVC web framework. In addition although JSF is a component-oriented web framework there are myriad Java web frameworks that are action-oriented including ones that are very Java EE/CDI friendly such as VRaptor (indeed we had a session on VRaptor at JavaOne 2014).

There's little doubt the web framework space in Java has long been hyper-competitive. There are myriad camps each of which insist their way is the "right" way. Nonetheless in most reliable analysis two schools of thought have consistently come out on top for a number of years - component-oriented frameworks (led largely by JSF) and action-oriented frameworks (lately led by Spring MVC but long dominated by Struts). As a result it has been an open question whether Java EE should support both models much in the same way that .NET has done with ASP.NET and ASP.NET MVC. To put this question to rest we included it in the Java EE 8 survey. Despite all the factors above it turned out that the core Java EE community does in fact see the need to include a standard action-oriented web framework in Java EE, which brings us where we are with MVC 1.0. To answer some of the questions that should naturally arise none other than JSF specification lead Ed Burns put together a very nice analysis piece on OTN that's well worth a read. Red Hat's MVC 1.0 expert group representative Joshua Wilson has done the same as well.

It's obviously not  possible to construct an entirely unbiased pro/con analysis matrix for choosing between these two perhaps equally valid major approaches to Java server-side web frameworks. That being said I've tried to encapsulate some of the salient concerns in the graphic below.

I have years of real world development experience with both approaches in case you are wondering; I also favor JSF personally in case you were wondering but see both perspectives. In my view, component frameworks like JSF do extremely well in offering the closest approximation to Smalltalk's original MVC concept, reduce boilerplate to the bare minimum by almost entirely automating controllers/navigation/state handling/event dispatch and truly enable writing re-usable web components. These characteristics shine particularly bright with purpose-built component libraries like PrimeFaces that do a lot of the HTML, JavaScript, CSS heavy lifting for you. However because JSF is a higher level framework that cleverly abstracts away a lot of the underlying HTTP life-cycle there is an initial learning curve. In my view this leaning curve is fairly minimal with JSF 2+ and is only a serious problem with relatively inexperienced developers from a web-development heavy background and no desktop UI development experience.

Action-oriented frameworks try to accomplish far less in comparison. They provide a thinner MVC-like facade that leaves a lot of the work of writing controllers, HTTP handling, navigation, state maintenance, HTML/JavaScript/CSS authoring to the developer. There is really no concept of components beyond relatively elementary templating. As a result these frameworks do not generally have component or plug-in ecosystems. These characteristics make learning the framework easier for beginners that perhaps have a background in vanilla web development, PHP, JSP, ASP classic and the like. Because the framework does not alter the HTTP life-cycle or HTML rendering much it is easier to integrate arbitrary HTML, JavaScript and CSS tools.

To apply a very broad generalization the way I have seen this play out is that heavily form/workflow driven applications where Java developers do a lot of the UI work tends to be written in JSF. There are exceptions (such as eBay - they presented on their JSF usage at JavaOne 2014) but these applications usually reside behind corporate firewalls. More public facing web applications often dominated by web developers tend to be written using action-oriented frameworks.

I hope this helps answer some of the questions you may have had. JSF is here to stay and continues to have a strong community behind it. JSF 2.3 was launched as JSR 372 and is also targeted for Java EE 8. MVC 1.0 will join JSF as a first class peer in Java EE for folks that prefer an action-oriented web framework.

If either of these technologies strongly interest you and you have the time to spare, now is the time to apply to join the respective expert group. Note that you can always participate in a JSR without officially being part of the expert group by simply subscribing to the JSR user alias. Also remember that you can contribute on an even more lightweight format through Adopt-a-JSR.

Please note that any views expressed here are my own only and certainly does not reflect the position of Oracle as a company.

Tuesday Sep 23, 2014

MVC 1.0 (JSR 371) at JavaOne

In the early days... well... just a few weeks ago, the idea was to standardise MVC under the JAX-RS umbrella.  At that time, we didn't think to submit a JavaOne proposal for a dedicated MVC session. But since then, a lot of things has happened and MVC has now its own JSR (see here for some background).  

Fortunately, we were able to squeeze, the the JavaOne schedule, a dedicated MVC 1.0 BoF. This BoF will be hosted by Manfred Riem who is leading this new specification with Santiago Pericas Geertsen. It will take place on Tuesday Sep. 30 (7:00-7:45 PM) at the Hilton (Continental Ballroom 4), make sure to add it to your schedule!

Manfred is also co-leading JSF 2.3, you can see Manfred's JavaOne duties here.

Tuesday Aug 26, 2014

MVC 1.0 JSR

The Model–View–Controller (MVC) pattern has been used for several decades to implement user interfaces. And when it comes to MVC Web frameworks, those can be categorized as action-based or component-based. JavaServer Faces is a component-based MVC framework.

Through the survey, the community has expressed interest in an action-based MVC approach. Santiago Pericas-Geertsen has recently posted a draft proposal for a JSR ('MVC 1.0 JSR') that would define a MVC action-oriented framework for the Java EE platform. This MVC JSR is not intended to replace JSF (component-oriented) but offers, instead, a different approach to building Web applications on the Java EE Platform.

One of the goals of the MVC JSR is to leverage existing platform technologies where it makes sense (e.g. CDI and Bean Validation seems obvious candidates for the Model part).

The initial though was to define this (action-based) MVC framework in the JAX-RS specification but after initial feedback and discussions, the general consensus was that a separate JSR would be more appropriate. Technically, JAX-RS is still one of the option for the Controller part but everything is open and will have to be discussed in the EG. The outcome of those discussions might be that something else is needed for the Controller, or that there's a way to define a Controller independently of the underlying technology and JAX-RS would then be 'plugged' in, we will see... One thing is clear, defining a new template language is not in the scope of the MVC proposal!

We have strong team to lead the MVC JSR : Santiago Pericas-Geertsen (who is also the JAX-RS Specification co-lead) and Manfred Riem (who is also the JSF Specification co-lead). They will, for sure, get support from other community participants (e.g. Red Hat).

In terms of planning, Santiago is looking for supporters before he submits the proposal to the JCP. The JSR itself is aligned with the Java EE 8 planning.