12 Sept 2014

CFScript v2 – go vote for it!

CFScript is an inconsistent mess. Some statements take the form of functions while tags like cfloop are still named as cfloop in cfscript rather than just loop. Take a look at this:

cfloop(from=1, to=10, index=1){
     //stuff
}

Huh? Why shouldn’t a more JavaScript-like syntax be used rather than trying to replicate the tag’s BASIC-like syntax as literally as possible. It’s like trying to fit a square shape through a triangular hole. Sure, if you bang it enough it might go through, but it’s messy and you know it’s wrong.

No new developer should have to learn this conflicting, inconsistent, scripting language. It should be trashed but retain 100% backward compatibility.

How? Adam Cameron raised some inconsistencies of cfscript in his blog and without much thinking I suggested something simple to allow a new, clean scripting language to be used without having to throw away legacy code:

<cfscript version=2>
      // new code goes here
</cfscript>

When the CFML engine sees that version 2 is stated a new interpreter kicks in to compile it to Java. Obviously if version 1 is stated, or nothing at all, the legacy interpreter is used.

This feature suggestion has been added to Adobe’s bugbase. Please go and vote for it!

Adam picked up on my moment of clarity and blogged again with some great feedback from the CFML community.

V2 implemented this way will guarantee backward compatibility and wipe the slate clean to attract newcomers to CF and utilise it based on what they know from a more elegant, universal syntax such as JavaScript. Tagged based scripting and CFScript v1 are both a non-starter for newcomers who want to start a programming career. It's time Adobe think of the future, stop adding poorly implemented features that no one wants to use (cfclient?) and go back to the drawing board and get the language right without having to throw the baby out with the bath water.

Go vote now. You’ll need an Adobe ID to log in before you can vote.

5 Jul 2014

Twitter the Twit – When short URLs are longer

Twitter is being a bit of a twit. I was tweeting a link to a very short domain and Twitter thought it would be a good idea to use its automatic URL shortener which in fact produced a longer URL! How dumb is that?

I typed in http://owl.uk which is 13 characters and Twitter replaced it with http://t.co/jLQcgAzbqX which is 22 characters. That’s 9 characters longer. What a waste when you’re only give 140 chars in a message.

The problem occurs in Twitter’s web client and also TweetDeck and I imagine most tweeting apps that don’t do a simple sanity check asking itself “is the URL the user types in shorter than the URL I can replace it with?”

I tried to contact Twitter to point this out to them but there’s no obvious contact information on their website. I was going a little crazy searching.