Friday, December 28, 2007

Holiday Travel

  • Changing four airline tickets on Delta: $75/ticket = $300
  • Adding new rental reservation for 5 days = $250
  • Being able to let kids recover from pneumonia before traveling = priceless
Interesting side note... I couldn't just extend my current rental car (a minivan, Chevy Uplander) because we had made the reservation through Priceline. This completely stymied both Budget's national and local offices. So I we just made another reservation through Priceline for the same kind of vehicle, picking up on the day we were to drop off the current rental. One would think that they will simply let us keep the current vehicle, but who knows. Their inefficiency has cost them. We bid a lower rate on the new reservation, since it won't be during peak holiday season, but would have been happy to pay the old rate if we could have just extended the current reservation. That comes out to about $15/day = $75, plus whatever take Priceline is getting.

Wednesday, December 26, 2007

Favorite Music of 2007

Year Zero by Nine Inch Nails -- Favorite artist releases very good concept album. I can't ask for anything more.

Carnavas by Silversun Pickups -- This came out last year, and I put on my list last year as well. I listened to it even more this year though.

The Boxer by The National -- This is probably my favorite music to listen to while programming or writing. The only problem is that the songs can be so engrossing that it can be distracting.

Neon Bible by Arcade Fire -- If somebody told me "there's been no good music in 2007" my retort would begin with Neon Bible.

Because of the Times by Kings of Leon -- The consensus criticism of this album is that it was too fractured and all over the place. Maybe that's true, but the songs are excellent. Put this whole album on your iPod and hit shuffle. Every time one of the tracks comes up, it's an instant joy.

In Rainbows by Radiohead -- This is a great album -- also a good retort to any "2007 sucked" claims. I have a feeling that it will remain in heavy rotation for me next year.

Ga Ga Ga Ga Ga Ga by Spoon -- This is another enjoyable album by Spoon. This is one of those albums where each time I listen to it I ask myself "why don't I listen to this more often?"

Robbers & Cowards by Cold War Kids -- I think this also was a 2006 album, but I didn't hear it until this year. A very good album overall, but I especially love "Hang Me Out to Dry."

Icky Thump by The White Stripes -- This was a disappointing album to some people. To me it is a great listen, even though it is probably not as memorable as previous albums by The White Stripes.

Graduation by Kanye West -- I go through love/hate cycles with this album. I tend to listen to it way too much, get sick of it, then two weeks later start all over. This definitely has some weaknesses, but there are too many good tracks to ignore it.

Saturday, December 15, 2007

Les Miles

I find it funny that Michigan has wanted Les Miles so badly. I am terribly unimpressed with Les Miles. He has had a great team the last two years, but that's because of the tremendous talent that Nick Saban left for him three years ago. Saban is well known as one of the best recruiters in college football. Les Miles got a great team. Look at all of the great players on his team, and all of the best ones were Saban recruits. His coaching has been quite questionable this year. Personally I thought he got incredibly lucky in many games this year. He made many questionable calls. Worse, when questioned about some of these calls after the game, he often left the impression that he was not completely aware of the situation when he made the call. Some people mistook this for "gutsy" calls, but they were actually just ignorant calls. He was dumb, but got lucky. His team could have easily lost two more games because of his mistakes. They still wound up losing two games when they clearly have the best team in the country. I was amazed that he prepared a double spy defense to play against Darren McFadden, and they still gave up 200 yards on the ground to him. Yes McFadden is a great player, but if you prepare a "trick" defense for a guy and it fails, then some of that failure has to attribute to the "trick" defense. Anyways, Les Miles does not seem like a great coach despite his team's success. His team is successful despite his poor coaching. And yet, Michigan can't stop salivating over him...

Mitchell Report

I don't care about athletes using drugs. Most people would agree that I have a minority opinion on this. But who cares about my opinion? Most people think that athletes using drugs is a form of cheating. It is bad. Period. If I was one of those people, I would be very happy about the Mitchell Report.

