Matt RaibleMatt Raible is a Web Developer and Java Champion. Connect with him on LinkedIn.

The Angular Mini-Book The Angular Mini-Book is a guide to getting started with Angular. You'll learn how to develop a bare-bones application, test it, and deploy it. Then you'll move on to adding Bootstrap, Angular Material, continuous integration, and authentication.

Spring Boot is a popular framework for building REST APIs. You'll learn how to integrate Angular with Spring Boot and use security best practices like HTTPS and a content security policy.

For book updates, follow @angular_book on Twitter.

The JHipster Mini-Book The JHipster Mini-Book is a guide to getting started with hip technologies today: Angular, Bootstrap, and Spring Boot. All of these frameworks are wrapped up in an easy-to-use project called JHipster.

This book shows you how to build an app with JHipster, and guides you through the plethora of tools, techniques and options you can use. Furthermore, it explains the UI and API building blocks so you understand the underpinnings of your great application.

For book updates, follow @jhipster-book on Twitter.

10+ YEARS


Over 10 years ago, I wrote my first blog post. Since then, I've authored books, had kids, traveled the world, found Trish and blogged about it all.

Roller and Struts 2 BOF at ApacheCon next week

ApacheCon Are you going to ApacheCon in Atlanta next week? If so, you might want to mark your calendar for the Roller + Struts 2 BOF on Wednesday night. It's from 8:30 - 9:30 in "Room 3" (whatever that means) and free beer will be sponsored by Atlassian. Thanks Guys!

Apparently, projectors aren't provided for BOFs, so we are in need of a projector to do a small presentation. If you happen to have a "projector connection" in Atlanta next week, please let me know.

Posted in Java at Nov 05 2007, 08:25:26 AM MST Add a Comment

RE: Life above the Service Tier

Yesterday I wrote the following:

I hope to develop with Flex, Grails, GWT or YUI + Struts 2 in the next 6 months. These seem like the most exciting technologies for Java web development in 2008.

This post is meant to explain why I think these are the most exciting technologies going forward.

A few weeks ago, a very interesting paper was posted on TSS: Life above the Service Tier. In this paper, Ganesh Prasad, Rajat Taneja and Vikrant Todankar introduce a new architectural style they're calling SOFEA, for Service-Oriented Front-End Architecture. To summarize:

The principles of SOFEA are:

0. Decouple the three orthogonal Presentation Tier processes of Application Download, Presentation Flow and Data Interchange. This is the foundational principle of SOFEA.

1. Explore various Application Download options to exploit usefully contrary trade-offs around client footprint, startup time, offline capability and a number of security-related parameters.

2. Presentation Flow must be driven by a client-side component and never by a server-side component.

3. Data Interchange between the Presentation Tier and the Service Tier must not become the weakest link in the end-to-end application chain of data integrity.

4. Model-View-Controller (MVC) is a good pattern to use to build the Presentation Tier.

Their paper can be downloaded from Life above the Service Tier.

I read this paper earlier this week and enjoyed reading it as well as thinking about the concepts it introduces. First of all, I believe SOFEA only applies to web applications and isn't a valid architecture pattern for web sites. While it may work for web sites, the traditional mechanisms (serving pages from the server side) seems to work well and isn't going away anytime soon.

So if SOFEA is the way of the future for developing web applications, where does that leave all the web frameworks that serve up pages server-side? This includes all Java web frameworks, Ruby on Rails and PHP. I think it leaves them in an interesting situation. They can still be usable if they can serve up the Application Download and the Data Interchange, but otherwise, they seem pretty much useless with this new architecture.

Is a SOFEA architecture a silver-bullet? I doubt it as there's still a lot of unanswered questions. How does SOFEA solve i18n and validation? Is it possible to re-use server-side validation rules in the client-side architecture? Granted this is probably a client-side framework feature rather than a SOFEA concept, but I still think it deserves some thought.

