Bees Are Social By Nature

Transcribed thoughts and experiences about computer programming.

A First Glance at jSeamless

After a few days of attempting to connect to http://www.jseamless.org, I was finally able to download the binaries and see if it was as wonderful as I hoped it would be. Since I had recently went through a quick implementation, though hack might be more appropriate, of a simple single player Blackjack game using Echo2, I thought it would be great to take the same logic and apply it to my first glance at jSeamless. I had the game, I just needed the user interface.

Using the HelloJSeamless Sample Application and the Eclipse Web Tools Platform, I was able to quickly get my development environment and my first project set up. I set the project to run on Tomcat 5.5, hit run, and the HelloJSeamless Sample Application was up and running. I am not a big fan of “Hello World” type applications as they don’t really show me much, but it was great that one was provided.

The next step for me was to see how easy it was to “port” my simple, and needlessly server-side, Blackjack game from Echo2 to jSeamless. As I started digging in, I realized that I had forgot to download any documentation or the source and found I was fumbling around in the dark, with nothing more than the jar containing the class files and the HelloJSeamless sample applications. I tried to go back to the website to get more information, yet the jSeamless site was experiencing technical difficulties to my great frustration, at which time I reminded myself that this is a Beta release. Being as determined as I am, I decided to work through to get some sort of working version by hoping my experience with Swing, QT, MFC, and other GUI Frameworks and the class files would allow me to come up with something that worked.

I quickly found classes like Window, Grid, Label, Button, Table, TableRow, TableCell, and Style and started to feel a little more comfortable. With some minor experimentation I was able to get a simple Window with some Labels and some Buttons. I set up the buttons to take my implementation of the ActionListener and implemented the action(ActionEvent) method and was confused because I couldn’t figure out how to drill down and get specific information about the ActionEvent that occured when a given button was pressed. My first pass at the code looked like:


public class JSeamlessBlackjack extends Application implements ActionListener {
...
public void initPane() {
...
hit = new Button("Hit");
hit.setEnabled(false);
hit.addActionListener(this);
...
}
public void action(ActionEvent e) {
// if () doHit(); I want to do some conditional on ActionEvent
// Since I don't have docs lets see what an ActionEvent has in it.
System.out.println(e.getType());
... more output statements
}
}

The results of this first pass, were simply Click and CLICK, with nothing to differentiate it from any other button that my ActionListener may have been listening to. As such, I was forced to implement as follows:

hit.addActionListener(new ActionListener() {
public void action(ActionEvent e) {
doHit(); }
});

While this isn’t “bad”, it’s just not my preferred way of implementing ActionListeners. Please note that I had no documentation at this point, so I had no idea if I had other options. I stumbled around for about an hour “porting” my Blackjack application, hit run, and I got decent results, which can be found at http://www.kriggio.com/JSeamlessBlackjack.

The performance of my first application was not as good as I had hoped and the lack of documentation made this first experiment much more painful that I would have hoped. I just went back to the site, about an hour prior to this posting, and found that the site was operational again and I immediately downloaded the source and the javadocs. I have hopes that they will provide greater insight into using the framework, but my expectations are fairly low, as I keep forgetting this is a Beta version.

In the end, I wasn’t as “wowed” as I hoped I would have been, but I must say that Matthew Hicks has done some excellent work with this project. I realize I may voice some level of disappointment, but I had extremely high expectations. While those expectations were not met in his Beta 3 version, this is still GREAT stuff and I look forward to future versions, and maybe after reading the Javadocs and Source files I will appreciate what he has accomplished with jSeamless even more.

My extremely ugly hackage I call my JSeamlessBlackjack source can be found at http://www.kriggio.com/EchoBlackjack/JSeamlessBlackjack.zip.

Update: Unfortunately, reading the Javadocs and Source for jSeamless provided no greater insight that just reading the byte-code.

Advertisements

May 30, 2007 Posted by | java, Programming, technology, Web 2.0 | 3 Comments

Introducing Myself to Echo2

On May 22, 2007, I read an article, jSeamless – UI Abstraction for Java, by Matthew Hicks, on TheServerSide.com that mentioned jSeamless 1.0 Beta 3 was available for download.  I had not been following these types of technologies, but the concept sounded extremely interesting to me.  As a former thick client developer, I thought the concept of developing an application without dealing with the mess of fusing HTML, JavaScript, CSS, and whatever backend I was dealing with at the moment, was very enticing.  As mentioned by Matthew Hicks, to also be able “develop your UI once and then deploy it as a web application and/or a desktop application without writing any additional code” got me very interested. 

With such a great introduction, I couldn’t help but immmediately head over to http://www.jseamless.org.  Unfortunately, it appeared that others had also read the article and the site was not accessible, I recieved a connection timeout every time I tried to reach the site. I could not contain my excitement though.  I started reading what other people had to say about jSeamless and I noticed a framework called Echo2 was frequently referenced.  Since I couldn’t see what jSeamless was all about, I quickly headed over to http://www.nextapp.com/platform/echo2/echo/

 While Echo2 did not offer the ability to deploy my application as something other than a web application, Echo2 does claim to “[remove] the developer from having to think in terms of ‘page-based’ applications and enables him/her to develop applications using the conventional object-oriented and event-driven paradigm for user interface development.” I thought this is what I am looking for, but I had my doubts as to it ability to deliver on this claim.  After taking a look at the demos on the site and doing some additional web search for tutorials using Echo2, I decided to try it out for myself.

For my first application, I decided to implement a simple single player Blackjack game.  The results, found at http://www.kriggio.com/EchoBlackjack, were great.  Within a few hours, I was able to get a simple Blackjack game working.  For my first experience, I was greatly impressed.

I am definitely going to play around with Echo2 some more, yet I am now even more curious how frameworks like jSeamless compare.

I was able to quickly get started using Echo2 thanks to Deitrich Kappe’s Tutorial, Ajax with Echo2 and Eclipse, located at http://www.pathf.com/echo2/Echo2-Part1.pdf.

For reference, I placed a zipped version of my code at http://www.kriggio.com/EchoBlackjack/EchoBlackjack.zip

May 29, 2007 Posted by | java, Programming, technology, Web 2.0 | 2 Comments