Why Java

August 23rd, 2010

At Cake Solutions, we have been using Java for quite a few years. Recently, I had to formulate why our customers should chose Java over other languages. It was easy to come up with geeky reasons, but purely technical reasons on their own are not enough. It turns out that modern Java EE applications are successful, interesting and exciting because of all the tools we have in the Java world–it boils down to the fact that I believe that a lot of the innovation we see in contemporary computing runs on the JVM and with JDK 1.7, we should see even more exciting developments.
In the meantime, download the Why Java PDF, where I try to explain why you should use JVM-based platform over anything else.

Practical Roo

August 19th, 2010

I have the pleasure of introducing another training course: Practical Roo! Huge discount to whoever guesses what the course is about. Actually no, there’s no discount, but I’d be happy to send my personal well done note.
Now, to the course itself. It is a two-day course, you will need some Java experience, it will help if you have done some Spring and AspectJ coding, but it is not strictly necessary. The modules we are covering are:

Introduction

  • What is Roo, what does it solve and why do we need it?
    • Roo is a code generator
    • The generated code follows contemporary Java/Spring style
    • It is easy to modify / add to the generated code
    • Roo can re-synchronise with the modified code
    • It is easy to remove Roo
  • What Roo isn’t?
    • Not a multi-module, general purpose tool
    • Not a one-way code generator

[10:00]

Hello, World

  • Show Hello, World Roo application (generate & run)
  • Go through the commands we issue (project, persistence, entity, controller)
  • Explore the generated source code (the directories, Maven dependencies)
  • Building Roo applications
  • The apps don’t build using javac? WTF?

[10:40]

Spring Framework Primer

  • What is Spring?
  • What does it solve?
  • Its main components

[12:30]

Food!

AOP Primer

  • Why do we need AOP when we have OOP?
  • Cross-cutting concerns
  • Pointcuts, Advices, JoinPoints and Aspects
  • Dynamic weaving (proxies, subclasses)
  • Static weaving (load and compile-time)

[14:30]

Architecting Hello, World

  • Roo is not just one-way generator
    • It is very difficult to separate out custom code from the generated one
    • Roo splits the generated code from the custom code
    • It uses IDT aspects to simulate .NET’s partial classes
    • Roo can re-examine our code and keep its model of the application up to date
  • Domain objects have persistence methods (just like RoR and Grails)
  • Domain objects are the core of the application
  • Controllers use the domain (and the persistence) to manipulate the data
  • Maven maintains the dependencies and configures the build process (ajc)

[16:00]

Extending Hello, World

  • Add a service
  • Add a handler method to the controller
  • Use & see DI

[17:00]

Sweet, sweet sleep

More AOP

  • AspectJ syntax
  • Mixins
  • Compile-time static weaving using the ajc compiler

[10:00]

Exploring different fields

  • See strings, integers, booleans, dates & friends
  • Declarative validation, custom validation rules

[11:30]

Associations

  • Have a Blog and Post relationship
  • Explore the details of different associations (many-to-one, many-to-many)

[13:00]

Food!

Exploring the web tier

  • Improve the standard data scaffolding
  • Structure of the generated pages, tiles
  • Explore the style sheets, JavaScript and AJAX
  • Roo and REST

[14:30]

Roo and the team

  • What if you have more people working on the same Roo application
  • How to share the Roo code, how to keep the generated code and the Roo sources synchronized
  • Automated builds and tests
  • [16:00]

    Q&A

  • Interesting goodies for exceptional attendees
  • Questions
  • Pet projects

[17:00]

Get booking!

Onwards

July 19th, 2010

Just a quick post to show the Zookeeper’s web interface. Yes, it is very simple and I will work hard to improve it (or, dear readers, if you fancy contributing, this is the area I’ll need most help in).
Now, to the screenshots:
localproject
report

Text-based report

July 18th, 2010

I have yet a lot of work to complete on the web UI, but I have a good idea about the text-based reports. So, here’s what Zookeeper spits out after receiving an error report from a running Tomcat.


