Tuesday Sep 21, 2010

Java EE 6 Twitter Demo @ JavaOne 2010 Technical General Session Keynote

This blog explains a typical 3-tier Java EE 6 application that lets the user monitor twitter trends for pre-defined hashtags. The following diagram explains the application's architecture.

Java EE 6 is a complete stack that provides support for all three tiers. This application uses a Java Server Faces front-end and uses PrimeFaces widget library to generate the monitoring charts. The widget library provides 100+ rich set of components and uses JSF 2.0 APIs and Servlet 3.0 features like self-registration. The "backing bean" for the JSF front-end is an EJB packaged in the WAR - yet another ease-of-use feature in Java EE 6. This EJB uses JPA for persistence query the stored tweets in a database. There is another EJB in the middle tier that triggers a method every 3 minutes, specified using the simplified cron-like @Schedule syntax, and uses Jersey Client API to get data from Twitter. And this EJB also uses JPA to store the queried tweets in the database.

A live version of this demo is available at glassfish.org/twitter-demo. An earlier snapshot of the trends is shown below:

The source code for this application can be downloaded as a Maven project here. This code comes with a "readme.txt" that explains how to create schema for a pre-defined JDBC resource in GlassFish, deploy, and run the application.

This application demonstrates the following features of Java EE 6:

  • Facelets as templating language using JSF 2.0
  • Composite components using JSF 2.0 - enables abstraction and reusable code
  • Third-party open source widget library based upon JSF 2.0
  • Simplified EJB packaging in a WAR file
  • CDI bean as the "backing bean" for JSF 2.0 and other dependency injection
  • Simplified cron-like timer syntax in EJB 3.1 using @Schedule
  • Jersey Client API to invoke RESTful endpoints
  • Simplified usage of JPA for persistence

Currently this application uses a pre-defined set of hashtags. A future version will allow the users to specify their own set of hashtags and then monitor them.

How about using this application for a tweet-a-thon for your next conference ?

Technorati: conf javaone javaee6 glassfish twitter 3tier architecture primefaces

Wednesday Jun 16, 2010

Uber Conf 2010 - Day 3 Report

Day 3 of Uber Conf 2010 (Day 2 and 1), again, started with a great run with fellow attendees - 10 miles in 1:15:22 with an average pace of 7:28 minutes/mile. Here is the speed-vs-elevation chart:

And complete details about the run are available below:

After a mentally and physically exhausting day, lets see how many runners show up for the run tomorrow morning. I'll try to be outside the lobby by around 6:30 am-ish.

Attended a 3 hour Scala for Java Programmers Workshop by Venkat and extensive notes + code samples on that are available here.

The next interesting talk I attended was on Emergent Design by Neal Ford and here are the key points:

  • Emergent Design is about finding idiomatic patterns (technical and domain) in your code that already exists
  • Architecture is stuff that's hard to change later - e.g. Language, Web framework. You write code on top of that framework and is the Design element which can be easily changed.
  • What is software design ? More details on developerdotstar.com/mag/articles/reeves_design.html
  • There are known unknowns and there are unknown unknowns - just like software.
  • Things that obscure emergent design: nature of complexity (essential and accidental),technical debt,rampant genericness
  • Emergent design enablers - TDD, Refactoring to remove technical debt, harvesting/cultivating idiomatic patterns
  • Use testing as a design tool, design will emerge from tests, will have better abstractions and less complexity
  • Reduce your Technical Debt by writing simpler code

I attended part of the Hudson Workshop and caught some part of Pragmatic Architecture Workshop.

Ted mentioned in his talk about three categories of knowledge:

  1. Things you know
  2. Things you know you don't know
  3. Things you don't know what you don't know

The goal is to move maximum amount of things from Category #3 to #2 and then from #2 to #1.

Attended another talk on How to Approach Refactoring by Venkat and here are the key points captured:

  • "Refactoring: genuine desire to improve the quality of your code and design in it" and it keeps you agile
  • Write a little code, make it better, write a little code, make it better, ... - evolutionary or emergent design leading to agile
  • Hardest part in refactoring & unit testing: slow down and take small steps
  • Commenting the code during refactoring is like leaving a dead rat on the table, that's what SCM is for
  • We fear to fail, the more we fail in small steps the more we succeed in bigger steps - go refactor your code and make it agile
  • Simplicity, Clarity, Brevity, Humanity - best principles to design and refactor code
  • Integrate more often and its less time consuming; Integrate less often and its more time consuming
  • Principles
    • Check in before you start refactoring
    • Rely on automated tests
    • Reduce, not add, code when refactoring
    • Follow the KISS (Keep It Simple Stupid)
    • Keep it DRY
    • Make code self documented, let the test be the documentation
    • Write readable code
    • Check in frequently, take small steps
    • Keep code at one level of abstraction

The evening concluded with a nice party and a wonderful magic show by Michael Carducci. Enjoy a short video of Jay "trying" to perform a magic trick:

Here are some pictures captured from earlier today:

And then the evolving album:

Technorati: conf uberconf denver refactoring design software architecture

Friday May 23, 2008

YouTube, Amazon, Flickr, Google Architectures

Some interesting reads of highly scalable architectures ...
And another interesting piece of information (not sure about authenticity) ...

Twitter's downtime and Average response time

Enjoy the long weekend!

Technorati: architecture scalability website

profile image
Arun Gupta is a technology enthusiast, a passionate runner, author, and a community guy who works for Oracle Corp.

Java EE 7 Samples

Stay Connected


« July 2016