Jun 21

Back from vacation in the Virgin Islands

Personal 1 Comment »

I finally did it. I took a holiday for the first time in many years where I didn’t take my laptop. It certainly felt strange to be away from the world for so long, but it had to be done. One of the aims of the holiday was to:

Vacation away from the obligations of communication

Spending days on the white sandy beaches, with turqoise water in which you can see straight to the ocean floor as it is crystal clear. There was fun with dinghies, beach balls, ice cold smoothies, but all in all we tried to do as little as possible.

Perfect.

Now, I let me computer grab email all night and I have 6000 just in my spam folder :/ If I haven’t replied to you…. it may have snuck in there!

Jun 12

JavaScript Embedded in Java 6

Java, JavaScript, Tech 26 Comments »

JavaScript Embedded in Java 6A brief view into the history via this Sun Java 6 announcement, shows us that in the next Java 6 build, we will have Mozilla Rhino baked in.

Another language-related JSR planned for Mustang is JSR 223. This defines a framework to allow scripting language programs to access information developed in the Java platform. We currently plan to integrate this into Mustang for b40. Aside from the framework, we will also include a JavaScript engine based on the Mozilla Rhino implementation. Later, we hope to include a scripting shell that is script language independent. This will be a very cool way to create a prototype, do some exploratory coding, and learn new APIs.

First, we had a client (browser), that had both a Java VM and a JavaScript interpretter. Now, we have the same on the server-side of things.

This is pretty huge, and will spark more development in scripting languages, and JavaScript itself. Now there is no barrier to install anything, and you will had JS out of the box.

ECMAScript 4 XML is in Rhino. This means that we can leave the DOM (and friends) behind, and can use E4X right away!

Jun 10

APrefixing NCommon IInterfaces

Java, Tech 12 Comments »

Cedric discussed the recent Artima interview of Erich Gamma.

Cedric and Erich make good points, and are worthwhile reads for sure.

I know Ced is more Hungarian than French though, and I don’t get it :)

More posts like this and Howard will be happy that he used IEverything in Tapestry ;)

It isn’t a huge deal, but I really am not a fan of prefixing items with anything. I don’t like it as it gets out of the way for me. We rarely do this in English.

I want to use a Person, not an IPerson. Who cares if it happens to be an interface or a concrete class, or an abstract class? I actually don’t mind if that is encapsulated from me. I really often don’t care.

If I do care, then I let me IDE tell me what I am dealing with. Maybe someone should write an Eclipse plugin to put “I” at the beginning of all interfaces for the Hungarian crowd? And, strip them off for the others?

Keeps coming back to allowing a VIEW on my source code :)

Jun 09

Midas Touch Travel

Travel 2 Comments »

I am notorious for having bad travel experiences. I had a fun day of travel from Columbus, back home last weekend that gets added to the list.

It didn’t start out well when the AC stopped working in the cab that I was taking to the airport. Since it was in the high 80s, it didn’t take long to get uncomfortable, but I grinned and bared it. Unfortunately, I wasn’t the only thing to get overheated, as while on the freeway, I started to see smoke coming out of the engine. We had to pull over, as the car was broken down. I stood there, feeling like I was at the Indy 500 as cars whizzed by on both sides. I had to call the wife just to laugh about it. A mere 30 minutes later, and another cab found us… and I was on my way to the airport.

I didn’t miss my flight or anything. In fact, I could have been stuck on the freeway for another few hours and been fine. The reason is that my flight was constantly delayed. Was it due to weather? no. Waiting for a plane? no. Mechanical issue with the plane? no.

The problem was that a jetway was broken, and “the guy who can fix it can’t be reached on his cell phone”. Great. The Guy.

There were several open jetways next to us, but NWA couldn’t use those for some bizarre reason. I felt bad for the plane that was sitting on the runway and couldn’t deboard.