I don't know if i18n is that much of an issue for most applications. Most of the gigs I've consulted on in recent years were English-only, with no plans for internationalization. Validation is often server-side too. However, I believe server-side validation is often done simply because the web framework being used did not provide good client-side validation. How does i18n work in a JavaScript application? Can you bundle i18n scripts in the Application Download and have those read on the client-side - or do you serve up a different version of the application for different locales?

I think the most interesting part of SOFEA is how simple the backend becomes. With Spring and Hibernate (and some type of remoting) it should be easy to develop your SOA backend. But how do you publish those services? Do you still use a web framework on top to handle validation and such, or do you just markup POJOs with @WebService annotations?

Will 2008 be the year for SOFEA applications? It's definitely possible. I'm thinking of starting a Denver SOFEA user group to discuss and promote this architecture style. If I did - would you be interested in attending?

Posted in Java at Nov 02 2007, 12:03:49 PM MDT 13 Comments

Google Code for Educators

Google Code for Educators looks like some really great stuff from Google.

This website provides teaching materials created especially for CS educators looking to enhance their courses with some of the most current computing technologies and paradigms. We know that between teaching, doing research and advising students, CS educators have little time to stay on top of the most recent trends. This website is meant to help you do just that.

In the Tutorials area, you will find a set of online tutorials to which you can point students to learn basic concepts in important new technologies, or if you need a refresher.

In the Sample Course Content area, you will find materials such as lecture slides, readings, problem sets and projects that you can download to use in your own course. All these materials are distributed under a Creative Commons license, so you are free to use and modify these materials according to the terms of the license. This area includes sample course content developed by CS Faculty from various universities and Google engineers.

In the Video Lectures area, you will find a set of video-taped lectures from Google Video on our technology areas. These videos are great opportunities for students and faculty to hear directly from some of the current pioneers in high-tech.

In the Tools section you will find a set of tools and resources to help you get started with the material highlighted on the site. This area includes tools developed by Google engineers, as well as links to external resources.

Posted in Java at Nov 02 2007, 11:22:22 AM MDT Add a Comment

Flex and Grails Made Easy

I love how easy it is to start new projects these days. It was very difficult when I started creating AppFuse way back in 2002. We've come a long way baby!

Here's a couple of easy ways to get started with Flex and Grails:

I hope to develop with Flex, Grails, GWT or YUI + Struts 2 in the next 6 months. These seem like the most exciting technologies for Java web development in 2008.

Posted in Java at Nov 01 2007, 11:00:38 PM MDT 5 Comments

Draft Specification for automatically mapping URLs to Controllers and Views

Ted Husted has been working on a draft specification for "Heuristic Request/Response Mappings", based on technologies used by Rails, Struts 2 and Stripes.

The central idea is that instead of creating explicit mappings, the framework applies a series of heuristic transformations to match a URI with a code component and a view component.

The first part of the draft is available here:

* http://code.google.com/p/web-alignment-group/wiki/WAG_RFC_001

Before doing any more work on the description, I'd be very interested on feedback as to whether I'm making any sense, or whether the draft has turned into opaque gibberish :)

If you're developing a web framework (in any language) and use conventions to auto-map URLs-to-controllers and controllers-to-views, it'd be great to hear your feedback on this draft. It'd be pretty cool if you could switch frameworks/languages and use the same conventions across the board.

Posted in Java at Nov 01 2007, 03:03:49 PM MDT 7 Comments

Xebia Web Framework Contest

I found an interesting blog post today about a contest (English translation) a French company (Xebia) had with some Java web frameworks.

4 teams have developed the same web application, each with a framework (very) different. The frameworks used were:

  • Struts 2
  • Google Web ToolKit
  • Wicket
  • My Faces (JSF)

Overall, I think it's a good summary of the strengths and weaknesses of the various frameworks.

Posted in Java at Oct 30 2007, 09:32:34 AM MDT 8 Comments

Introduction to Grails with Scott Davis at the Colorado Software Summit

Grails According to Scott, today's Java-based web frameworks are partial solutions at best. They're only solving one piece of the puzzle - you still need to manage persistence, deployment, etc. all by yourself.

