HomePage PNGNQ Weblog

Rails, Agility and Testing

February 13th, 2008

I`ve been putting a lot of effort into getting my Ruby and ROR chops up to scratch. Keeping in touch with the Brisbane Ruby and Rails Brigade is good, there`s some sharp minds in these giving good advice and ideas. Thanks guys.Ever since I made a simple client record application for Geeta`s massage business in record time with Rails, I`ve been hooked.

Compared to the hoops I had to jump through trying to do things with VB and C# .NET, I found Rails a breeze to make a robust database backed web app. I`ts been in daily use for over 6 months now and apart from a few minor additions such a searching, encrypted database backup and a couple of extra fields, it has run flawlessly.

The big advantage seems to be the speed at which development can happen even when the client`s requirements change. Seeing this, I went further and investigated Agile techniques reading a couple of the Pragmatic Books and a Peepcode webcast or two. Whilst Agile development is mainly focussed on teams of developers there are many techniques in it that can be applied in single developer projects. In my experience, the mindset of Agile development is close to that of many of us open source developers.

I`m trying test driven development techniques for my next project. It seems to be more work and a bit slower. I assume that in the long run this is going to make development quicker. I`ve already found that bugs are found by the tests and are easy to hit on the head before they get out of hand. I`m spending a lot of time thinking about what to test and how to test it, this make things slow but accurate. It also means I learn a lot about the framework and the code I`m writing.

From my martial arts background, I see Agile development as the Aikido of programming. One does not take a stance and have a definite preconception of what one is going to do in a given situation. One just reacts to the needs of the situation using learned techniques. Keeping moving and reassessing the moment is good. Standing still and trying to predict ahead is defeat.I will be interested to see how all this pans out.

Will Agile development really catch on or is it a passing fad?

OSDClang interpreter

January 5th, 2008

OSDCLang is a new programming language revealed at the 2007 Open Source Developer`s Conference in Brisbane.
It`s functionally identical to BrainF**k but has, IMHO, a much nicer syntax.

OSDCLang consists of 8 commands made of the three symbols: .!?

These symbols are used in pairs to create the 8 commands of the language:

.? Move the Memory Pointer to the next array cell.
?. Move the Memory Pointer to the previous array cell.
. . Increment the array cell pointed at by the Memory Pointer.
!! Decrement the array cell pointed at by the Memory Pointer.
.! Read a character from STDIN and put its ASCII value into the cell at the Memory Pointer
!. Print the character with ASCII value of the cell pointed at by the Memory Pointer
!? Move to the command following the matching ?! if the value in the cell pointed at by the Memory Pointer is zero.
?! Move to the command following the previous matching !? if the value in the pointed at by the Memory Pointer is non-zero.

OSDClang is extensible, since it only uses 8 of the 16 possible symbols that can be made with the basic symbols of the language.
In keeping with historical programming language tradition, I suggest that further extensions be called OSDClang++ and OSDClang#.
OSDClang++ needs a specification document which is at least 1000 pages and requires at leat ten years of comittee approval before being published as an unusable mess.
OSDClang# will have a secret proprietory specification, hidden by layers of patents, NDA`s and copyright restrictions. It will of course introduce a new symbol, #. The # symbol will break backward compatability with all previous versions of OSDClang. There will be undocumented features, but I can`t talk about them in a public forum…

So, to sum up, I wasted a bit of time in my holidays and wrote an interpreter for OSDClang. It`s written in C and runs pretty fast

I`ve also added osdclangtiny.c which is the smallest c interpreter I`ve been able to write yet. On a 64bit system the compiled code is under 9kB. Not that I`ve tried very hard to make it small.

For your edification and amusement I have also included a most useful program, one which every language must have: helloworld.osdc

Blame Jonathon Oxer, it was his talk that inspired this madness.