* org/zookeeper/domain/DisconnectedExceptionLoader.java
08
09 public class DisconnectedExceptionLoader {
10 	private static final Pattern STACK_TRACE_ELEMENT_PATTERN =
10  		Pattern.compile("\tat (.*)(\\.(\\w+)\\((\\w+)\\.java:(\\d+))");
11
12 	public DisconnectedException load(Reader in) throws IOException {
13 		int x = in.hashCode();
13 Annotation{Error, ..., message='null'}
13 Annotation{Warning, ..., message='DLS: Dead store to x in
13   org.zookeeper.domain.DisconnectedExceptionLoader.load(Reader)'}
14
15 		DisconnectedException root = null;
16 		DisconnectedException ex = null;

It is still early days, Zookeeper does not yet automatically download the project’s dependencies and source code (coming later in implementations of LocalProjectBuilder), but it performs rudimentary exception and static code analysis and it also executes all rules from the very sparse knowledge base.
Keep watching this space for more updates!

A preview

July 12th, 2010

A picture is worth a thousand words; so I give you a preview of our application monitoring application showing what it found out about an application running in a Tomcat 6.0 instance.

error-report-1

We will give full preview with demos at one of the forthcoming Open Source User Group meets.

How do we do it? Simple: we combine the usual suspects of the JEE world. We grab the sources using Maven, we analyse the stack traces using Drools and we perform static code analysis using FindBugz. Finally, we produce suggestions for unit tests that show the defect using StringTemplate.
The result is that our monitoring tool can tell you what happened, where in the source code, generate code to reproduce it and, in most cases, suggest solutions to fix it. Here, the infamous NPE is not complex enough to fix in any innovative way, but consider a Hibernate lazy loading failure. We can suggest eager loading the object in the repository/HibernateTemplate or initializing the object in a @Transactional context.

Just wait until we wire in Spring Roo–then there is no reason why zookeeper cannot generate Roo scripts to fix the application automatically. But that’s coming in version 2.0, we still have loads to do for version 1.0.

Zookeeper will initially monitor Tomcats, but the architecture allows us to monitor any other application server. We do not at this stage aim to have full-blown monitoring tool.

Guess what?

June 17th, 2010

With the fantastic weather outside, I needed to take a break in my training. My legs felt very tired this morning and my heart rate just would not go above 155 bpm: all the signs to take a rest day. Now, rest day for the legs does not mean rest day for the brain! And so, I put some more pages to the Beginning MVC chapter. Download here.

Oh, and one more thing. I spoke to Gregory from Mulesoft today and we had an interesting chat about OSGi. I will add my thoughts about this soon, in the meantime read Ross’s post at http://rossmason.blogspot.com/2008/04/osgi-is-irrelevant.html.

More Open Spring 3 MVC goodies

June 15th, 2010

I have been very busy indeed, but managed to find some time to add more text to the Beginning Spring MVC chapter of Open Spring 3. Get downloadin’!

Open Spring 3 updated

April 28th, 2010

Good news everyone! I’ve added a few pages to the Beginning Spring MVC chapter of the Open Spring 3 book. Download here for your reading pleasure!

Open Source User Group

April 6th, 2010

Open Source Central User Group – Rick Evans “shark high-fiving a gorilla with explosion behind it”

It was another great turnout to the OpenSource-Central User Group which is founded by Cake Solutions, OpenCredo, and SkillsMatter, and sponsored by FDMGroup and Hays Plc.

Regular attendees and new faces joined us on Grafton Steet, Manchester, to see QFI Consultancy’s Rick Evans talk about integrating Spring and Adobe’s BlazeDS platform to create scalable Adobe Flex-based RIA using Spring/JAVA server side.

Rick Evans, a seasoned speaker as some of you may know, kept us all intrigued and engaged as he demonstrated how to use these two enterprise-level pieces of open source software to create an application that was the equivalent of a “gorilla high-fiving a shark with explosion in the background”.

If you were not lucky enough to be able to attend his “awesome” talk and see if he managed to do it, you can see the streaming version.

I look forward to the my second attendance of OSC UG in a few months time. Maybe I’ll see you there too!

Open Spring 3

April 3rd, 2010

Chapters for download are:
Beginning Spring MVC


I was thinking about the name of our new “unbook”. The “Pro” series are in the domain of Apress, the “In Action” books are published by Manning; I don’t know what O’Reilly call their books, but I wanted to make sure I don’t step on anyone’s toes.
In line with our advocacy of the open source, I decided to call the book Open Spring 3. I wanted to emphasise that it is a continuation of our Pro Spring series (in terms of scope and, I hope, quality and popularity), but that is is fundamentally different from the traditional printed books. And so, we give you Open Spring 3.
Open Spring 3 is just the first one in what we hope will become a series of other books, all covering various open source technologies and all available for free (both as in speech and beer) online.