Friday, 17 May 2013

cf.Objective() day 1 - brain dump

G'day:
OK, I'm fed up with staring at the ceiling fr the last 3h since I woke up around 4:30am (or "9:30am, you lazy bastard, get up" as my still-UK-homed brain was telling me), so I'll knock out a quick article on my thoughts on yesterday's Day 1 of cf.Objective().



Firstly Alex and I flew in from from London leaving at 5pm Weds London time, and it was just after midnight Thursday morning by the time we decided "actually yes, a beer at the hotel bar is a good idea", having just checked-in. So after what I worked out was 18h of travelling from home to hotel, we spend the next two hours necking beer, and talking nonsense to the night-owls who were also still propping up the bar. The hotel is brand new, and fully-appointed but a bit soulless in that corporate way. However that's to be expected with these things, and I do not mean that as an indictment at all. The beer was cold and the barman friendly. And the chat engaging. Last orders were at 2am, and I think we were out of there before 2:30am.

For reasons best known to someone other than me, my brain decided 6am was the best time to wake up, which I disagreed with, but we - Alex and I are economising by sharing a room - got underway with staggering downstairs to seek food and coffee. And for me: will to live. I was slightly hungover as well, and also still suffering the death throes of the man flu I've had since Mon. The coffee did the trick.

Note that I am going to discuss my thoughts on the presentations I attended in this article, but I'm not going to replicate any content. You can dig the presentations out from online somewhere. The people who gave the presentations can explain their topics better than I can, obviously.

I figured I should go to the orientation presentation as I'd not been to a big and American-styled conference before, and Jared - who I'd spoken to at great length online but not previously met - explained how stuff worked, and there were no surprises there.

I have to admit that my initial reaction to the subject of the keynote presentation - Dan Callahan from Mozilla talking about web development - was a bit neutral. I only went to it because I was already in the room. Well the addage that one should not judge a book from its cover stood up here: it was an excellent presentation. The gist is that one really needs to take Javascript very seriously, because along with HTTP & HTML, it's one of the ubiquitous cornerstones of the web. This sounds obvious, but it was valuable to have it articulated. It's certainly made me feel guilty about my mediocre JS capabilities, and I've decided I need to actively remedy this. So as well as CFML (and... err... PHP), I'll be looking at more JS stuff on this blog from now on I think. Dan also showed us so very bloody impressive things people are doing with Javascript: including 3-D rendering engines and video codecs. Written in Javascript. Production quality ones, too. Like the 3-D rendering engine was achieving I think he said 120fps for the stuff he was showing us. None of that is useful to me, but it did kinda put aside the vestigial doubts I had about how seriously one ought to take Javascript as a language.

So I'm an hour into this conference and I already feel like I'm a slack-arse in not knowing something. That's "good".

Next up is Sean's first presentation, this one is basically on using other languages in conjunction with CF, and how they can work together. Whilst also showing some cool stuff other languages can do, and how actually some of it can be done - or at least emulated - in CFML too. He specifically mentioned Clojure and Scala, and discussed how powerful using closures and callbacks can be. And gave me some ideas for some enhancement requests for CF. I need to go back over his notes at some point, and I'll probably write up some more stuff on closures in CFML at some point soon.  And I've also added another two languages to have a look at.

Two hours in: three languages to get up to speed with. I despair.

Fortunately the third hour is back to Javascript, so I won't be adding any new languages to the TODO list. This presentation is by Ryan Anklam, and is just some "back to basics" coverage of Javascript. Not completely "Hello World" sort of stuff, but vanilla JS and some tips / observations on stuff like the difference between the == and === operators, how the this variable behaves differently depending on its context, and stuff like that. This is pitched pretty much perfectly for my level of Javascript: I'm not a complete n00b, but I'm definitely just a journeyman. I reckon about 50% of the stuff Ryan presented was either new to me, or clarified some uncertainty I had before sitting down, or just kinda cemented what I already knew. It was a great presentation. I hope to track Ryan down and have a beer with him at some point.

Unfortunately I missed lunch because I needed to pop upstairs to Skype with my boy. What a little dude he is.

After the lunch break the Adobe bods gave a presentation about what's coming in ColdFusion 11. Unfortunately it was a presentation more aimed at IT Managers (the people who sign the cheques for CF licences), not developers. Apparently CF11 will have 100% functionality coverage in CFScript (including <cfform> and <cfpod>??). This is something they promised first in CF9, and we're still not there yet. But let's see if they achieve this this time around. The big thrust of CF11 seems to be ticking off the boxes of current industry buzzwords like "mobile apps", "social media", "big data", and the like. One thing that really worried me is the mention of social media "widgets"... to me this sounds like <cffacebook>, which is to Facebook "integration" what <cfform> is to forms. I also saw a <cfclient> tag in some example code. This is for using ColdFusion to write mobile apps. That could be interesting. However as far as <cffacebook> (this is just an example of a "social media widget", and I saw no mention of a tag like this) goes: we don't need or want this stuff in the language. I also thought they'd undertaken to not add this sort of fluff into ColdFusion any more. So I will wait to see what they come up with. I was underwhelmed by this presentation. Mostly because this is a developer conference, and the presentation clearly wasn't aimed at developers.

Next I hit Mark Drew's presentation on his top ten developer features of  Railo. What I found interesting here was the first few things were concepts that myself and/or other people in the ColdFusion community have requested of Adobe for ColdFusion, but Adobe have ignored. Railo have implemented these things developers asked for, and Adobe have not. This is poignant, I think. The three things that stood out here was that Railo implements a lot of data-type-specific functions as member functions of the underlying class. Basically instead of this old procedural trope which we're familiar with in CFML:

