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.

Celebrating My Mom's Retirement

A couple of weeks ago, after attending Abbie's Talent Show, the kids and I packed up and headed to Oregon for a weekend. This weekend marked a special weekend for my parents. When we arrived, my Mom had a week left of work before she retired from the Bureau of Land Management. You might've read about my Mom in the past. And you might know that my Dad retired last year.

My Mom has always enjoyed her career and I like to think I get a lot of enthusiasm for my own career from her. She taught me to love what you do for a living. When we lived at The Cabin, she had the drive and ambition to go back to school to get her degree in Forestry. Upon graduation, she got a job with the BLM and we moved to Oregon. My parents have lived there since 1990.

The weekend we spent in Oregon was somewhat magical. My parent's house sold in March after being on the market for only two weeks. They had a week left before they packed up and moved back to The Cabin. This meant the outside was pristine (because they fixed it up for the new buyers) and the inside was mostly packed. It was a sunny 3 days that weekend (which is rare in Oregon) and we had a blast at the Oregon Garden Brewfest, enjoyed a sunny BBQ with old friends and shared many memories derived from their 20 years in Oregon.

Huckleberry Aficionado Jack and Mimi The Crew Fountain at The Oregon Garden

It was a somewhat bittersweet experience, meeting with all their friends and talking about their move to Montana. Many expressed sadness that they were leaving, but that didn't stop my parents from grinning ear-to-ear. You could see the excitement of moving back home sparkle in their eyes.

Oregon Garden Brewfest Happy Beer Drinkers Old Friends

They have a huge challenge ahead of them and it seems they couldn't be happier. They'll be working on The New Cabin many long days and expect it to take a year or two.

I think my Mom said it best in an email she sent my sister and I a few days ago:

It's 9:30 and we are at Quinn's Hot Springs. Your father is snoring, he didn't last long when his head hit the pillow. We got here about 3, had a glass of wine and then soaked in the pools for an hour. Had a good dinner (I had buffalo short ribs -- mmm delicious) . They have a network, so I'm using my ipod for email.

I was crying when I drove across the state line because it felt so good to be home!

We are having a very nice drive home!! We love you!!!

Congratulations on Retiring Mom! You deserve it more than anyone else I know.

Abbie and Mimi Abbie and Mimi

Enhanced Version » My Mothers Day Card

Posted in General at May 07 2010, 12:18:24 AM MDT Add a Comment

Farewell to the 2009-2010 Ski Season

Top o' Jackson Hole The 2009-2010 Ski Season ended for me last weekend. This was mostly due to the fact that Winter Park and Copper closed and that's where I have my ski pass at. I'm writing this post to reflect upon what a great ski season it was. I skipped writing a similar post in 2009, mostly because I was basking in the Florida sun at a helluva wedding on the last ski weekend. 2008's season was the last one I wrote about, and I managed to get 21 days in that year.

This season, I managed to get in 25 days, my most ever in a season! Not only that, but I got to watch Jack ski like a madman, enjoy a fantastic weekend with friends in Jackson Hole and perform The Trifecta. As a parent, I feel like a lot of hard work and persistence has finally paid off. Jack can now get on and off the lift by himself and Abbie hit her first jump (catching 2-3 feet of air) in the terrain park. Yes, I'm a proud papa.

Abbie showing Jack how to do bumps

Personally, I was able to complete several top-to-bottom runs (without stopping) at Mary Jane. This was a goal last year that I was never able to accomplish. This feat requires you to be in good shape and have some eloquence in your skiing style. I thank my good friend Matt Good for his tips on how to ski bumps more smoothly, exerting less energy. The one thing I failed to pull off was a helicopter, even though I tried twice. Oh well, I'll get it next year.

Thanks to all my skiing friends for the good times and to Winter Park, Mary Jane, Copper Mountain, Steamboat and Jackson Hole for the wonderful slopes. Can't wait to do it again next year.

Posted in General at Apr 24 2010, 10:49:24 AM MDT Add a Comment

My iPad Review

Wi-Fi iPad One week before my home computer was stolen from my living room, the iPad was announced. After watching the initial video, I figured I might want to get one. Fast forward to iPad release day. I was skiing with a friend in Winter Park as I was scratching my head trying to come up with good Easter presents for my kids. Then it hit me: An iPad would be an excellent Easter gift for my kids.