I started to feel more and more sorry for myself, as I realised how myself, and those around me, were all sweating. You got it. The AC was broken in this wing of the airport. People couldn’t move to where it was OK, as we were constantly on and off wrt the jetway.

My saviour was getting a Dove ice cream bar to keep me cool. This helped a little, until we finally got on the plane.

I sat next to an east coast couple, where the wife was trying to keep her husband positive about making their connection. We quickly learned that they would be screwed, as we sat on the runway itself for an hour. This time it was due to the airport that I was connecting through had lost power.

When I finally landed, I got lucky again in that my connecting flight was delayed also. I felt very lucky when I jumped on the last flight running that night, at 12:30am, and shot the hell home.

Jun 08

Dual Disc: From Music CD to DVD Movies

TV / Movie 119 Comments »

Random note: Have you noticed all of the new music CDs that come as Dual Discs? CD format on one side, DVD on the other? Pretty cool.

I wonder how long it will take to be able to buy Garden State the movie, and get the soundtrack on one of the sides?

Jun 08

Macromedia Flash Tool “Zorn” to Run on Eclipse

Web Frameworks 8 Comments »

Macromedia has joined the Eclipse Foundation. Who hasn’t joined it yet? Microsoft?

Wow.

I think this is a big step in moving Flash from “that way you put movies up on the web” to a full application development suite.

Developers have never liked the whole timeline. It is a scary beast from a different world. Now, we may move on….

But the big question: Will there be a command line SWF compiler? ;)

Jun 07

Model talking to Service Layer: Good practice or bad?

Java, Tech 22 Comments »

In general I am a fan of OO practices, and giving as much behaviour as possible to my object model. Of course, this is within reason, and I only want my model to have the logic that makes sense for the given objects.

However, I often find that a lot changes when I see model’s that are used on the web tier.

I often run across this pattern:

  • Action talks to Service layer which returns dumb model objects
  • Model objects are placed in the request
  • View generates page, using the model

Since the model contains simple properties, with the odd piece of simple logic, and relationships, if a page (view) needs to get more information, it either:

  • Runs another action, which in turn talks to the service layer again to get the new info
  • The original action has multiple calls to the service layer

I actually prefer a different way of doing things. I want the dumb model smarter. I want to do real object design, and have rich behaviour in the model. In fact, I sometimes take it so far that my userSession object can traverse to most pieces of data as needed, but that is another matter.

What does this all mean? Imagine that I have a core model object that I return, and I want the object to have a method: Collection getAssociatedActivities().

What does this method do? Well, it could simply be walking our in-memory data, doing a lot of munging and calculations to work out the association based on rules.

However, this may not be enough. Maybe a complicated query needs to be done to work this out. Rather than using a Comparator and sorting through the model, and doing a bunch of aggregations, I want to let the database do what a database is good at.

This means that the implementation of this method changes from:

public Collection getAssociatedActivities() {
// sort through data model, using a lot of Comparators, making sure the data is all loaded, etc etc.

// 50 lines later...
return theAssociatedActivities;
}

to something like:

public Collection getAssociatedActivities() {
SomeService service = getSomeService(); // injected, via a BeanLookup, or what have you

return service.calculateAssociatedActivities(); // in here the services tier talks to the data tier to do a lot of the work
}

Implementation Encapsulation for Performance

What I like about tweaking the implementation of this method, is the fact that it is all encapsulated. At first I can put it in code directly. If it needs to go back to the service tier based on:

  • Performance: Turns out the DB can do this a lot faster
  • Cleanliness: Nicer to be shared at that tier

it can simply be done.

Choosing in the web tier

Compare this to an approach I see all the time, in which the web tier decides what value objects it wants back. In this case, when the interface needs to change to hit the services tier, either:

  • The main Action hits the services tier again to grab the associated activies object and plugs it in the request
  • The view does a pull which hits another Action, responsible to hitting the services tier and getting the associated objects

Any which way, you end up changing a lot, just for this issue. The web tier is totally changed for performance reasons. The rich object model is compromised, taking functionality out, for performance reasons.