A lot of people have pointed out that the evidence in the Mitchell Report would not hold up in court. They point to Roger Clemens in particular. It's as if the Mitchell Report was supposed to produce evidence to be presented to a grand jury or something. If that would have been the purpose, then it would not have been worth releasing.

I think the point was to justify stricter measures to prevent the use of drugs in baseball. Obviously you can only prevent future use, you cannot change the past. If that is the purpose, then I think it does a very good job. It shows that by only getting two people to cooperate, they were able to find evidence against dozens of players. There is no way the public could not come away feeling that drug use is widespread in baseball. It's not just the guys hitting 40+ home runs. It's the starting pitchers, the relief pitchers. It's the low-power, fast running infielders and outfielders, as well as the sluggers and wannabe sluggers. It's the utility bench players. It's the upcoming players and aging veterans. It's future hall-of-famers and guys struggling to get at-bats.

If the public thinks that everyone is using, then it will be hard for the player's union to stop the owners from instituting testing that is on-par with the NFL or maybe even the Olympics. Smart and/or cynical folks will say that players will still find ways to use drugs to get an advantage, but it does not matter. All that matters is that most fans feel like order has been restored. They feel like they are watching a "fair" and "clean" game. The Mitchell Report forces the players' union to accept this kind of testing, or baseball will lose fans, and players' salaries will fall. It's that simple.

Now if three years from now, Alex Rios leads the majors with 25 homers... Well that would be pretty interesting, wouldn't it? I don't think it will be the case. There will the usual fluctuations in hitting vs. pitching, but no amount of drug testing will have much affect on the general proclivity of home runs.

Wednesday, December 12, 2007

ActionScript Reflection Workarounds

ActionScript has some nice reflection features. However, if you are used to Java or C# (for example) then ActionScript can seem kind of sub-par. One of the easiest things to do in Java is to create a new instance of a class dynamically:

Class<MyAwesomeClass> clazz = MyAwesomeClass.class;
MyAwesomeClass instance = clazz.newInstance();

Clearly this assumes a default constructor, but you get the picture. The equivalent in AS is:

var x:MyGreatClass;
var clazz:Class = flash.utils.getDefinitionByName("MyGreatClass") as Class;
var instance:MyGreatClass = new clazz() as MyGreatClass;
A couple of things to notice here. First, you have to declare a variable of the given type. Otherwise the AVM2 virtual machine is not smart enough to load the class and will blow up on the second line (thanks Wikipedia!) Next the standard AS Function getDefinitionByName returns an Object, not a Class, so you have to cast it. The only nice part is that you get to use the new operator with the instance variable clazz. Ah, finally we get a job-of-dynamic-language moment. To improve on this, I add a boilerplate method to my classes:

public static get clazz():Class
{
return MyGreatClass;
}

This let's me do the following:

var clazz:Class = MyGreatClass.clazz;
var instance:MyGreatClass = new clazz() as MyGreatClass;

Not quite as nice Java still, but close! The first line causes MyGreatClass to get loaded by the VM while at the same time providing a handle on the Class in question in a very convenient manner.

Tuesday, December 11, 2007

This is the Team We Want to Move to the South Bay?



Clearly one of these guys must go.

Nolan won't go because it would "send the wrong message" to the team.

Smith won't go because it will kill them with the salary cap.

So they will both be back and the Niners will be very bad ... again.

Monday, December 10, 2007

Tebowisms

Yeah, I'm pretty happy that Tim Tebow won the Heisman. He certainly deserved it. It was kind of sweet that Colt Brennan finished a distant third place. So much for June Jones and his attempt to raise up his guy by degrading Tebow.

I was reading the newspaper in Tahoe on Saturday, anticipating the Heisman ceremony that evening. They mentioned "Tebowisms" which appear to be similar to Chuck Norris Facts. Mildly amusing.