I called the Cherry Creek Apple store and asked if they had any left. They said they did, but they'd likely be sold out before the end of the day. I arrived back in Denver around 3 and was 2nd in line at the Apple Store at 3:30. 5 minutes later, I walked out with an iPad. They were sold out of 32GB models, so I went with the 64GB.

CNET has a good about the 5 Reasons NOT to get an iPad. There #1 reason is great: because you don't need one. They're absolutely right, I didn't need an iPad. I wanted a new home computer so I don't have to pack my MacBook Pro back and forth to the office. However, I realized that most of the time I'm at home, I'm not doing much hard-core computing. Most of the time, I'm checking e-mail, reading Twitter or reading articles. So I bought it because it was cheaper than a new home computer, but I also realize it's not a computer replacement.

It's really just a big iPhone.

In every aspect, it's a larger iPhone. Abbie's first words when she opened it on Easter Sunday were "It's a big phone!" It is a big iPhone, but it's much more pleasant for reading articles and e-mail. Beyond that, it seems good for games, but it's certainly not super-duper fantastico. It's a bit heavy; too heavy to read as you would a book. After holding it for an hour or two last night, my left hand started to get sore. Also, its keyboard sucks. Maybe I'll get used to it in the long run, but without the tactile feedback of keys, it can be difficult to type without looking. The other things I don't like about it are:

  • There are very few good apps (iPhone apps work, but they're small).
  • The screen gets dirty quickly and it looks kinda gross when it's not lit up.
  • The Photos app doesn't work at all for me. It says "Updating Library" when I open it, then crashes several seconds later. Maybe I have too many pictures (12.5K items, 28.5 GB).
  • When it's synching with my laptop, it constantly connects and reconnects and makes a loud noise each time.

I took the iPad to work on Monday and received some interesting feedback from co-workers.

There are some good things about it. First of all, it's wicked fast. Apps *pop* and load their data very quickly. Way faster than my iPhone and faster than both my MacBook Pro and the powerhouse Mac Pro I use at work.

I really like the newspaper apps for reading the latest news articles. I'm not much of a news person, but there's a good chance I read more of it because the apps are so pleasing to the eye. Also, the Netflix app sucked me in as soon as I started reading about it. I've bought my kids several movies on iTunes, but there's still not a huge selection to choose from. With Netflix and its live streaming, we have seemingly thousands of movies to choose from and they're all a touch away. The Mail app is also pleasant to use, possibly moreso than Mail.app on OS X and Gmail in any ol' browser.

There's a good bit of me that's underwhelmed with the device, but I think it has a lot of potential when more apps start appearing. It also seems to need some accessories right away: namely a case to carry it in and a shield to keep clean. I could also see getting a stand for it to enhance its digital picture frame feature. If I could plug it into my HD TV, it might even eliminate my need for OnDemand Movies and DVDs.

I think the biggest potential for the iPad is kids, baby boomers and couples. There's a good chance all of these demographics have a real computer in their home, but the head of household doesn't want to spring for two. Take my mom for instance, she wants an iPad for e-mail because my dad always hogs their iMac. My kids aren't that enthralled with it, but it took them awhile to appreciate the Wii and iPhone. With the Wii, it was the Super Mario Bros. game that reeled them in. Same story with my iPhone; they love the games.

My guess is the real attraction of the iPad will be the apps that are built for it. I can't wait to see what developers come up with.

Posted in Mac OS X at Apr 06 2010, 10:51:22 PM MDT 9 Comments

The Trifecta: 3 Resorts in 3 Days

Last Tuesday night, I worked late in hopes of having a Powder Day on Wednesday. I went to bed at 2 a.m., woke up at 6 a.m. and found that there was only 5" of fresh powder at Winter Park. My ski rule is there has to be 9" of powder in order to justify playing hookie. Working these extra hours on Tuesday -- coupled with a late night on Wednesday -- and I hit my 40-hour-max on Thursday. Naturally, I took Friday off and headed for the hills. Below is how I started my Friday morning.

Good start to a Friday

After several high-speed groomed runs, I hit Mary Jane's bumps a few times (completing Outhouse and Trestle w/o stopping) and watched the Whiteout begin around 11.

White Out

Around noon, I began searching for a location to watch DU in the NCAA Hockey Playoffs. Unable to find a bar with ESPN U, I skied until 2 and then headed to my friend's mountain home. He had the game recorded, so I got to watch it and endure its unfortunate outcome. DU played really well, but couldn't beat RIT.

On Saturday, the snow report said 6" at Steamboat and 6.5" at Winter Park. Since we hadn't been to Steamboat in a while, my friend (a.k.a. The Professor) and I decided to drive there for the day. It was an excellent decision because there was easily a foot of fresh powder in the chutes and trees. We skied from 9:30 to 4:00; easily my most difficult day of skiing this year.

Steamboat Chutes The Professor recovers from a tree

On Sunday, I woke up and read the ski report: Copper had 3" of new snow. That's when it hit me that I could pull of The Trifecta. I don't know that I've ever done 3 resorts in 3 days before, but I'm happy to report I've done it now. Sunday was a beautiful day of Spring Skiing and Copper did not disappoint. They'd received 7" inches in 48 hours, making Sunday an awesome day for trees and double blacks. There was plenty of powder, great friends and lots of smiles from everyone. You can see from the pictures below what a beautiful Blue Bird Day it was.

You are about to experience Copper's High Alpine Nice ride up Storm King Spaulding Bowl View from Enchanted Forest

With only 3 weeks left in ski season, I'm happy to report I have 22 days in. With any luck, I'll hit 25 days and set a personal record.

Posted in General at Mar 29 2010, 08:11:17 AM MDT Add a Comment

My TSSJS 2010 Presentations and Summary

This afternoon, I delivered my last talk at TSSJS 2010 on The Future of Web Frameworks. It's true that I made some bold statements, but please remember that this is my personal opinion, based on my experience. For the most part, I've been involved in super high-traffic websites for the last few years and this has influenced my opinion on web frameworks. Just because I don't recommend your favorite framework doesn't mean it won't work for you. In fact, many of the best web applications today were built without an open source (or commercial) web framework. In the end, it's not as much about the web framework you're using as it is about hiring smart people. Below is my slide deck from this talk.

Yesterday, I did a GWT vs. Flex Smackdown with James Ward. While there wasn't as much trash talking as I'd hoped, I enjoyed delivering it and disputing the greatness of Flex. Below is the presentation that James and I delivered.

The show itself was great this year. It had more attendees than I've seen in a long time. There were a lot of really interesting sessions and and an often humorous Twitter back-channel. I attended quite a few talks and jotted down my notes from several of them. Please see the links below if you're interested in the sessions I attended. You can view all of the presentations from TSSJS 2010 on SlideShare.

Thanks to everyone who came to Vegas and to TheServerSide for an excellent conference.

Posted in Java at Mar 19 2010, 05:29:08 PM MDT 8 Comments

What's New in Spring 3.0

This morning, I attended Rod Johnson's What's New in Spring 3.0 keynote at TSSJS. Rod ditched his slides for the talk and mentioned that this might be risky. Especially since he was pretty jetlagged (flew in from Paris at 11pm last night). Below are my notes from his talk.

The most important thing for the future of Java is productivity and cloud computing. The focus at SpringSource is heavily on productivity and not just on improving the Spring codebase. If you look at the comparisons out there between Rails and Spring, it's not an apples-to-apples comparison. The philosophy with Spring has always been the developer is always right. However, if you look at something like Rails, you'll see it's far more prescriptive. That layer of opinionated frameworks is important in that it improves your productivity greatly.

SpringSource is putting a lot of emphasis on improving developer productivity with two opinionated frameworks: Grails and Spring Roo. To show how productive developers can be, Rod started to build a web app with Spring Roo. As part of this demo, he mentioned we'd see many of the new features of Spring 3: RestTemplate, @Value and Spring EL.

Rod used STS to write the application and built a Twitter client. After creating a new project using File -> New Roo Project, a Roo Shell tab shows up at the bottom. Typing "hint" tells you what you should do write away. The initial message is "Roo requires the installation of a JPA provider and associated database." The initial command is "persistence setup --provider HIBERNATE --database HYPERSONIC_IN_MEMORY". After running this, a bunch of log messages are shown on the console, most of them indicating that pom.xml has been modified.

The first file that Rod shows is src/main/resources/META-INF/spring/applicationContext.xml. It's the only XML file you'll need in your application and includes a PropertyPlaceHolderConfigurer, a context:component-scan for finding annotations and a transaction manager.

After typing "hint" again, Roo indicates that Rod should create entities. He does this by running "ent --class ~.domain.Term --testAutomatically". A Term class (with a bunch of annotations) is created, as well as a number of *.aj files and an integration test. Most of the files don't have anything in them but annotations. The integration test uses @RooIntegrationTest(entity=Term.class) on its class to fire up a Spring container in the test and do dependency injection (if necessary). From there, Rod demonstrated that he could easily modify the test to verify the database existed.

private SimpleJdbcTemplate jt;

@Autowired
public void init(DataSource ds) {
    this.jt = new SimpleJdbcTemplate(ds);
}

@Test 
public void testDb() {
    jt.queryForInt("SELECT COUNT(0) FROM TERM");
}

Interestingly, after running the test, you could see a whole bunch of tests being run, not just the one that was in the class itself. From there, he modified the Term class to add two new properties: name and searchTerms. He also used JSR 303's @NotNull annotation to make the fields required.

@Entity
@RooJavaBean
@RooToString
@RooEntity
public class Term {

    @NotNull
    private String name;

    @NotNull
    private String searchTerms;
}

Next, Rod added a new test and showed that the setters for these properties were automatically created and he never had to write getters and setters. This is done by aspects that are generated beside your Java files. Roo is smart enough that if you write toString() methods in your Java code, it will delete the aspect that normally generates the toString() method.

To add fields to an entity from the command lie, you can run commands like "field string --fieldName text --notNull" and "field number --type java.lang.Long --fieldName twitterId --notNull". The Roo Shell is also capable of establishing relationships between entities.

After successfully modifying his Entities, Rod started creating code to talk to Twitter's API. He used RestTemplate to do this and spent a good 5 minutes trying to get Eclipse to import the class properly. The best part of this demo was watching him do what most developers do: searching Google for RestTemplate to get the package name to import.

After awkward silence and some fumbling, he opened an existing project (that had the dependencies properly configured) and used Java Config to configure beans for the project. This was done with a @Configuration annotation on the class, @Value annotations on properties (that read from a properties file) and @Bean annotations for the beans to expose. The first time Rod tried to run the test it failed because a twitter.properties file didn't exist. After creating it, he successfully ran the test and successfully searched Twitter's API.

The nice thing about @Configuration is the classes are automatically picked up and you don't need to configure any XML to recognize them. Also, in your Java classes, you don't have to use @Autowired to get @Bean references injected.

After this, Rod attempted to show a web interface of the application. He started the built-in SpringSource tc Server and proceeded to show us Tomcat's 404 page. Unfortunately, Tomcat seemed to startup OK (no errors in the logs), but obviously something didn't work well. For the next few silent moments, we watched him try to delete web.xml from Eclipse. Unfortunately, this didn't work and we weren't able to see the scaffolding the entities that Rod created.

At this point, Rod opened a completed version of the app and was able to show it to us in a browser. You could hear the murmur of the crowd as everyone realized he was about to show the the Twitter search results for #tssjs. Most of the tweets displayed were from folks commenting about how some things didn't work in the demo.

In summary, there's some really cool things in Spring 3: @Configuration, @Value, task scheduling with @Scheduled and one-way methods with @Async.

Final points of SpringSource and VMWare: they're committed to Java and middleware. Their big focus is providing an integrated experience from productivity to cloud. There's other languages that are further along than Java and SpringSource is trying to fix that. One thing they're working on is a private Java cloud that companies can use and leverage as a VMWare appliance.

I think there's a lot of great things in Spring 3 and most users of Roo seem to be happy with it. It's unfortunate that the Demo Gods frowned upon Rod, but it was cool to see him do the "no presentation" approach.

Posted in Java at Mar 19 2010, 11:46:25 AM MDT 2 Comments

Developing Rich Web Service APIs with Java

This afternoon, I attended Ryan Heaton's talk on Developing Rich Web Service APIs with Java. I've always admired Ryan's work and what he's done with Enunciate. Below are my notes from his talk.

We've come a long way from the WS (SOAP) <-> EJB days. There are many tools that you can use to develop web services today. A Web Service is an API that's accessible over a network via platform-independent protocol. Historical examples of web services (in chronological order):

  • CORBA
  • DCOM
  • RMI
  • SOAP
  • REST

A Web Service is composed of code wrapped with a container and it's bound to a contract. The table below shows the types of web services and their equivalent Java standard.

StandardTechnology
SOAP JAX-WS
RESTJAX-RS
XMLJAXB
JSON???

JAXB is the standard technology used to marshal XML <-> Java. It's annotation-driven, using @XmlRootElement, @XmlElement and @XmlAttribute to translate Java properties to XML.

JAX-WS is a Java standard, outputs classes as SOAP endpoints and it's annotation-driven. @WebService and @WebMethod are the main annotations. @WebMethod is only needed if you're trying to expose a non-public method.

JAX-RS is a Java standard used to expose REST services. Not surprisingly, it's annotation-driven. The class itself needs to be annotated with @Path. Methods are annotated with @GET, @PUT, @POST or @DELETE. If you need to pass in a parameter to a method, you can add a path parameter like the following:

@Path("/{id}")
@GET
public Person readPerson(@PathParam("id") String id);

To specify the possible mime-type outputs of a method, you can use the @Produces annotation. For example:

@Produces({"application/xml", "application/json"})

You can also do this for input methods with the @Consumes annotation.

For JSON, there's no Java standard. However, there's a number of libraries available, including Jackson, Jettison, GSON, XStream. Personally, I've used Jackson and highly recommend it.

The major players in exposing Java code as JAX-WS and JAX-RS services are Oracle, Spring and JBoss. Oracle (formerly Sun) has implemented the JAX-WS reference implementation and it's called Metro (a.k.a. JAX-WS RI). For JAX-RS, Oracle has the Jersey project. For Spring, the JAX-WS and JAX-RS implementation is Apache CXF. JBoss has JBoss-WS and RESTEasy.

There's also a number of custom containers for exposing web services. For example, AMF (implementations: BlazeDS, GraniteDS), GWT-RPC (GWT), JSON-PRC (DWR), Atom (Abdera), OpenSocial (Shindig).

The contract is a very important part of a web service API. It's composed of an Interface Definition Language (WSDL, WADL JSON Schema), Developer Docs (text, context, preconditions, restrictions), example code and client libraries.

Enunciate allows you to create your contract for your web services. It's a build-time WS Development tool. It generates developer documentation and client-side libraries (for Java, C/C++, Objective C, ActionScript and Ruby). It leverages existing specs (JAX-*) and fails fast at compile time.

From there, Ryan gave us a demo of Enunciate and how it could easily create an API website based on JAX-RS annotations.

I liked Ryan's talk and I'm definitely a fan of Enunciate. While I didn't learn anything new, I think there's a lot of Java developers that don't know about the various standards and how easy it is to develop web services. Hopefully by taking notes from Ryan's talk, I'll get the word out a bit more and make more folks aware of Enunciate. On a related note, Sonatype has a good post on how they documented the Nexus API with Enunciate.

Posted in Java at Mar 18 2010, 05:51:00 PM MDT 1 Comment

C++, Java and .NET: Lessons Learned from the Internet Age

Today at TSSJS, I attended Cameron Purdy's keynote titled C++, Java and .NET: Lessons learned from the Internet Age, and What it means for the Cloud and Emerging Languages.

His talk was a retrospective of the trade-offs compared to C++ illustrated by Java, C# and other VM-based programming languages with Garbage-Collection, scripting languages simultaneously thrived, and what this teaches us about the applicability of technology to emerging challenges and environments such as cloud computing. Why did Java become so successful? Some folks say it was marketed better, but it was Sun - so we know that could've have been possible.

Cameron is the VP of Development for Oracle Fusion Middleware, responsible for the Coherence Data Grid product which has Java, C# and C++ versions. Data Grids are RAID for servers. It provides a reliable data tier with a single, consistent view of data and enabled dynamic data capacity including fault tolerance and load balancing. The servers cooperate together and act as an organism to manage their information.

Java when it first came out very much looked like evolution. From a C++ programmers perspective, Java was bloated.

Below are Cameron's Top 10 Reasons Why Java has been able to supplant C++. This started happening around 1996-97. Warning to Language Fanbois: Yes, I know there are 3rd party GC implementations that fix some of these issues.

10. Automated Garbage Collection: A significant portion of C++ code is dedicated to memory management. This meant faster time to market and lower bug count.

9. The Build Process: C++ builds are slow and complicated. Personal example: 20 hour full build in C++ compared to 7 minutes in Java.

8. Simplicity of Source Code and Artifacts: C++ splits source into header and implementation files. Artifacts are compiler-specific, but there are many of them. With Java, there's just one .java and just one .class.

7. Binary Standard: In addition to being loadable as a class by a JVM, a Java classfile can be used to compile against. Java defers platform-specific stuff to the runtime.

6. Dynamic Linking: No standard way to dynamically link classes in C++.

5. Portability: Java is portable with very little effort; C++ is portable in theory, but in practice you have to build another language (#ifdef'd types, etc.) on top of it. C++ has significant differences from vendor to vendor. Some unnamed major vendors have horrid support for the C++ standard, particularly templates.

4. Standard Type System: Java has specified, portable primitive types. C++ still has a hard time defining what a String is. Multi-threading? You must be joking. STL? Maybe some day. Basically nothing is standard!

3. Reflection: Full runtime capability to look at the runtime. C++ has optional RTTI, but no reflection. Enables extremely powerful generic frameworks. It gives you the ability to learn about, access and manipulate any object.

2. Performance: GC can make memory management much more efficient (slab allocators, escape analysis). This is because of modern architectures and the fact that Java can take advantage of multiple threads. Thread safe smart pointers in C++ are 3x slower than Java references. Hotspot can do massive inlining, which is very important for dealing with layers of virtual invocation.

1. Safety: Elimination of pointers (arbitrary memory access, ability to easily crash the process). With Java, there's no buffer overruns; code and data cannot be accidentally missed.

Honorable Mention: C++ Templates. Next time someone complains about Java Generics, make them read C++ Templates. They're fugly and extremely bloated.

The Top 10 list of advantages C++ has over Java:

10. Startup Time: The graph of initially loaded class in Java is pretty large. Conclusion: Not good for "instant" and short-running processes.

9. Memory Footprint: Java uses significantly more memory than C++, particularly for "small" applications.

8. Full GC Pauses: Sooner or later, there is a part of GC that can't be run in the background and can't be avoided. This causes havoc for distributed processes and things like real-time financial systems.

7. No Deterministic Destruction: No support for RAII. Cannot count on finalizers. There's not even a "using" construct in Java.

6. Barriers to Native Integration: Operating Systems are built in C/C++. APIs are typically in C.

And that's all Cameron could come up with. Turns out it was only a top 5 list.

So why did the shift from C++ to Java and C# happen? Because Shift Happens. First of all, Al Gore built this internet thing and the World Wide Web. We built a couple browsers with C++, but then we were done. Oh wait, we needed a web server too, so we built Apache. What about the other things? The things that run in the browser? There was no way we were going to run C++ in the browser b/c it was too unsafe. All the advantages that C++ had over Java didn't matter on the web. Startup time wasn't a concern when we left our app server running for months. Memory wasn't an issue because we had GB of RAM on our machines.

What about scripting languages? All the areas where C++ might have an advantage, scripting languages jumped in. They offered simplicity and approachability (hooks up to database, manages state on behalf of the user, produces HTML), rapid application development (no OO architectural requirements, save and refresh).

So what about cloud computing? Can we take what we learned from Java and C++ and apply them to what we see coming down the pipe now with cloud computing? What are we missing? What are the advantages that Java would be missing in a cloud environment?

The things missing from the VM: modularity, lifecycle and isolation. Lower memory footprint and predictable GC pauses. Things missing from the platform: distributed system as a system, provisioning and metering, cloud operating systems APIs, persistence (including key/value) and Map/Reduce-style processing. Finally, the application definition is missing packaging, resource declaration and security in a shared environment.

What's changed in the world since Java was introduced? Hardware virtualization, stateful grid infrastructure and capacity on demand ISPs (EC2). What's coming in Java? Modularization, NIO pluggable file systems, JVM Bare Metal and Virtual Editions. Conclusion: Java either steps up or something else will.

This was an enjoyable talk to listen to and I very much enjoyed Cameron's humor and slide pictures that supported it. As Dusty said, Cameron has a pretty clear picture of what the Java Roadmap should look like. Let's hope Oracle is listening.

Posted in Java at Mar 18 2010, 01:36:28 PM MDT 4 Comments

Highly Interactive Software with Java and Flex

This morning at TSSJS, I attended James Ward's talk about Highly Interactive Software with Java and Flex. Below are my notes from his talk.

Application have moved from mainframes (hard to deploy, limited clients) to client/server (hard to deploy, full client capabilities) to web applications (easy to deploy, limited clients) to rich internet applications (easy to deploy, full client capabilities).

Shortly after showing a diagram of how applications have changed, James showed a demo of a sample Flex app for an automobile insurance company. It was very visually appealing, kinda like using an iPhone app. It was a multi-form application that slides right-to-left as you progress through the wizard. It also allowed you to interact with a picture of your car (to indicate where the damage happened) and a map (to indicate how the accident happened). Both of these interactive dialogs still performed data entry, they just did it in more of a visual way.

Adobe's developer technology for building RIAs is Flex. There's two different languages in Flex: ActionScript and MXML. ActionScript was originally based on JavaScript, but now (in ActionScript 3) uses features from Java and C#. On top of ActionScript is MXML. It's a declarative language, but unlike JSP taglibs. All you can do with MXML is instantiate objects and set properties. It's merely a convenience language, but also allows tooling. The open source SDK compiler takes Flex files and compiles it into a *.swf file. This file can then be executed using the Flash Player (in browser) or Air (desktop).

The reason Adobe developed two different runtimes was because they didn't want to bloat the Flash Player. Once the applications are running client-side, the application talks to the web server. Protocols that can be used for communication: SOAP, HTTP/S, AMF/S and RTMP/S. The web server can be composed of REST or SOAP Web Services, as well as BlazeDS or LC Data Services to talk directly to Java classes.

To see all the possible Flex components, see Tour de Flex. It contains a number of components: core components, data access controls, AIR capabilities, cloud APIs, data visualization. The IBM ILOG Elixir real-time dashboard is particularly interesting, as is Doug McCune's Physics Form.

Next James showed us some code. He used Flex Builder to create a new Flex project with BlazeDS. The backend for this application was a JSP page that talks to a database and displays the results in XML. In the main .mxml file, he used <s:HTTPService> with a URL pointing to the URI of the JSP. Then he added an <mx:DataGrid> and the data binding feature of Flex. To do this, he added dataProvider="{srv.lastResult.items.item}" to the DataGrid tag, where "srv" is the id of the HTTPService. Then he added a Button with click="srv.send()" and set the layout to VerticalLayout. This was a simple demo to show how to hook in a backend with XML.

To show that Flex can interact with more than XML over HTTP, James wrote a SOAP service and changed <s:HTTPService> to <s:WebService> and changed the "url" attribute to "wsdl" (and adjusted the value as appropriate). Then rather than using {srv.lastResult.*}, he had to bind to a particular method and change it to {srv.getElements.lastResults}. The Button's click value also had to change to "srv.getElements(0, 2000)" (since the method takes 2 parameters).

After doing coding in Flex Builder, James switched to his Census to compare server-execution times. In the first example (Flash XML AS), most of the time was spent gzipping the 1MB XML file, but the transfer time is reduced because of this. The server execution time is around 800ms. Compare this to the Flex AMF3 example where the server execution time is 49ms. This is because the AMF (binary) protocol streamlines the data and doesn't include repeated metadata.

To integrate BlazeDS in your project, you add the dependencies and then map the MessageBrokerServlet in your web.xml. Then you use a services-config.xml to define the protocol and remoting-config.xml to define what Java classes to export as services. To use this in the Flex aplication, James changed <s:WebService> to <s:RemoteObject>. He changed the "wsdl" attribute to "endpoint" and added a "destination" attribute to specify the name of the aliased Java class to talk to. Next, James ran the demo and showed that he could change the number of rows from 2,000 to 20,000 and the load time was still much, much faster than the XML and SOAP versions.

There's also a Spring BlazeDS Integration project that allows you to simply annotate beans to expose them as AMF services.

BlazeDS also includes a messaging service that you can use to create publishers and subscribers. The default channels in BlazeDS uses HTTP Streaming and HTTP Long Polling (comet), but it can be configurable (e.g. to use JMS). There's also an Adobe commercial product that keeps a connection open using NIO on the server and has a binary protocol. This is useful for folks that need more real-time data in their applications (e.g. trading floors).

I thought this was a really good talk by James. It had some really cool visual demos and the demo was interesting in showing how easy it was to switch between different web services and protocols. This afternoon, I'll be duking it out with James at the Flex vs. GWT Smackdown. If you have deficiencies of Flex you'd like me to share during that talk, please let me know.

Posted in Java at Mar 18 2010, 12:29:26 PM MDT 4 Comments

The Cloud Computing Continuum with Bob McWhirter

This afternoon, I sat in a Keynote by Bob McWhirter at TSSJS 2010. Bob is the Chief Architect of Cloud Computing at Red Hat. Bob is "The Despot" at Codehaus, helped start Groovy and founded Drools. Below are my notes from his talk.

The cloud is not an either/or question. A scorched Earth strategy is not necessary to be in the cloud. The cloud is a continuum of technologies, many of those that you're already familiar with. You're used to web, messaging and storage. You can add just a little bot of cloud to your application at a time.

So what is the cloud?

It's the next logical step in application delivery.

How did we get to the cloud? First, we jammed a lot of servers into a closet (back in the .com days). That's a lot of stuff to deal with if all you want to do is deliver an internet-based service. Then we did some colo. The problem with colo was that it was still our stuff. Then we leased managed servers. With the cloud, we lease what appears to be servers (or services). This is a path we've all been taking to abstract the annoying bits away from hosting an internet-based service.

The typical diagram of a cloud has IaaS, PaaS and PaaS. IaaS abstracts away hardware. PaaS abstracts away services. SaaS abstracts away software.

Tenants of the cloud:

  • The illusion of infinite resources.
  • On-demand acquisition and provision.
  • Someone else's responsibility.

Magicians provide the illusion of pulling a card out of your ear, but they don't actually do it. Because there are limits of what we can do. With on-demand requisitioning, there's no more purchase orders. There's no more waiting for delivery. No waiting for IT to rack it. Or install it. By having someone else manage your hardware, it's not your problem. There's clear lines of responsibility. This intentionally limits visibility into the implementation. Hopefully it's best-of-breed.

The Cloud is really just a mindset. Virtualization makes it affordable to make mistakes. Repeatedly. Each service is managed as an autonomous entity. Services are designed for scalability.

Architecture 101 give us a presentation layer, a business logic layer and a persistence layer. You can scale it by putting many instances on many servers. However, the truth is that most apps are a big ball of mud. You need to get your application in order, then figure out which parts really needs to scale. Is the web tier really where we have trouble? Painting HTML isn't all that hard.

You don't have to put everything in the cloud. The cloud is not a revolution. We still need containers for web things, messaging things, storage of things and other things. Containers still exist, they're just in the cloud.

From container to cloud
When you have an application and a database, there's not much to abstract away into the cloud. However, as soon as you notice your DB is slow, you'll add caching. Once you hit your machine's memory limit, you discover distributed caching systems. Once you've done this, you'll discover that the network isn't all that slow, especially compared to spinning disks. Then you realize that you don't even need the storage and you can keep everything in cache. From there, you move to a RESTful caching service. Then you call it a NoSQL Service so you can be buzzword-compliant.

As far as caching services, there's many available, but a lot of them are startups. However, the cloud does not have to mean external 3rd-party providers. Remember DBAs? It was their job to view the database as a service and to protect it. There's a good chance that we'll end up with DBAs for services. By turning caching into an independent service, it becomes subject to economies of scale.

The cloud is a mindset. It's an SOA approach that allows groups to specialize and optimize for scale.

So how do you implementing a local cloud? We already have great caching technologies. Bob, with his JBoss hat on, recommends Infinispan and its REST API. To get around network latency, you can still run your cloud on your LAN. You're essentially trading disk traffic for network traffic. You can use many hands (e.g. MapReduce) to make things happen quickly.

Besides caching, there's a number of other services that can be put in the cloud. For example:

  • Messaging (REST-MQ
  • Scheduling
  • Security & Identity (OASIS, etc)
  • Computation (query & otherwise)
  • Transactions (REST-TX)
  • Business Process Management
  • Telephony (VOIP, SMS)

Your application becomes a stack of services, instead of a stack of software.

Higher-order business-logic services are also subject to cloudification. Ultimately, going into the cloud is not rocket science. The cloud does not turn everything on its head. We don't have to wait for new companies to develop new technologies. Startups may be the best consumers of the cloud, but might not be the best providers. We'll let the startups assume the risks for now. Until the 3rd party services have been proven, it's probably best to build your own cloud of services.

More than anything, the cloud has caused a return to fundamentals. Once your app is a collection of services, you can easily pick and choose what pieces you want to put in the cloud. This is where we're headed, whether you like it or not. As more apps become global-scape, you're going to run into these issues. By adopting a cloud mindset and architecture, your app can be prepared for scalability issues.

For more communication with Bob and his Cloud Evangelism, checkout StormGrind or follow him on Twitter.

Personally, I really enjoyed Bob's talk. It was by far the best keynote today, mostly because he told a story and did it elegantly with a nice-looking presentation. Not only that, but he provided the audience with a practical view of the cloud and ways that we can start using it in our applications today.

Update: You can find the slides from this session on SlideShare.

Posted in Java at Mar 17 2010, 04:20:26 PM MDT 1 Comment