Month: March 2014

Designing and Developing Reactive User Interfaces

This evening, I attended a presentation of an implementation of reactive technolologies 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. One of the things they emphasised was to see the design in terms of streams of information and events, rather than static entities and code.

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

Android Livecode, RxJava Architectures on Android at Microsoft

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

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 model 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) {

public void removeSwitchListener(SwitchListener 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) {

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?

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) {
    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. It looks cute, plus is does show you the various options available to the Java programmer other than just the ubiquitous “synchronized”.

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

A Skills Matter Presentation – Continuous Delivery Gone Bad

At the invitation of of a former colleague, 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.