Anyways, Tebow gets one more team to wallop on this year, and it's another Big 10 team: Michigan. If you can't beat Appalachain State... heh heh. Vegas has Florida as 10 point favorites. Only USC is a bigger favorite among New Years day (and after) bowls, at 13.5 points over in the Rose Bowl. The SEC is heavily favored this year in general. SEC teams are favored in six of the eight bowl games they are playing in.

Next year should be interesting for Florida. Tebow says he will not leave for the Pros no matter what happens next year. He's certainly not your prototypical NFL QB anyways, so this may well be the case. Percy Harvin on the other hand is definitely going to be a high NFL draft pick. He is a little short for the pros, but his speed is ridiculous and his hands are very good as well. If Ted Ginn, Jr. is a first round pick, Harvin definitely is as well. So next year becomes make-or-break for Florida.

Friday, December 07, 2007

The Heisman and System QBs

There has been a lot of talk about "system" QBs. People point out Andre Ware or Texas Tech as examples of how systems can lead to inflated numbers. Sure they can. But the real issue is level of competition, not systems. That's why Texas Tech puts up big offensive numbers. That's why Hawaii does, too. A low level of competition will always cast extra scrutiny on star players.

Nobody complained about Tommie Frazier winning the Heisman. Clearly he was in a "system" albeit one where he ran the ball much more than he threw. It didn't matter. Nebraska played and beat the best out there. It takes a great player to perform at such a high level against tough competition.

June Jones and others have also made a point about the NFL potential of players being a factor in Heisman voting. That is just ridiculous. If NFL talent was relevant at all, then Peyton Manning should have won three Heismans. There has never been a more sure-fire future Pro Bowl quarterback coming out of college, but he did not win the Heisman and for good reason.

There have been many Heisman winners to have no little or no NFL success, particularly quarterbacks: Ware, Frazier, Charlie Ward, Danny Wuerffel, Jason White just to name a few. There is nothing wrong with this. It's part of the beauty of college athletics that it's not just the most physically gifted individuals who have the most success.

So sorry June Jones. Maybe your boy will be good in the NFL, who knows? Nobody runs your "pro" offense there, so I don't know how much his experience in Hawaii will help. Whatever the case, Hawaii has not played against formidable competition at all. You can't claim to be the best without playing against at other good teams. That is why Hawaii's undefeated season will not get them a shot at a national title game, and that's why Colt Brennan could throw 100 TDs and not win the Heisman.

As a side note, there was one thing that made me really happy when I read about June Jones's disparaging comments about Tim Tebow. I learned that Hawaii opens its season next year at The Swamp. Talk about sweet justice! Hawaii is going to torn up by Georgia in a few weeks, so that will demonstrate how meaningless their perfect season is... But it will be even more demonstrated next August. And before anyone brings up Boise State from last  year, try to actually remember that game. They had every break in the world, and still had to gamble on a trick play to be able to win that game. If that game was played nine more times, how many times do you think Boise State would win? Let's be honest here, maybe once?

Rails 2.0 Released

