Web Programming

XForms

Oliver Brown
— This upcoming video may not be available to view yet.

Although I haven’t been writing much about programming and computers lately, I have still been reading.

XForms is another thing, like Mono, that I found out about quite a while ago that has recently resurfaced as possibly useful. XForms is a whole rethink about how information should be collected and sent of the web. The keyword here is information. HTML forms don’t really send information, they send data. There is no real structure to what is sent - all you have is name/value pairs (although depending on the capabilities of the server you can at least send variable length arrays with the foo[] naming convention).

XForms improves on this by separating forms into different parts, primarily models and user interface (well technically what I’m referring to as models is split into abstract models and instances but that’s like talking about classes and objects). The models are just chunks of XML that are sent to the page. The user interface (essentially just input tags like the HTML equivalents) modifies this XML and then sends it back.

The structuring of the data may well be enough to warrant the adoption of XForms, but it’s a little better than that. When I say the XML (or more correctly the model) is modified by the user interface, the modifications are held in memory by the client (probably a browser) and any references to the model should change accordingly. This allows some stuff that would usually require clever AJAX, complete calls to the server or at least just plain JavaScript can be done fairly trivially.

There are a lot more possibilities, this really is just the tip of the iceberg. To find out more, search for XForms :P

There is a problem though, support in browsers. You can get a plugin for IE6 that handles XForms but requires the page include the plugin. You can get an extension for Firefox that handles it “natively”. Neither work that well and when I tried it neither worked properly with a page intended for the other (IE obviously couldn’t use a page without the plugin and the plugin stopped the XForms working for Firefox). But the same was true (if not worse) for JavaScript when it first came out.

Distinctive Developments

Oliver Brown
— This upcoming video may not be available to view yet.

I just thought I’d say a little about the company I now work for, mainly because they’re bigger than I thought. Well not bigger as such but more successful, a bigger player perhaps.

Distinctive Developments is a leading developer of games for mobile phones. I really should emphasise the leading part since one of their games, 3D Pool was actually nominated for a BAFTA (I didn’t even know they had a game section). They’ve also done titles with top licences including the FIFA series on mobile phones as well as Shrek 2: Puss In Boots and Madagascar. There are two problems with this personally though - firstly I myself don’t care for mobile phones games and secondly most of their games are sports based, which I’m also not especially bothered about…

Another interview

Oliver Brown
— This upcoming video may not be available to view yet.

Just as an update, the interview I had before had an odd outcome. It was a success but they didn’t have a position for me. In the meantime I got another interview with somewhere else.

Within three hours of the end of the interview I got an email offering me the job :D

It gets better: the following morning (less than 24 hours later) the original place call me and offer me that job too :D I took the second one.

Galactic Horde goes Gold

Oliver Brown
— This upcoming video may not be available to view yet.

Version 1.0 Gold of Galactic Horde went live today. Top new feature would be the Universal War. I think it’s top because I helped write it :)

Although I think Universal War is a bit of a strange name - makes it sound like a war that is compatible with everyone or something…

AJAXy Scriptaculous goodness

Oliver Brown
— This upcoming video may not be available to view yet.

Scriptaculous is a Javascript library used for doing AJAX stuff and certain visual effects.

It’s very well written, has excellent cross browser support and best of all there are cool functions in Ruby on Rails for using it. One of the coolest features is drag and drop. I’ve already implemented it in Galaxia Ruby for adding ships to fleets :)

Tree structures in Ruby on Rails

Oliver Brown
— This upcoming video may not be available to view yet.

This is becoming a trend - another built-in feature of Rails that will seriously help Galaxia development.

You can use acts_as_tree in a model to make it, well, act as a tree.

What this means is you add an extra field to the database called parent_id that tracks object’s parents. Rails automatically manages this for you and adds extra methods for dealing with trees (things for accessing parent, ancestors, children etc.). Just like the post on type, this is something I was already doing with Galaxia but managing myself.

Using “type” in Ruby on Rails

Oliver Brown
— This upcoming video may not be available to view yet.

By default Rails applies special meaning to certain fields in a database table. One of these fields is “type”.

The type fields is used by Rails to create a “single table inheritance model”. This sounds fairly complicated and is best explained with an example:

Imagine a forum system. A forum will have threads and replies. Threads and replies are different and have different functionality, but certainly share a lot of characteristics. So you might create a class message with two sub classes: replies and threads. In Rails you can store all these in one messages table with a type field set to either reply" or thread. When you load a message it will actually create either a reply or thread object (in stead of a message object). When you create a new object it stores it in the messages table with the correct type.

This is ideal for Galaxia. In fact it’s the model I used all along - I just had to write the functionality myself.

Galaxia Ruby

Oliver Brown
— This upcoming video may not be available to view yet.

Okay, Galaxia on Rails would my be a more apt name for a version of Galaxia in Ruby on Rails. But Galaxia Ruby sounds better to non-programmers.

This follows the tradition I’ve been recently following of learning new languages by writing bits of Galaxia in them. There is a real possibility I might get a version out this time :P

This version may even have AJAXy goodness and things. But don’t hold your breath…

Ruby on Rails may rock

Oliver Brown
— This upcoming video may not be available to view yet.

I’ve been vaguely aware of Ruby for a while but never really gave it more than a cursory glance. If you didn’t know Ruby is a language that has been around for a while that got far more interesting when Rails, a framework for it was released.

After reading around I don’t think I’m really a fan of Ruby syntax per se (I’m definitely a fan of the punctuation heavy C-style syntax as opposed to the keyword heavy Basic-style syntax) but Rails seems to be an amazing framework.

Since I might be starting a job soon (and if not soon at least eventually) that will focus on PHP, starting to learn something new might not be ideal. But if it really as good as it’s fans say then things might be fine.

I suggest anyone involved in web development who hasn’t checked it out yet do so. There is a good introductory article on ONLamp.com.

Books galore

Oliver Brown
— This upcoming video may not be available to view yet.

The advantage of having an imminent interview (and ultimately of having a job) is I can buy computer books without worrying so much about not having much money. They’re an investment you see…