We're moving into a new era of web frameworks. The expectation now is a full-stack solution. Grails is a fully integrated modern Java web application in a box. It contains Spring, Hibernate, Quartz, Log4J, Jetty, HSQL, JUnit and Ant. You're not limited to using Jetty, you can type "grails war" and create a WAR that you can deploy to any application server. In a single zip/tar, you get the whole thing - including the database and servlet container. You get a lot of good default for free, but you're not limited to those defaults.

What does "modern" in a framework mean? It means it uses Convention over Configuration - Grails autowires components together based on naming conventions. Struts 1.x uses Configuration over Configuration - the more XML the better.

The Wisdom of Crowds - why are the many smarter than the few? What is the wisdom of crowds when it comes to web frameworks. Struts is the wisdom of crowds when it comes to web frameworks. It's based on sound principles (MVC) and was written by Craig McClanahan. He was the architect of "Catalina" Tomcat 4 and wrote Struts shortly thereafter. David Geary was contributor #2 to Struts. It has a proven track record and has a 60%-70% market share. Struts must be the perfect framework - especially since it has such a great pedigree.

So what's wrong with Struts?

  • It's 7 years old
  • It's verbose and overly complex (reflective of the EJB 2.x era)
  • Splintered community: Craig moved on to JSF -> created Shale, then the WebWork merger
  • While Struts 1.x was an unqualified success, Struts 2.x can't seem to build that critical mass - it can't seem to reach The Tipping Point like Struts 1.x did

The Recipe for a Tipping Point: Contagiousness / viral, tiny "tweaks" to a proven model can yield big, disproportionate effects, the rise is not "slow and steady" - the effect is dramatic and immediate.

Ruby on Rails won the hype award. It's largely worth the hype, but it's not revolutionary - it's evolutionary. It has tiny tweaks to the proven MVC-driven approach: Convention over Configuration, Scaffolding and Unified Technology Stack.

The one thing that Rails is lacking is Java support. Grails, on the other hand, offers the same experience using known, proven Java solutions.

  • Rails => "replacement"
  • Grails => "upgrade"

Scott drank the Rails Kool-Aid for a while and enjoyed it, but found it difficult to switch from Ruby in the morning to Java in the afternoon. With Grails, he doesn't have to do as much context switching, as well as all the Java libraries are available - the ones you know and love.

You can drop groovy.jar into your classpath and write Groovy code. One nice thing about Groovy is you can rename your existing .java files to .groovy and they'll work just fine. Included Ajax support: Script.aculo.us and Protoype as well as YUI. YUI is battle-tested since it's used by Yahoo and very well documented. You can use "grails install-dojo" to install the Dojo toolkit. Grails has a wealth of plugins available at http://grails.org/plugins.

Now we're going to crack our nuckles and build some code - slides are over.

 grails create-app conference
 cd conference
 grails create-domain-class Speaker (add some fields)
 grails generate-all Speaker
 grails run-app

The impressive things about this set of commands is I was able to 1) download Grails and 2) run all these commands at the same time that Scott did. I was definitely impressed (I knew I would be). Auto-scaffolding - you can get the same thing as "generate-all", but it generates controllers and views at runtime in-memory. All you need to do is create a domain object (i.e. Talk) and then create a TalkController that has the following line in it:

def scaffold = Talk

As a test, I tried this at the same time that Scott did and got the following error. It looks like Grails/Jetty isn't smart enough to pick up new classes as they're added.

[263102] commons.DefaultGrailsApplication Class not found attempting to load class Talk
java.lang.ClassNotFoundException: Talk
        at java.net.URLClassLoader$1.run(URLClassLoader.java:200)

Grails comes with a number of environments. Dev (the default) auto-reloads changes to Controllers, Views and even the Model (this is helpful for rapid development). Prod loads all items statically for maximum performance. To change the environments - you can change DataSource.groovy.