If you are upgrading, I recommend upgrading Gems first (gem upgrade -system) and then using it to upgrade Rails (gem install rails --server http://gems.rubyonrails.org). There are some nice features. I especially like some of the Ajax security and JavaScript aggregating. The (expanded) JSON and XML support in ActiveRecord is also nice. 

Wednesday, December 05, 2007

Tuesday, December 04, 2007

Confused Microsoft


So which is it Microsoft? Is Popfly a download, or not?

Monday, December 03, 2007

Oodle: Fail

I like reading Uncov, it almost always makes me smile. Harshness is fine its own right, but it's always better when mixed with technical harshness. So in that spirit, let's take a look at Oodle 2.0.

First, a disclaim: Oodle and eBay are (or at least were) partners. Obviously everything here is my opinion, and has nothing to do with eBay. I'm not going to comment on their business, just a few things I saw in a browser...

Now I came across Oodle because they are hosting a Lunch 2.0 in a couple of weeks. I got the Facebook invite from Terry, and started poking around Oodle. They've supposedly re-done their entire site and made it very Web 2.0-ish, hence the launch of "Oodle 2.0."  So what's the secret to their new UI? Let's find out.

I opened up Firebug on a page and saw 7 HTTP requests for JavaScript files. That seemed excessive. I started opening up each JS file that was coming across. Here's the start of the first one:


/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/

Alright, so they are using YUI, at least they didn't re-invent the wheel here. I kept reading this file and one line 11 I see:


/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/

Fail. But wait, there's more.  Starting at the end of Line 18 we have:



/*Copyright (c) 2007, Yahoo! Inc. All rights reserved.
Code licensed under the BSD License:
http://developer.yahoo.net/yui/license.txt
version: 2.3.1
*/


I'm seriously not making this up. See for yourself: http://img.oodle.com/jaml/autocomplete/1196308267

Ok, so that file is pretty bad. What about the other six? Here is the contents of another JS file (see it live in all its glory at http://img.oodle.com/jaml/focus/1195340840) :

function focus()

{

var focusElement;

if (document.getElementById('home-what'))

{

focusElement = document.getElementById('home-what');

}

else if (document.getElementById('search-what'))

{

focusElement = document.getElementById('search-what');

}

else if (document.getElementById('email'))

{

focusElement = document.getElementById('email');

}

else if (document.getElementById('sender'))

{

focusElement = document.getElementById('sender');

}

focusElement.focus();

}

addDOMLoadEvent(focus);

That's right, an HTTP request for 20-freaking lines of JS. FAIL! There was also three CSS files loaded for a single page. The ten combined external files are all loaded in the first 20 or so lines of HTML. It's like these guys are trying to make their site slow...

I looked at their house listings. You can click a "see details" for each listing and it makes a slick XmlHTTPRequest call. How very Web 2.0. The response to this is XML. What year is it? Haven't you guys learned about JSON? You would think using YUI they would have figured this out.

Here is one the URLs to a search: http://sf.oodle.com/housing/rent/home/-/bathrooms_2/bedrooms_3/bedrooms_4+/-/95118/+5/.
That looks very Ruby on Rails-ish (or maybe Django.) I looked at their cookies, including their session cookie, but nothing cried out RoR there. Still RoR would fit well with their slowness strategy.

Sunday, December 02, 2007

Weekly Football Musings

The BCS
Will this year be enough of a reason to unseat the Big 10's resistance to a playoff? I don't think so. They have such a $weet deal with ABC and the Rose Bowl. But could you just imagine if today would have been tournament seeding day, a la basketball, instead of bowl schedule day? Let's say we could do an eight team tourney (three weeks like the basketball tourney.) We would have

Ohio State vs. Kansas : This would be #1 vs. #8. Would Ohio State even be favored in this? Yeah probably, but not by a lot. This would theoretically be the most lopsided game, and it would still be very competitive.

LSU vs. USC : How awesome would this game be? I could imagine a lot of people predicting that the winner here wins the next two weeks as well. Also, would this be the first college football game ever where ever defensive starter would go on to start in the NFL one day?

Virginia Tech vs. Missouri : This game would be very interesting if for no other reason than the contrast in styles. You gotta think that Missouri would come into this game feeling very disrespected.

Oklahoma vs. Georgia : Wow, another slugfest. Georgia's offense really clicked down the stretch... Bob Stoops knows all about SEC football, but this might be a case of too much physical difference. Georgia is bigger and faster than Oklahoma at every position... Ok maybe not, but you know people would be making arguments like that.

That's the kind of amazing games we would see out of an eight team playoff. And of course West Virginia and Hawaii would both be freaking out that they are not part of the eight teams. You can just hear Hawaii complaining about going undefeated but not going to the big dance...

The Heisman
Let the buildup start. I am ridiculously biased, I know. But how can Tim Tebow not win this? If somebody told you last summer that a QB would throw for almost 3000 yards and 30 TDs and also ran for over 800 yards and 20 more TDs ... you would say that guy would win the Heisman. Somehow Tebow only being a sophomore and Florida not being in the BCS championship have decreased Tebow's amazing season. That is just crazy. Florida lost three games, in a year where everybody lost at least two. Anybody who watched Florida knows they lost games because of their completely inexperienced defense. The offense was much better than last year's national championship team, and Tebow was the biggest reason for that.

Tebow must win the Heisman. Chances are that this will be his best season, statistically. I think Coach Meyer would prefer to have more playmakers (not just Percy Harvin) around Tebow at WR/RB. If that is the case next year, Florida will run the ball a lot more. It will translate into less pass attempts for Tebow and less rushes for him, too. I think his efficiency will stay very high, and he will probably still score a lot of rushing TDs, but gross numbers will probably drop quite a bit.

Friday, November 30, 2007

First AIR App: JSON Viewer

I was debugging a problem the other day, and needed to inspect some JSON that was being sent out by a web application. Now we all know that JSON is superior to XML, right? However, one nice thing about XML is that I can grab a blob, throw it into an editor, and have the editor pretty print it for me. This is especially helpful when debugging the XML in question. It makes it easier to spot a mistake in the structure, or to simply navigate to a given value in the hierarchy.

I did some looking around for something to parse and view JSON for me. I found JSON Viewer from CodePlex. It is really nice. However, it is Windows only. I do some development on Windows, but a lot on my MacBook as well. I wanted something that would work on either.

Instead of spending more time looking, I decided to code. A year ago I might have written something in Java, but I decided this was a good chance to write something in ActionScript and leveraging Adobe AIR to create a desktop application. The result is an AIR-based JSON Viewer. It looks really ugly, but I'm no designer. It uses Adobe's corelib to parse JSON and then just massages the resulting object into a structure that can be read by a Flex Tree control.

One fun use of it is to go to some of your favorite sites. Open up Firebug to watch traffic. Look for some JSON, plop it into the app and take a nice look at the data being sent over the wire to your browser (or from your browser in some cases.)  Of course some foolish sites still use XML over the wire, but most of the bigger and/or newer ones use JSON.

Thursday, November 29, 2007

Meebo Platform and ActionScript

It has been a month or so since Meebo announced their "platform." Platforms are all the rage these days, six months after Facebook made everyone envious with their F8 platform. One interesting thing I noticed about Meebo's platform was that they gave you your choice of programming in JavaScript or ActionScript. How nice. So I took a look at their ActionScript support.

Several things jump out quickly, but let's state the obvious ones. They provide a Flash component for Flash 8. Now it's cool that they provide a component (even if "installing a component is arcane), but Flash 8. Seriously? Clearly this is something written in ActionScript 2.0. Now it would be one thing if they wanted to provide some support for AS2 developers, but what about AS3? It just seems crazy for a brand new platform to not support the latest version of one of the two languages it supports. It would be like Silverlight only supporting C# 1.1.

There's also the issue of providing support for the Flash IDE exclusively as well. I guess with AS3 support only, this is all you can expect. The Flash IDE is not made for developers, it is made for designers. Flex Builder is obviously the choice for developers, though it has its drawbacks.

I didn't see if Meebo provides the source code for the SWC. If they did, it probably wouldn't be too hard to compile it for AS3. Actually you might be able to use the AS2 component within an AS3, I haven't tried that. Still, if you're going to launch a me-too platform, at least do it right.

Wednesday, November 28, 2007

Mo' Ram

I've been working some lately with DB2. The worst thing about DB2, at least for a Mac-totin' developer, is that DB2 is not (yet) available for OSX. So what to do? I already had Vista installed on my MacBook via Boot Camp. So I installed DB2 on there and ... developed under Windows. Ugh. Running DB2 and Eclipse at the same time often resulted in not only a slow computer, but Eclipse stack overflows and out of memory errors. Funny how I never had such problems on OSX.

Once that project was done, I decided to upgrade the memory on my MacBook. The max it handles is 2GB (I had the 1 GB that was stock) so I went with that. So where to get the 2GB? Well there is always Apple @$300. Ouch. A better choice is Newegg, of course. For a change though, I found an equally good deal at Fry's, just up the road from my office. 2x1GB sticks of Patriot RAM for $65.

Now it was time to install the RAM. I am always quick to tell people that I am a software guy, not a hardware guy. However, Apple makes it really easy to install RAM on the MacBook. It took me like ten, maybe fifteen minutes total to upgrade the RAM. It could not have gone smoother.

The extra memory has inspired me to give Parallels a try. So far the results are mixed. Every time it launches, I get a message form Parallels saying it is installing Parallels Tools. Then Windows crashes (blue screen.) It reboots and seems ok, but it's still aggravating that it does this every time...

Saturday, November 24, 2007

Black Friday

Yesterday my wife convinced me to go shopping with her and her sister. Normally I dismiss the idea of shopping on Black Friday, smugly stating that people should just buy everything online. Long lines, supply shortfalls (artificial or not,) and the like are all just signs of inefficient markets that will be replaced by the ruthless efficiency of e-commerce. Somehow Crystal talked me in to hitting the mall at 7 AM...

One amusing thing to me is the bait-n-switch items. These are the "limited" quantity items that are offered at a huge discount (do stores actually take a loss on these things?) in order to get lots of people in the store. The store then runs out quickly, so customers wind up buying other, more expensive items. This year's bait-n-switch special was definitely GPS units. Not only did every big-box store out there have sub $200 GPS units in limited quantities, but places that don't normally sell GPS had them as well. Get your GPS at Long's Drugs or Sportsmart, woo hoo!

Black Friday was actually a lot of fun. My niece has managed various American Eagle stores for the last ten years or so, thus I have a lot of empathy for the folks who work on Black Friday. They all seemed to be in a good mood yesterday, and I had a good time joking around with people.

Black Friday had a dark moment for me though. I managed to drop my Blackberry in a (thankfully clean) toilet. I fished it out quickly, and took the battery out of it. I waited a few hours, and it booted it up. The keyboard was crazy though. Sometimes it would not type at all, but other times keys would be entered without me touching anything. So I took the battery back out and left it out over night. This morning everything is working good as new! What a relief!

Yesterday ended on a very bright note. We are going to Florida for Christmas this year, so my wife decided to give me an early present: a Nintendo Wii. She didn't want to try and hide it from me in the luggage, and this way we got to play it with our family in Bakersfield. I am happy to say that I have a sore shoulder this morning from playing Wii Tennis late last night... She asked me if I wanted other games for it, but I really did not expect a Wii and had no idea what games are supposed to be good on it. I will probably get Madden for it, just because I used to love Madden on the PS2 and Gamecube. Guitar Hero looks like a lot of fun, too. I have basically taken the last 3.5 years off from playing video games, as I stopped having time for stuff like that when we started having babies. I'm not sure how much time I will have to play it now either, maybe once I finish my book :-)

Tuesday, November 13, 2007

The Network Application Pattern

    Several years ago I worked in consulting. My company was hired by larger companies to build web applications. We worked on internal web applications, external ones, and even some that were completely consumer focused, like the Washington Post Jobs site. Often we wrote applications that replaced existing desktop applications. Many of these were so called thick clients or client-server applications.
    The list of technologies was all over the place: PowerBuilder, Swing, and Visual Basic. The reasons for the conversions were pretty similar though: make things more easily accessible. It was much easier to say “you need InternetExplorer 5.5 or higher” to run an application, than it was to require somebody to download and install, and stay upgraded to the latest version of an application. The hardest part about these conversions was trying to reproduce all the functionality. You just could not do it, and there were always compromises that you had to work out with the clients on this.
    These days I am starting to think that such compromises are unacceptable. The days of the thin client are coming to an end. At the same time, the days of the thick client are not coming back. Instead a different pattern has emerged, and it is going to win. I call it the Network Application, though other folks have different names and different takes on it. Here is what it is.

Misuse of Big Iron

    To make things as accessible as possible generally meant to require as little as possible on the end user’s machine. The browser wars necessitated this as well. Inconsistencies across browsers required a least common denominator approach. The browser become a rendering device, and nothing else really.
    All the computation required to determine the interface shown to a user was performed on servers. For awhile these servers were Big Iron -- look at how well SUNW did in the late 90’s. Moore’s Law caught up and lots of cheap servers replaced Big Iron, but the usage pattern remained unchanged. Programming languages flourished around this. Look at all the UI frameworks in Java, the explosion of PHP, and the emergence of Ruby on Rails.

Another Shift

    I am not one of those melodramatics who look for a single event and say “this epoch caused everything to change.” Things started changing. Browsers stabilized and Moore’s Law kept moving along. Microsoft’s attempt at subverting web browsers by creating IE-only extensions, ultimately backfired on them. They created XMLHttpRequest, which ultimately allowed for exactly what the Netscape think tank had always hoped for and Microsoft always feared: web applications that were on-par with desktop applications. Well sort of...
    Web applications still have a lot to be desired. As I mentioned earlier, it can be really hard to reproduce a desktop experience in a browser. There are a lot of things going on to solve that, and some of them might even work. Orthogonal to the technologies at play is the pattern of how to program applications that are as feature rich as desktop applications, but can be run from a browser with no software to download or worry about updating.

The Pattern

    The key to the pattern is to stop using servers for creating user interfaces. If you like to think of UIs using the popular Model-View-Controller paradigm, the server should only be a place for Models. Your View and your Controller should be running on a client computer, not a server. Your server will probably serialize a Model to send to the client so it can use it in a view, but otherwise the boundaries should be very clear.
    Why does this help with the problem of creating desktop-like applications? Because when all the view logic is located on the client, there are no limitations to the interactivity. For an example, think about infinite scrolling like you see in Yahoo Mail (I usually rip on Yahoo, so I thought this would be a nice change of pace.) If the view of the list of your emails is formed on a Yahoo server, then to scroll past the bottom means recalculating that view on a Yahoo server, even if it is to show one more email that is just past the bottom of the list. If you had to do it that way, you would not allow scrolling. You would force pagination, like GMail does. However, if you already have the code for creating that view on the client, then all you need on the client is the data to display.

Servers Are for Services

    The beauty of this pattern is that your servers become specialized in serving up data, not HTML. There is still some overhead in de-serializing the request and serializing the response and making it all work over HTTP, but it’s a lot less than the alternatives. Of course it’s not a read-only world, so you’re not just sending out data. You are also receiving changes to the data, either directly, or (hopefully) via a service interface. Just because we’re getting clever with our presentation design, doesn’t mean our middle-tier design can be garbage.
    Notice I used the Service word. This is the same word used by those SOA guys, and it means the same thing. There’s no reason that the clients that you build for your service (in this case user interfaces) cannot leverage the same infrastructure that clients built by other folks use. Now you may want to expose more services to the user interfaces that you built, or maybe you don’t... The point is that if you decouple the so called business logic of your system, then it is easy to build Network Applications that provide rich user interfaces to the end users of your system.

Implementations of the Pattern

    Like most patterns, this was one has emerged from implementations. It is not something I dreamed up in my ivory tower in San Jose. One of my favorites is the Google Web Toolkit. GWT let’s you build things kind of like you would for the old-school thick clients using Swing, but it turns around, turns everything into code that runs on the client. One of my friends was starting to learn GWT recently and I think he was surprised when I told him that everything in GWT becomes static assets that can be served up by any web server directly. They are very cache-able assets as well... There are GWT ways to hook up your server calls as well, and of course this does require a Java application server. But that part of your code can be done in JavaScript, using GWT’s JavaScript Native Interface (JSNI.) The nice thing about using the GWT server code is that you get to use the same object model on client and server.
    GWT is tied to JavaScript, and thus it inherits the limitations of JavaScript. My other favorite implementation of the pattern is Adobe Flex. Flex Builder 3 even has code generators for creating Java or PHP data services for communicating to your Flex application. Flex applications run inside the Flash player, and don’t have nearly as many limitations as JavaScript applications. Flex applications are usually much bigger than JavaScript ones, but are also very cache-able. Bandwidth is becoming less of an issue in terms of user experience, though it is still a cost issue.

The Moral of the Story

    If you are a UI engineer, you should not be writing HTML. You should only be writing code that executes on the client. There are many other options out there. In the JavaScript world, there’s Dojo’s Dijit, the Yahoo UI Library, even script.aculo.us. Ruby on Rails’ RJS has some similarities to GWT, but is not there yet. The Rails guys are still perfecting the last generation of web applications, and have not moved on yet :-) Straddling the JS and non-JS worlds is OpenLaszlo. I would be more enthusiastic about Laszlo if it was using new Flash technologies. On the non-JS side, the two chief non-Flash entities are Microsoft’s Silverlight and JavaFX.
    Now again, these are all technologies that can be used with this pattern. They can also be used outside of the pattern, though I would say that is probably a mistake :-)

