October 27, 2009

Mark talks JavaFX



I was recently interviewed by Maijaliisa Burkert of Sun Microsystem's JavaFX Marketing team. Read (and hear) the full story here. If your hands aren't itching to try JavaFX now, I don't know what else will convince you ;-).

You can also hear me say "ehm" every 3 words of nearly every sentence (I wasn't aware of that while I was talking...) in the recording of the interview:

October 16, 2009

A mayan calculator

The JFXStudio blog launched its second coding challenge. This month's challenge is to write an interesting application in no more than 30 lines of code in the theme: "five".

At first, I didn't think I was going to enter because I thought I wouldn't have the time for it, but I found some time and started doing a little research into the subject "five". So I looked "five" up in Wikipedia. There, I learned about the quinary numeral system (base-5) and that many languages use it. And apparently, the Mayas used a quinary system as well. That's when I decided I would make a Mayan calculator and with that enter this month's challenge.

I am finished, have e-mailed my 30-line app to Joshua, and yet again, amazed at how powerful JavaFX is. I was able to write a pretty good looking and functional application in just 30 lines of code. Click on the screenshot below to start the application (the source for the picture of the Mayan Ruin is http://www.themayantraveler.com).

October 08, 2009

I won the JFXStudio challenge of september 2009!

Last Sunday, Joshua Marinacci announced the winner of September's JFXStudio JavaFX coding challenge. Now, guess who won. Yes, me!

The challenge was to write an interesting application in just 30 lines of code (or 3000 characters), in the theme "time". Most submissions were clocks of some sort, and so was mine. I don't know what made me came up with the idea for a pacman clock, but I did, and it made me win the challenge too!

I have tried to stuff as much interesting behavior in my clock as I could while staying within those 30 lines of code.

Here are some of the tricks to pull that off:

  • Against all sound coding principles, I used lots of cryptic, one letter variables and functions with really short names (like "lz" for "leading zeros", and now I am reading back my code, I could have made it even more compact if I had defined a function "r" for invoking Math.random),
  • so, it is a good thing I also used this important object orientation principle to keep things compact and be able to create autonomously haunting ghosts: encapsulation
  • I used a constant named "forever" in stead of Timeline.INDEFINITE for all the TimeLine instances used in the application,
  • I used SVGPaths, which are a bit cryptic, but very compact,
  • I avoided typing spaces and carriage returns as much as I could,
  • and I tried not to care too much about code readability (which, for a Java developer like me, is a very hard thing to do).
So, as you can see, I squeezed JavaFX as much as I could, and out comes a fun to watch little clock. My kids love to watch it!

You can webstart the pacman clock here, and you can download the source code to see if you can make any sense of it (I know I won't be able to after a year or so) here.

This challenge was a lot of fun! Hopefully, I will find some spare time to enter next month's challenge. This time, we are challenged to write a 30 line (or 3000 char) app again but now in a different theme: "five". Let's see, what can I make of that...

five
alive
hive
jive
live
strive
drive
...