For some reason, adding/removing some properties on my Talk object and my application hasn't been the same since. Now when I try to access my TalkController, I see the following stack trace:

org.springframework.orm.hibernate3.HibernateQueryException: could not resolve property: difficulty of: Talk; nested exception is org.hibernate.QueryException: could not resolve property: difficulty of: Talk
	at org.springframework.orm.hibernate3.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:640)
	at org.springframework.orm.hibernate3.HibernateAccessor.convertHibernateAccessException(HibernateAccessor.java:412)
	at org.springframework.orm.hibernate3.HibernateTemplate.execute(HibernateTemplate.java:378)
	at org.springframework.orm.hibernate3.HibernateTemplate.executeFind(HibernateTemplate.java:342)
	at org.codehaus.groovy.grails.scaffolding.DefaultScaffoldDomain.list(DefaultScaffoldDomain.java:112)

I asked Scott about this error and he proved that removing properties from domain objects should work. I told him restarting Jetty didn't fix the problem and he suggested dropping the "Talk" table and letting Grails re-create it. Unfortunately, I have no idea where this database is, so that's difficult to do. Doh - now I realize what was causing the problem. Before I dropped the "difficulty" property, I had clicked on the column and that property was still referenced in the URL. When I'd refresh the browser, the stack trace occurred. I don't know if I'd consider this a bug or not.

dbCreate = hibernate.hbm2ddl.auto is used. When in development create-drop is used. In production and test environments, it uses update and saves the data between restarts.

You can turn off Hibernate's automatic schema alteration by commenting out "dbCreate" line in DataSource.groovy.

To run your application in Tomcat instead of Jetty, you can run "grails war" and copy the WAR to Tomcat. The WAR is created with the production environment by default, so you may need to pass in arguments or set environment variables if you want the WAR created in dev mode.

At this point, my battery died. Scott continued to cover how to order form elements (when using scaffolding) with "static constraints" and how to add validation rules. It was an excellent presentation and Grails definitely looks like a really cool web framework. The best part is I learned most of what you need to know to use it - in an hour!

I might have to try Grails soon - I love the concept of Life above the Service Tier and Grails would work nicely for serving up REST. I think YUI, GWT-Ext and Flex are probably the best frameworks for developing a SOFEA client. The question is - when using YUI, how do you download all pages in the application at once?

Posted in Java at Oct 25 2007, 07:03:42 PM MDT 19 Comments

RE: Trolling with Java Web Frameworks

Fred Daoud has an excellent post titled Trolling with Java Web Frameworks. Well written Fred!

Posted in Java at Oct 25 2007, 02:39:26 PM MDT 1 Comment

Google Goods at the Colorado Software Summit

This morning, I woke up early and attended Dion Almaer's talk on Google Gears. Dion works at Google in the Developer API group and is a member of the Google Gears development team. This presentation is called How to take your Web Application offline with Google Gears.

Dion starts with a video that Google Developers made. It's a parody of Dick in a Box, but it's called API in a Box. This was by far my favorite part of the presentation and it all went downhill from there. ;-)

Gears is a browser plugin that adds a database and a JavaScript API that allows applications to "go offline" and use these resources to store data. It does not do anything to handle synchronization of data back to the online database.

Gears has three modules as part of its API: LocalServer, Database and Workerpool.

The Database is embedded using SQLite. Google contributed Full Text Search to it and the entire database is 250K. Below is an example of how you might use the API:

var db = google.gears.factory.create("beta.database", "1.0");
db.open("database-demo");
db.execute("create table if not exists ...");
...
var rs = db.execute("select * from Demo order by Timestamp desc");
while (rs.isValidRolw()) {
    var name = fs.field(|);
    ...
}