i = arrayLen(myArray);

In Railo one can take a more OO approach:

i = myArray.len();

This makes a lot of sense to me. I think it's a gap in CFML's implementation since CFMX 6.x when ColdFusion added OO to the language with components... as a developer we are able to write OO code, but CFML itself remained entirely procedural. This is sorta syntactical sugar, but being able to move away from mishmashing procedural and OO code must be a good thing. I actually covered this in my previous article. I've raised an enhancement request with Adobe: let's see what they do with it. It'd be great if they caught up with Railo here. I'm usually hesitant about Railo adding language features that ColdFusion itself doesn't implement, but I think Railo has got this right.

The second thing is Railo has charged forward with its CFScript implementation, and has basically implemented everything that tags can do in CFScript. They have taken a generic approach here, in that if one has this tag:

<cfmytag arttibute="value" something="else" etc="etc">

Then one can simply lop off the "<cf" and the ">", stick a emi-colomn and one has the CFScript implementation:

mytag arttibute="value" something="else" etc="etc";


For nested tags:

<cfmytag attribute="value" something="else" etc="etc">
    <cfmysubtag attribute="value">
</cfmytag>

We have this:

mytag attribute="value" something="else" etc="etc" {
    mysubtag attribute="value";
}

So here we lose the <cf> stuff and use braces to indicate the nesting. Makes sense.

If I'm honest, whilst I say it makes sense, I am not sure I like it. I really think everything ought to be implemented in a function-style sort of way, rather than just tags without angle brackets. EG:

mytag(attribute="value", something="else", etc="etc") {
    mysubtag(attribute="value");
}

But this is entirely subjective, I know. However I'd rather have what Railo have done than not have it at all.

One thing I can't stand with their solution though, is how they emulate <cfquery>:

query name="data" datasource="dsn" {
    writeOutput("SELECT col1 FROM table1 WHERE col2 = ");
    queryparam value="#myVar#";
}

Using writeOutput() here just seems wrong, and really ugly. writeOutput() is for putting text into the output buffer, not for "escaping" text in the code. This is grim.

Unfortunately Mark asked whether people liked this, and more unfortunately Muggins here opened his mouth and said "actually Mark, no". Which distracted from his presentation a bit, as we then went into a discussion as to why I didn't like it and what a better solution would be. I'm all good for discussing this with Mark, Gert and Micha, but I didn't mean to interrupt the presentation. For the record the answer to "how would I suggest doing this?" is "not at all. Just don't write code like that". I'd just create the SQL string as a string variable and pass it as a string, or I'd include a file with the SQL in it (and any related CFML code). I'd not try to solve this "issue" beyond that.

Another thing I dislike here is this:

query name="data" datasource="dsn" {

}

I think it ought to be like this - again, with the function-style approach:

data = query( datasource="dsn") {

}

ie: it's a function, it returns a value, so it should be expressed that way in the code too.

But, again, I'd rather have the approach Railo has implemented, than not have it implemented at all.

One last syntactical conceit that is possible here that had not occurred to me is that instead of this:

param name="foo" type="string" default="bar";

One can do this:

args = {
    name="foo",
    type="string",
    default="bar"
};

param attributecollection=args;

This is perhaps obvious, but it had not occurred to me.

I was back in front of Sean next, with his intriguingly-named presentation: "ORM, noSQL and Vietnam". This was basically an explanation that -  and I'll be cruel in my summary - that there is a square-peg/round-hole issue with persisting OO objects in an RDBMS, so intrinsically ORM is not great (well that's what I took from it). He then went on to explain how document-oriented DBs work, using MongoDB as an example. He's got all his slides and code on his blog, and it's best to follow through that than me repeat it here. One thing worth reading so I'll link here is Ted Neward's article "Object/relational mapping is the Vietnam of Computer Science", which is the basis for Sean's "Vietnam" reference.

At this point my brain hit a wall, and it stopped taking stuff in, to a certain degree. I was like an extra from the Walking Dead.

Finally was Dave Ferguson's presentation combining web sockets, the new ColdFusion 10 scheduler and Zingcharts (via <cfchart>). This was fascinating stuff, and did what it said on the wrapper. It's piqued my interest in web sockets again, so I'll probably do more investigation there and blog about it. Nice one, Dave.

After that I hit the bar and stood there like a zombie for a while, drinking a Summit Oatmeal Stout, which was a good, solid stout, not simply a dark ale (which a lot of "stouts" I encounter tend to be).

Shortly after arriving at the bar, in the adjacent room was a meeting / discussion with the OpenCFML Foundation, which I sat in on. They're basically concerning themselves with promoting CFML applications (open source ones), and CFML-awareness in general. Basically marketing CFML development, and the CFML community, rather than the marketing Adobe might do (I wish they'd do!) for ColdFusion, or Railo marketing themselves. They've given me some ideas and a lot of food for thought, and I'll be making sure to get back in touch with them when I get back to the real world.

That was it for the conference-y type stuff for the day. From there a few of us went into the Mall to a joint called "Buffalo Wild Wings", which did what it said on the box... served us wings... and fries... and beer.

And after half a final pint I really really hit the wall, and gave up for the day. A case in point of how hard I hit the wall... it does not seem natural to me to drink half a pint, but I gave up half-way through my pint. This was at 10pm. Disgraceful.

It's now Friday, 11:40am, and I feel alive today. And my man-flu has pretty much gone. I'll try to write up today's sessions tomorrow, or later today.

In closing, the conference has thusfar been brilliant: the presentations are uniformly excellent, and it's been great to meet all the people I have so far only communicated with online.

I better pay more attention to Scott's Grails prezzo...

--
Adam