Monday 24 March 2014

Monday - Designing and Developing Reactive User Interfaces

This evening, I attended a presentation of an implementation of reactive technologies in .Net by Lee Campell and Matt Barrett.



This centred around a trading application written by Lee, Matt and their team, and, perhaps, best to see this as a continuation of the presentation I saw last week at Microsoft. The application, which, they said, will be open sourced, was pretty slick, a combination of Windows Presentation Foundation and the original Microsoft Rx library.

It was a very good and well thought out presentation about an interesting, a prescient, subject.

Saturday 22 March 2014

Elysium

Through my LoveFilm subscription, a(nother) sci-fi film from Neill Blomkamp, director of District 9. Having been fatally irradiated at work, Max Da Costa (Matt Damon) makes a deal with local activists to break into the orbital space station Elysium for a chance at being healed.


With a rather good plot, breath-taking special effects, and decent acting (although I would have preferred someone Hispanic instead of Damon, but I suppose it required a name to sell it), Elysium makes for a rattling good sci-fi film. I especially liked spangly space station and the robots, but all the weaponry was cool, especially the exploding bullets. Recommended.

Along similar lines, there's a new series out in the states called The 100.


Mmmmmm, teenagers in space. Yeah, I'll give that one a miss, I think, assuming anyone over here is going to buy it.

Thursday 20 March 2014

Wednesday - Android Livecode, RxJava Architectures on Android at Microsoft

This was an Android Livecode presentation hosted at the Microsoft offices in sunny Westminster.

Yeah, I didn't get it either, and the Microsoft people were not exactly convincing in their reasons for hosting what is, essentially, a presentation for the competition. (For those who don't know, Android is the mobile phone\embedded operating system owned by Google and in competition with Microsoft's Windows 8).

After the introduction, the main presentation was given by a Berliner, Timo Tuominen from Futurice, concerning the use of Functional Reactive programming on Android. This centred around the use of RxJava, an open source library based on a Microsoft library and implemented by Netflix, the video streaming company.



(A well attended presentation, as you can see, but there was free beer and pizza).

RxJava is centered around the use of an Observable class i.e. an implementation of the Observer design pattern from the "Gang of Four" book, on which most event models are based. It seems that the difference between, say, the standard Java listeners and RxJava is that the listeners have to be implemented within the class as you're coding it. Here's something I've been working on for the College:
//custom event maintenance
//this is a list of events that have to
//be serviced when something happens
private List<SwitchListener> listenerList = new ArrayList<SwitchListener>();

public void addSwitchListener(SwitchListener listener) {
 listenerList.add(listener);
}

public void removeSwitchListener(SwitchListener listener) {
 listenerList.remove(listener);
}

private void fireSwitchListener() {
 //parcel up the state of the switch in a SwitchEvent object
 SwitchEvent e = new SwitchEvent(this, isSwitchOn());
 //then send it to every listener in the list
 for(SwitchListener listener: listenerList) {
  listener.switchChange(e);
 }
}

Listeners are all over Java components as it provides a way of passing messages between the components and their containers without the components having references to the latter (a problem known as "coupling").

What RxJava seems to do is wrapper up listeners, or something like them, into a framework that can be applied to any other object. For example, if you want to "listen" to an object so that when it changes you can do something else, or react to it, you can use the Observable class to do it:

Observable.from(names).subscribe(new Action1<String>() {
 public void call(String s) {
  System.out.println("Hello " + s + "!");
 }
});

It does seem to be something that you would think was already in function programming languages, like Clojure and Scala, by default, but RxJava can be used by these, so maybe it isn't?

Overall, the presentation wasn't brilliant as Timo is not a natural presenter, plus he seemed unaware of any of the alternatives (although his boss was there and stepped in to answer the awkward question or two that arose), which was a shame because it does seem like an interesting subject.

Wednesday 12 March 2014

Tuesday - Java Concurrent Animated

