Alex headshot

AlBlue’s Blog

Macs, Modularity and More

EclipseCon 2013 Day 1

2013, eclipse, eclipsecon

Today was the starting day for EclipseCon, and for many years Monday has been tutorial day. These tutorials are included in the price of the conference ticket, and two three-hour tutorials fit neatly into the first half of the day, followed by an exhibitor’s receiption and the evening community event.

The tutorials I attended this year were Xtext and Xtend specific. Having said that, I was jealous of others in Benjamin Cab&eaccute;’s talk which was on Raspberry Pi and Arduino programming; however, whilst that’s just a passing interest to me personally the Xtend and Xtext basics were ones that I had been meaning to investigate in more detail for some time but never put the time aside to spend any significant amount of time learning them.

Xtext

First up was the Xtext tutorial. For those that don’t know, Xtext is a parser generator/DSL/editor which can spit out not only a model of the code but also associated text renderers. There’s a lot of machinery under the hood to making such things work seamlessly, and many more API hooks for performing things like validation and generation than I would have thought possible.

I also now understand some of the syntactic elements in the Xtext grammars, which aren’t immediately obvious, such as foo+=bar* means that ‘foo’ will be a list of zero or more ‘bar’ elements, and option?=something? means a boolean value ‘option’ which is true iff ‘something’ is present. I’ve never seen those explained before, and having it come to light suddenly makes sense of a lot of things in the past.

What I didnt also appreciate was Xtext’s ability to generate content based on both a validator and a generator step. The default project has placeholders for both of these, though they default to no-ops.

There was also a lot of detail in how Xtext raises its suggestions and valid entries for scopes; unfortunately, the exercises took the group slightly longer than planned and so there was a cursory glance over these implementation details. There’s some documentation at the xtext site which makes about as much sense as before the talk …

Still, at least I got to talk to a few of the Xtext guys, and managed to put my view across that whilst whitespace-sensitive grammars are technically possible (and needed for languages such as Python, Makefiles and YAML) there are no open-source examples of using such a whitepsace-senstiive grammar. There’s a difference between ‘technically feasible’ and ‘practical’ which is just a little too big a chasm to cross at this point.

Still: mission accomplished; I know a lot more about Xtext than when I started, even if I now know that there’s more that I don’t know.

Xtend

The next tutorial was on Xtend, this time on active cnnotations (a new feature in 2.4) and a functional programming quiz. Xtend is based upon the Xtext parsing suite, and translates into Java and then hands off compilation to the Java compiler – meaning none of the headaches usually seen with Scala and none of the blisteringly fast Perl-like performance of Groovy. It also helps that the language is statically typed, yet uses inference (like Scala) so that you don’t have to write repeated boilerplate code.

Active annotations are really very cool indeed; they provide a way of annotating a class with an interface (like existing Java annotations) but allows you to hook in a translation rule to say how the generated Java class should be amended. In this way, it’s possible to define a @Serializable annotation that will automatically generate a serialVersionUID field, or a @ToString generator based on the field contexts.

The exercises then jumped a few levels and dived right into a functional programming exercise. Xtend, it seems, depends on Guava (version 10, if anyone is interested) which I wonder what would happen if a program used a more recent version of Guava as well as Xtend functionality.

The probelm with the gear shift is that many features of Xtend becamse assumed, such as the integration of the guilement quotes and template FOR statements. There were also some aspects left unexplained, like extension methods and how functions like 10.minutes were actually evolved (there’s a minutes() method elsewhere in the example which takes an int, so 10.minutes is an implicit extension method on int values).

One thing I did learn was that functions which take a lambda as their last argument don’t have to specify it in the argument list, but can simply place the lambda after the expression in question. So a call to foo(1,[3]) can also be written as foo(1) [3], on the basis that lambdas often span multiple lines and thus you don’t have to worry about bracket nesting. It looks tempting to think of it as a partial function, but Xtend doens’t have those; it’s just syntactic sugar to make it prettier.

I’m still pretty excited with Xtend in general; it’s no Scala killer yet (though Scala is doing a good enough job of killing itself) – but I think the killer feature of Xtend is going to get IntelliJ support. JetBrains have no interest in doing this, so I wonder if a port of Xtend to IntelliJ will have to happen, and essentially port the Eclipse editor into a runtime instance of IntelliJ. Without it, I think Xtend will remain a power tool for Eclipse users and Eclipse plug-in developers, but probably not in the wider JVM replacement language category just yet.

Eclipse community event

One of the nice things about Eclipse is that despite being a large community, events like these really bring everyone together. In this case, the awards ceremony awarded several projects and committers for their work, including a lifetime achievement award for Chris Aniszczyk, who has worked tirelessly promoting Eclipse and projects for all of the time that I’ve been involved with the Eclipse community. I think it’s an achievement well deserved.

There was also a ‘family fortunes’ (aka ‘family feud’ in American) in which I took part, and which our team lost. Oh well, it’s the taking part that counts …

BoFs