Friday, November 09, 2007

FUD by Doug Crockford

I like some of Yahoo's Doug Crockford's ideas on JavaScript. So I watched this talk by him on the State of Ajax. It has a great buildup on the history of computing and comparing pre-Ajax web apps to the IBM 3270. He's also a clearly opinionated guy, but he really lets this influence his statements. Examples...

He claims that Java applets failed primarily because of "write once, run anywhere" was a broken promise. That's ridiculous. First off Java applets only needed to succeed on Windows, so write once, run anywhere was irrelevant for a desktop technology. He does correctly state that Java UI (AWT) was no good. He commits a lie of omission, by failing to mention Microsoft's JVM infringements. He then says that Java succeeded on the server because (wait for it) write once, run anywhere is not an issue on the server. Not only is this wrong, it's the opposite of the truth. When I first started writing Java server apps in 2000, I was writing it on Windows and deploying it to Solaris.

Next he heaps praise on JScript and says that its "bugs" were just reproductions of Netscape's bugs. There is some truth in this, but it certainly shows his bias. He states that JScript inveted XMLHttpRequest and that there no innovations for five years after that until Jesse James Garret "discovered" Ajax.

He completely ignores Flash. Earlier he states that write once, run anywhere is really difficult and anybody that can pull it off deserves credit. Well Flash pulls it off. He claims that JavaScript pulls it off, but that's just plain wrong. I don't know how somebody who knows JavaScript so well can state this. He's smart enough to know all about doing browser sniffing and conditional logic based on the results of that sniff.

Thursday, November 08, 2007

Flock 1.0

In case you missed the news, Flock finally went 1.0 late last month. I've been playing around with Flock for over a year. They're integration with social services has gotten better and better. I did a clean install of it and setup my Flickr, YouTube, and Blogger accounts very easily. I've given up on using it for RSS, as having a server-based solution (Google Reader) is too valuable to me. They've also added Facebook and Twitter integration, two favorite services of mine. Both are well done. And of course it's based off Firefox 2.0 now, which is great. Most Firefox plugins work great with it. I'm using its blog writer right now, as I'm planning on using it as my primary for a week or so and then figure out if I should go back to Firefox or not.

Blogged with Flock