Online Development Tools

A couple of really neat tools caught my eye this week.

Try F# – F# is a functional language built on top of Microsoft’s CLR, drawing on languages like Haskell and O’Caml.  Every language should have a site like this, it’s a great way to explore the syntax and start getting your head wrapped around the design philosophy.

SQLFiddle – A brilliant little tool that allows you to create a SQL database schema and execute queries against it directly in your browser.  It supports Microsoft SQL Server, MySQL, Postgres and Oracle.  It even gives you a nice query planner output to help you understand the cost of your query.  If you choose Postgres, it provides you with a direct link to http://explain.depesz.com, a neat tool for visualising the output of the Postgres EXPLAIN command.

Postges provides some very powerful mechanisms for profiling and optimizing your queries, but they can be a little arcane to get started with.  These tools could really help speed up your workflow.

SQLFiddle is clearly inspired by JSFiddle, a tool I’ve used for the last year or so for trying out short snippets of javascript and sharing them with others.  It automatically gives you access to popular javascript libraries such as jQuery, and allows you to quickly prototype HTML, CSS, javascript and even Coffeescript with zero setup costs.


Gimp Paint Studio

How did I not know about Gimp Paint Studio before today?  This is a stunning collection of brushes, textures and most importantly, tool presets.

This takes GIMP from merely being an incredibly powerful image editor to being an incredibly powerful painting tool, as well.  I’ve played around with it for an hour, and I’m loving it already.


Lots of Intriguinging Scheme Parentheses.

The venerable image manipulation package GIMP still continues to surprise me.

Version 2.8 was released recently, and it can now run seamlessly on OSX, without the need for XServer.

One feature I hadn’t explored until yesterday is the built in scripting facilities.  Pretty much anything you can do in GIMP can be scripted and programmed.  This being open source software, there is of course more than one scripting language available.  Python is available via the Python-Fu menu, but the default scripting language is Scheme, a variant of LISP.

This is my first real adventure into the world of LISP dialects.  It fascinates me how so many language constructs can be made available using only one syntactic structure – the bracket.

LISP has sometimes been said to stand for ‘Lots of Irritating Silly Parentheses.’

But I find this fascinating.

We use brackets for function calls:

(myfunction arg1 arg2)

We use brackets to define functions

(define (AddXY inX inY) (+ inX inY) )

and we even use brackets to manage the scope of variables

(let* ( (a 1) (b 2) ) (AddXY a b))

Which evaluates to ‘3’.

In any other language I’ve used, such as C, or Python, or Javascript, those three different semantic constructs would use three different syntactic structures – curly brackets, keywords, indentation etc.

I can see why people find LISP and Scheme hard to fathom, but it has a certain elegance that appeals to me.

 


Ridiculously Easy Javascript Experimentation

My current favourite online tool is jsfiddle. This is an incredibly well designed tool.

If you ever find yourself wanting to quickly try out some HTML, CSS or javascript, without any edit-save-publish-reload cycle, then jsfiddle is the tool for you.  It keeps surprising me how well put together it is.  Sharing snippets of work with friends and colleagues just requires cutting and pasting a simple URL.  Forking is literally a one-click process.  Versioning is built in so seamlessly you hardly notice it.  And although you can set up an account to manage your code snippets, you don’t need to login to start using it.

This is a lesson to me on user-centric design.  The barrier to entry is absurdly low, and there are a bunch of powerful features that are easily discoverable when you want to go beyond the basics.  You have the option of pre-loading any number of popular javascript libraries such as jQuery and Prototype, and even Coffeescript is supported.

So, go give it a try.  jsfiddle could quite easily be integrated into your development processes in the next ten minutes.


Wither Bitcoin?

http://www.flickr.com/photos/tradertim/

Bitcoin is possibly the most interesting and game-changing technology to have been created in the last 10 years.  I think that there is a real possibility that it will succeed where other alternative currencies have failed.

What’s interesting me at the moment is what the path of adoption will be.  Until recently I assumed that the early adopters would all be geeks: people wanting to buy and sell virtual goods, World of Warcraft weaponry, or technical services such as programming and graphical design.

Now that I’m more familiar with the various bitcoin exchanges I wonder whether the currency is more likely to find early use as a Forex tool.  It’s very easy to transfer money from a source currency to bitcoin to a target currency, and transferring bitcoins around the world doesn’t require middlemen, fees, or regulation.

We’re obviously a long way from being able to buy a coffee at Tim Hortons with a cryptocurrency, but I think that eventually a healthy market may well emerge, with a large number of goods and services being traded for bitcoin.  I shall be following developments with interest.


Coffeescript

New technology of the week, and hot contender for the title of ‘my current favourite language’, is coffeescript.

I’ve thought for a long time that javascript is a horrible language with a wonderful language inside trying to get out.   Coffeescript may well be that language.  While at it’s heart it is still fundamentally javascript, and can be used anywhere javascript can (so far I’ve used it in node.js and in the browser), it steers you around the worst mistakes of the underlying language.  Variable scoping and binding is handled better, function declarations are clearer, iterations and comprehensions are integrated neatly into the language, and your code can be more succinct.

This week I re-wrote our mobile web platform, replacing our existing jquery-ui based rendering with coffeescript and backbone.  There was definitely a learning curve involved, but the effort was worthwhile; and now we have a code base that is considerably more manageable than the previous version.

Examples

l=[1,2,3]
square = (x) -> x*x
squares = (square(x) for x in l)

Or even

squares = (x*x for x in [1,2,3])

And from our actual code: we store data as json-encoded strings in the browser’s local storage.  This function takes a predicate (i.e. any function that returns a boolean) and uses it to find the keys of all elements in local storage that match.

view : (predicate) ->
    (key for own key,value of localStorage when predicate (JSON.parse(value))

Which could then be used to get all objects that have a field ‘type’ set to ‘response’ as follows:

dockeys = view (doc) -> doc.type=='response'

Neat, huh?   Head over to http://jashkenas.github.com/coffee-script/ and try it out yourself!