I thought I take a trip into town this evening to see a presentation at Skills Matter by Victor Grazi (complete with "Brooklyn accent") concerning Java concurrency.


Concurrency is always a difficult subject, but not so much the thing itself as what happens when concurrent processes try to access the same resources at the same time. Normally, in Java, this is done via the "synchronized" command. You designate a block of code and wrapper it in a synchronized block:

synchronized(this) {
    Counter.count++;
    System.out.print(Counter.count + "  ");
}

or declare a function to be synchronized:

public synchronized void assign(int i) {
    val = i;
}

However, if one thread gets to the block first, it locks out the any other threads trying to do the same. There's nothing that the others can do about it other than wait.

Victor's presentation was regarding what was available in the Java API, such as Locks, Semaphores, to get around this or avoid it altogether, as well as exploring other aspects of the API such as Thread Pooling.

What made this presentation a little different was the animation of the threads, which were doing little animated circuits to illustrate his points. The source can be found on SourceForge.


As you can see, it looks cute. Plus is does show you the various options available to the Java programmer other than just the ubiquitous "synchronized".

Victor gave a very good presentation of a difficult, but important, subject.

Monday 3 March 2014

Throne of Blood - "A Man Without Ambition is Not a Man"

Film 4 are currently running a Kurosawa season at the moment, and the latest one was this classic retelling of Macbeth. Samurai Commanders Washizu (Toshiro Mifune) and Miki (Minoru Chiaki), on their way to see their feudal lord Tsuzuki (Takamaru Sasaki), Lord of the Spider Web castle, encounter a fortune-telling demon.


Famous for the final "arrow" scene, I don't think it's as good as Yojimbo or, my favourite, Sanjuro, although the Scottish Play does translate rather well to feudal Japan. Mifune is excellent as the increasingly paranoid and tyrannical Washizu, driven by both his wife (Isuzu Yamada) and his own ambition to fulfil his destiny, whatever the cost, and the whole film has a creepy foreboding quality.

Contrasting with this (through my LoveFilm subscription), and also a story of ambition, is Pain and Gain, a crime "comedy" starring Mark Wahlberg and Dwayne "The Rock" Johnson. Body builder and personal trainer Daniel Lugo (Wahlberg) decides that he wants the high life that he sees some of his clients enjoying.


Although it does have a few funny moments, it's mostly a rather silly and somewhat grim crime caper. Wahlberg isn't too bad, and he's got suitable support in Johnson as a Christian ex-con and Ed Harris as a private eye trying to convince the police to take the whole thing seriously. The real suprise, though, is that it's all true(-ish), making the whole thing rather sad (the protagonists are currently on death row in Florida).

Sunday 2 March 2014

Jesus Scores for City

That is Jesús Navas who scored the third, and last, goal for Manchester City in the League Cup final against Sunderland.


There's talk of doing the Treble (League Title, Cup and F.A. Cup), but realistically and barring a minor miracle, the League looks to be sewn up by Chelsea. This leaves the F.A. Cup, so a double of sorts is possible, and Chelsea are out of that competition for some reason...

Saturday 1 March 2014

Monday - Continuous Delivery Gone Bad

At the invitation of my erstwhile and erudite colleague and associate Mr. Laver, I went to a presentation by Gojko Adzic at Skills Matter regarding his experiences and recommendations for continuous delivery, one of the corner stones of agile development.


In quite an interesting, if earnest and intense, presentation, Gojko related some interesting anecdotes, and a few novel ideas.

Notable was that to do justice to continuous delivery, it has to be done with multiple versions, allowing mistakes to be made and features to be added without interrupting the work flow of the customers using the applications. There were a few intakes of breath from the audience, and he didn't disguise the difficulties of this strategy, particularly regarding data versions.

Another was the idea of using fast prototyping techniques, often without any coding whatsoever, to be able to sort out business issues, and that feedback and measuring are also important elements, especially if the project is a success.

All in all, it was quite a good presentation, if a little slow in places, and it was good to see how Matt was faring after starting his new job.