Another great part of EclipseCon is the after-hours events. In this case, the Birds of a Feather sessions get like-minded people in a room to talk about or investigate a particular piece of software/technology. In my case, I went to the Raspberry Pi hackathon, in which I got my hands on an Arduino and a Raspberry Pi and actually did some programming/wiring between the two. Unfortunately I got a duff Pi, which meant that it took ages to do anything, but the Arduino was especially easy to program and hook up with a few hardware buttons and LEDs with a mini breadboard.

I also think I finally understand why a combination of Raspberry Pi and Arduino makes sense, as opposed to an either-or. The Raspberry Pi is a standalone computer, and can drive an HDMI screen, make network connections and do general purpose programming, as well as a few pins for digital I/O. However, the I/O pins on the Pi are directly connected to the CPU, so if you do something wrong and fry the Pi then you’re out of luck. On the other hand, an Arduino is quite hardy, and is able to deal with more rough treatment. The program is less flexible, in that it needs to be connected to an EEROM type programmer in order to be programmed. The Arduino makes this trivial, as you can connect it to a USB port and then flash it with a new program (they’re called ‘sketches’ for some bizzare reason) but on the plus side the event loop is capable of polling for changes to any of the pins and read them in as values, from which you can do simple processing and manipulation. To do anything serious, you can punt the resulting values by either serial port (cleverly, you can plug the Arduino Uno into the Pi’s USB port and both power it and have a /dev/tty for bidirectional communication between the two). The Pi can then read these from the standard terminal, and do more extensive programming and/or network transmission of the data to a central location.

It’s also possible to hook up a Pi and an Arduino using more low-level technical methods, such as an I2C bus. I didn’t explore these but if a Pi needs to drive several Arduino boards then the I2C bus offers that possibility.

The Arduino kits also come packaged with several ‘shields’, which are really just daughter boards that can plug into the expansion slot. The shields are stackable, so it’s possible to plug one into the top of another, and then another on top. Each one has its own personality; some are used for controlling electronic motors, others can provide networking capabilities, and others still have just pins to which specially crafted backpacks or tinkerset items can be used to provide real plug-and-play electronics.

So, when I get back to the UK it’s time to get ordering some new miniature hardware.

EclipseCon 2013 Day 0

2013, conference, eclipse, eclipsecon

Good news, everybody. I’m at EclipseCon in Sunny (if not slightly chilly) Boston, and having survived the flight with only a minor headache I’ve registered, met up with a few old friends (and some new ones) and am about to head down for a brainstorming session on bug 300500.

The other piece of good news – and the reason why my blogging has dropped off a cliff over the last year or so – is that I have finally finished writing a book on Eclipse plug-in development. This covers the basics (creating views and so forth) as well as up-to-date content like the differences introduced in E4 as well as how to build and deploy update sites with Tycho and run tests with SWTBot. It doesn’t aim to be all things to all people – in fact, I’d imagine that many reading this post will already know all there is to know about the content of the book – but it’s aimed at those who are starting out their plug-in journey and want to be able to build Eclipse based plug-ins for now and future use. It’s written in a step-oriented tutorial style (somewhat different to my usual colloquial posts) so I’m curious to see if this helps or hinders adoption.

The book should be out by the end of next month, and I’d like to thank those who have contributed reviews so far (and those who have said they will) – I’ll make sure that the Acknowledgements chapter is up-to-date with any feedback received.

Anyway, having finished the bulk of the book and going into a proof-reading and typo-spotting phase, I hope to have enough time to be able to get back to blogging in a more meaningful way than conference write-ups. And speaking of conference write-ups, expect to see my thoughts not only here but also on InfoQ – and hopefully a few video-recorded interviews with some of the fellow EclipseCon attendees.

In any case, if you spot me at EclipseCon and want to say hi, please do so. My Twitter (or App.Net) avatar looks much like I do, except he’s got less grey hair and no body.

QCon London 2013 Day 3

2013, conference, qcon

Finally, the last day of an excellent conference. Today’s keynote was the master of the wiki, Ward Cunningham (@WardCunningham) on Federated Wiki.

The point of a federated wiki is to expose data through markup languages (think CSV meets markdown) and for a page to render data from whichever source it has come from. Not only that, but data sources can be combined from other sources or pages, so that blended views of data can be combined together.