During the rest of the talk, I tuned in and out, but caught a number of interesting tidbits:

  • GearShift - DB Migrations for Gears.
  • Database Query Tool - one-page browser-based application that can be added to existing applications to add a query browser.
  • Gears in Motion - full database tool for creating databases, modifying tables, inline-editing, etc. After building your database, you can export the SQL for use in a Gears application.
  • Syncing is not a part of Gears because it's a very difficult problem to solve - especially when you have huge data.
  • The best way to implement synching is to start simple, like Zoho Writer. It's like Google Docs, but allows you to read your documents off-line. The next version they're planning on allowing offline editing.
  • You should plan on allowing your application to run - possibly by using cookies to store the data and create a "CookieBaseContent" implementation that gets chosen instead of "GearsBaseContent". In other words:
    content = hasGears() ? new GearsBaseContent() : new CookieBaseContent();
    
  • Debugging is a pain - you can simplify by using helper functions that allow you to clear the database.
  • Google's Read/Write JavaScript API looks like some really cool stuff. It solves the cross-domain problem and is (at its core) a clever bundling of browser hacks. It's not specific to Google's APIs and can be used in any Ajax application.
  • Gearsmonkey - uses Google Gears with the Firefox Greasemonkey plug-in to take other's applications offline.
  • Dion uses Greasemonkey to add keystrokes to GMail and remove ads from Facebook.
  • Wikipedia has an offline version that's powered by Gears. It uses iframes to cache pages with Gears and was developed by Google. It's unannounced by Dion didn't say I couldn't blog about it. ;-)
  • Dojo offline has a sync framework.
  • Vortex is an offline toolkit that builds on Gears.
  • GWT has Gears support - all you have to do is drop a JAR in your classpath. If you don't like using Gear's JDBC-esque API - maybe you can use Hibernate with Gears?

Dion ended by talking about how Adobe Air is great for desktop-like applications that you can easily build with Ajax technologies. Silverlight is impressive, but only for media applications - you have to draw components yourself. Java Applets may make a comeback. The browser plugin has been rewritten to be fast as well as have full support for Java Web Start. It's possible that Gears + the Java Plugin can make it possible to use Java technologies (i.e. Hibernate or JPA) to talk to the browser's database. Firefox and WebKit are adding database components to their next major releases - so offline applications should become even easier to develop in the future.

Overall, this was a great talk - largely because Dion is a great speaker and made it fun and interesting.

After Dion's talk, I delivered my Web Framework talk and had some lunch while trying to get Rockies tickets (no luck). After lunch, I attended Bill Dudney's Comparing Spring & Guice talk. I learned some things about Guice I didn't know and enjoyed his comparison of the two Dependency Injection frameworks.

One question that Bill couldn't answer is how Spring 2.5's annotation support stacks up against Guice. Is it as full-featured as Guice? Does it add additional features and keep up with Guice for performance? What about wiring up objects without annotations - does it allow you to autowire your classes based on naming patterns without annotations in your code? What I'm hoping for is a DI framework that allows me to autowire classes using rules/conventions rather than annotations. I'm fine with using annotations for edge-cases, but it seems like a lot of the DI I do these days could be configured up-front and used for the entire application (rather than having to wire up each class).

Overall, it was a great day at the Colorado Software Summit.

View from our condo at CSS

Posted in Java at Oct 23 2007, 05:46:56 PM MDT 4 Comments

Choosing a JVM Web Framework

This morning I delivered my Choosing a JVM Web Framework presentation at the Colorado Software Summit. One of my goals for the talk was to get more audience participation and stories of how folks thought it best to choose a web framework. The room was packed and the crowd was interested, so we barely even used the slides I prepared. One of the most interesting things about the audience was that over 60% (of 50-60 people) were using Struts 1. Most of them came to learn about frameworks they might think about migrating too. Unfortunately, I didn't talk a whole lot about the frameworks and their features, but a few members had advice concerning frameworks *not* to use based on their experiences. Overall, it was a lot of fun to interact so much with the audience and hear their thoughts on web development for the Java Platform.

You can download a PDF version of my presentation from my presentations page. Thanks to all the folks who responded to my Stories Wanted post - I used many of these comments as part of the "Case Studies" in the presentation.

Posted in Java at Oct 23 2007, 02:20:13 PM MDT 3 Comments