Conclusion

I like rich models, and I like hidding as much as possible underneath. This allows me to change the engine under the hood without bugging the folks on the web tier. Thoughts?

Note: Cameron had some interesting things to say about Protecting the Domain Model

Jun 06

Why do I care about pluggable persistence?

Java, Tech No Comments »

Why do I care?

I have had certain people (;) question why it matters if the persistence engine is pluggable. Some vendors claim that noone has asked them for this. If you don’t like a vendors CMP engine, then use a different vendors app server. Or, just download Hibernate/Kodo and use that.

The issues that I have are:

  • Stuck with a vendor syndrome:
    I live in an area where there was once a very good golfer, who was a sales guy for IBM. That is how I explain how the entire city is blue. The state government, the university, the insurance companies. Everyone. Ask me to develop a Struts app on WebSphere? erg :/ At some of these large companies, I have seen the following issue come up time and time again. The CIO is bought in to IBM. The development team is not. Many of the projects will just run simple servlet/jsp web tiers and not use any of the WebSphere engine itself (an expensive Tomcat). Others fight political battles to try to get Spring/Hibernate solutions in to solve their problems. Management argues that “this isn’t standard!”. So now the developers are stuck between a rock and a hard place. They know they have to use WebSphere, and believe it or not, some of the large applications really benefit from pieces of that stack. However, they don’t want to use the WebSphere CMP engine. Picture the new world of a pluggable engine. Now the dev team can switch in Hibernate, yet still code to EJB 3, and can claim to management that they ARE following the standard. Everyone is happy.
  • Come on, holy lock-in batman: I am sorry app server vendors. I know that the CMP engine has been a good lock-in in the past. But you have all moved on from this up the stack anyway, so I am sure you don’t care that much anymore.
  • Why not?: Why should the ONE cross-cutting concern of persistence NOT be a pluggable API? It makes no technological sense to me. Give us the option

Do I think that everyone is going to run out and start shopping around? Maybe not. I am quite sure that a LOT of project teams and companies will be happy to install their app server, and start writing code. They don’t want to plugin something else.

However, I think there will be a lot of companies switching out. On some projects it could totally make sense to run WebLogic Application Server, with Hibernate’s persistence engine. If you are twisted you could use JBoss’ application server with IBM’s CMP engine :)

Surely choice and competition is a good thing. It will open up a LOT of companies outside of the appserver vendor space to compete, and we are going to see better and better tools to help us manage persistence.

Hopefully a year from now we will see this. We will see projects using a bit of this, and a bit of that. Who knows :)

Jun 06

Pluggable Persistence in J2EE 5

Java 66 Comments »

I was happy to read Bill Burke mention the additions to the EJB 3 spec:

What particularly excites me is that persistence is will now pluggable into J2EE 5. What I mean by this is that third-party vendors that focus soley on persistence will have a standard mechanism to deploy their products into J2EE 5 compliant application servers. JMS has had this for years and I hope what happened to JMS happens to persistence: that a healthy subcomponent market materializes. This can only serve to strengthen J2EE as a whole and bring more choice to users. As usual, I’ll tout a little JBoss arrogance and say that Hibernate will still continue dominate Java ORM, but strong competition keeps everybody honest and on their toes. Anyways…

A lot of us have been asking for this for years, and it will be a good day when it happens. Imagine BEA WebLogic running Hibernate as your EJB CMP engine :)

Jun 02

Sun buys StorageTek for $4.1 billion

Tech 364 Comments »

I was also a little surprised at the news that: Sun sheds $4.1bn for StorageTek.

The first thing that came to my mind was visualizing the proximity of the Sun Microsystems office in Broomfield, Colorado, and how StorageTek is just over the road.

There is also a golf course right next to both…. maybe the deal started there?

It is interesting to see Sun doing something with the estimated $7 billion that they had in liquid form. Putting it into StorageTek? Ok.