There’s an example federated wiki at ward.fed.wiki.org along with some Vimeo videos demonstrating what it is like (http://vimeo.com/27671065, http://vimeo.com/27671347 and http://vimeo.com/27673743).

The use of d3js to provide the chart rendering and graphics in a browser was a pretty neat trick. It uses HTML5 Canvas if available, and if not falls back to SVG and even VML to render the graphics, so it works on almost every browser that has a graphical interface.

Physical Pi with Steve Freeman and Romilly Cocking

The most interesting talk for me was about a Raspberry Pi. Steve and Romilly had created a Pi-driven robot; they announced early that morning that they had run out of batteries, and at the start of their presentation they said that they had still run out of batteries and so couldn’t demo it. (Somewhat makes you wonder why they even told anyone about it, but hey.) The slides are available but the video probably has more energy, for when it comes out.

As someone who was interested in electronics at an early age but fell into software soon after, the Raspberry Pi seemed like a great way of getting back into it again. Although I have yet to buy one, it will be a purchase this year sometime, in part thanks to this presentation inspiring with various ideas.

They didn’t only have a Pi but also a connection with Arduino boards using the I2C communications protocol, with the Pi being the brains to the Arduino’s limited but functional slave system. With all the software being coded in Python, it makes interacting with other devices much easier than it was in the past. (That’s twice this week that people have been talking up Arduino and Pi devices; surely a good indicator if nothing else as to what I should be doing this year.)

I do wonder whether the Pi is really for a new generation of enthusiasts, or an older generation pining to be the younger generation again. In that way, it’s a bit like SodaStream – and probably more successfully, Lego – in that they were once a household item, dropped below the radar, and then resurfaced when those that used to love them turned into those that could purchase them for their kids. Heck, there’s even a Raspberry Jam running just down the road from me in Milton Keynes every now and again.

Ah, nostalgia. I remember it well.

Inside Lanyard’s Architecture with Andrew Godwin

The next talk I went to was one on Lanyard’s architecture by Andrew Godwin (@andrewgodwin). The slides for this are also available.

They have a highly available architecture which allows them to evolve the site, and have the ability to put the site into read-only mode with cached content should the back ends suffer from any issues (or upgrades). They deploy content continuously (several times a day) and roll out new features with feature switches that allow some parts of the stack to be switched on or off depending on the user or group that they are associated with. This doesn’t do A/B testing in the strict sense, but does mean that the beta users get to see the new features before the wider audience against production data, so that they can get a feel for what works and what doesn’t work before it goes live.

Visualising Information with HTML5 by Dio Synodinos

One of my fellow InfoQ editors, Dio Synodinos (@synodinos) gave a talk on visualising data with HTML5 (slides).

He covered using techniques like CSS3 transitions and 3D transformations, as well as Canvas and WebGL drawing. There were also some cool demos, such as http://graphicpeel.com/cssiosicons which shows a screenshot that looks very much like the iOS home screen, but with icons that are entirely CSS based. There were also some Canvas demos, such as BrowserQuest, a graphical adventure rendered in a Canvas.

There were also some other JavaScript libraries mentioned, such as Raphaël, D3.js (again), and Fabric.js (providing Canvas with fallback to SVG).

If you’ve not looked into some of the above, have a look at the examples and what’s possible – the world of visualisations has moved on a lot in the past few years.

Knockout JS with Steven Sanderson

Steven Sanderson (@stevensanderson) from Microsoft showed a demo of using Knockout JS to wire up UI models with underlyin events, so that an object model could be used in the browser to render content whilst at the same time reacting to changes in the model. I’ve seen this approach before in other libraries like Objective-J and SproutCore (which seems to have passed on, much like iCloud has). The difference with Knockout.JS seemed to be that it was a much more natural fit for JavaScript, without having to go into many details as to the underlying framework.

The second part of the demo was how to wire up Microsoft Azure services so that they could drive the JavaScript app, by exposing a NoSQL type DB with REST CRUD operations directly from the JavaScript app itself. The fact that all this existed within a ready-to-go Azure console was a pretty slick part of the demo (and subliminal advertising) – but Steven also had a demo in the Apple app store using PhoneGap as a web view for the same JavaScript app that he had developed (or at least, a previously created version of the same).

Both Knockout.JS and Azure are definitely worth a look, if you’ve never heard either of them before. The slides are available, though given that most of the talk was an interactive demo they don’t buy you much.

Summary

That was it for QCon this year. There’s a lot of the slides available at the conference schedule for Wednesday, Thursday, and Friday, so head over there if you want to find out about what other sessions were going on. A few were recommended to me afterwrds, such as Simon Peter Jones’ talk on fixing the ICT crisis at school but the slides (and if you’re logged in to InfoQ and attended QCon, videos too) are available from the schedule pages.

New this year was the immediate availability of the videos on the same day as the conference. Prior years have drip-fed them out from the conference via InfoQ over the next six months, but this time raw video footage was available as early as the same evening. This was great for the conference goers who missed out an opportunity to see something (and would otherwise have forgotten had it not been immediately available). Once they’re edited with the slides in situ, they’ll be made available on InfoQ as well. The immediate access videos were only available to paying conference guests, though there was some interest in making a separate video pack available to purchase – if you have any thoughts on that, contact Floyd or I can pass messages on to him.

The open spaces were also a new idea for this year. I’m not sure that they worked on the whole; the user groups of prior years seemed to have higher footfall. It also seemed odd to me to finish the conference on an open space; it meant that many just left early on Friday and so the conference gradually slowed to a halt instead of a closing keynote.

What is clear is that it’s QCon’s biggest year ever. We expanded to more floors than before and had a higher footfall than any previous year I recall. And one of the things that makes QCon great is the diversity of talks with a wide range of industries (and government!) represented. Which other conference can you go from a robotic Pi to a massively distributed architecture talk and meet some of Computer Science’s greats into the bargain?

See you next year.