- We design and build extraordinary applications for companies looking to make the next great idea a reality.
- learn more
Porting Java Libraries - Jazzed About GWT
I've been building GWT interfaces for a while now, and it's been pretty cool. My attrophied Swing skills are slowly coming back and the kinds of stuff I've written has been leagues beyond my early Ajax stuff. So far so good.
Throughout it all, I've been trying to obey my own principle of avoiding leaky business logic and sensitive data. That means that most of the heavy lifting, business logic wise, happens on the server side.
This past weekend, however, I got a rare chance to do some programming for myself. One of my hobbies is chess, and I've written a few programs over the years to help me study and analyze the game. Right now I'm putting the plumbing together for a web/iphone application site. I've got all the stuff that handles FEN, move generation, PGN and UCI (interfacing to chess engines) on the server side, and the application side is mostly concerned with board displays.
It seemed kind of inefficient to make a round trip for every FEN or move generation operation, so I thought I'd write a simple bit of chess code in Java and compile it as a library using GWT. After all, this isn't proprietary or high security business logic that can't sit in the browser. Before I did that, though, I took another look at my favorite chess library, Chesspresso. It's a sort of swiss army knife chess utility library that was originally developed for a chess database application. Big, sophisticated, nice.
An hour later after stripping out all of the java.io.* specific code, I had a nice GWT library that did FEN, move generation and position state for me, all in a pretty svelt 50k of JavaScript code. I had an "aha" moment very similar to the one I had on seeing "write once, run anywhere" actually work with Java on Windows and Solaris back in 1998. Here I could port this non-trivial Java library to run in the browser in literaly a matter of minutes. I was jazzed about GWT all over again.
The idea isn't to write a high performance chess playing program. Even with all of the performance improvements in TraceMonkey, you're not going to be able to get that kind of speed out of current JavaScript engines. But to avoid having to make a round trip for every chess specific bit of logic, this is certainly a good way to go.
I'll have an iPhone version of my analysis app up by the end of October, depending on how many free weekends I get.
Comments: 2 so far
Leave a comment
About Pathfinder
Recent
- iPhone SDK: UIViewController Testing & TDD
- Icons are evil; so are menus - unless you do them right
- The Truth About Designing For Security
- GWT, Gadgets and OpenSocial, Part 2
- Has Many has_many: A Refactoring Story
- The Hidden Power of Canvas
- Review of fixture_replacement2 plugin
- Chess Game Viewer in GWT
- From JSP to Ruby on Rails: First thoughts on front-end coding conventions
- Helpers and Partials
Archives
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- March 2008
- February 2008
- January 2008
- December 2007
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- March 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
- August 2006
- July 2006
- June 2006
- May 2006
- April 2006
- March 2006


Hey! I just read this. Did you ever get it working?? I’d love to get in touch and talk about maybe working together!?
Email me => chessdev [+}gm4il.com
Erik
http://www.chess.com/members/view/erik
Comment by Play Chess, Friday, October 24, 2008 @ 4:00 pm
[...] I blogged a few weeks ago, I ported the Java chess library ChessPresso into GWT, which was a blast and an example of how you [...]
Pingback by Pathfinder Development » Chess Game Viewer in GWT, Tuesday, November 11, 2008 @ 6:14 pm