NDC London 2014 Highlights

Last week I traveled to London to attend the NDC 2014 developers conference. It was an excellent conference – great speakers, really friendly crowd, well organised and run. I’d highly highly recommend it to any software developer. All the sessions were recorded and I’d expect them to appear on vimeo shortly, I already have access to the recordings by registering as a conference delegate.

Here’s a rundown of my favorite talks & highlights from the conference in no particular order

“Reactive Game Development For The Discerning Hipster” – Bodil Stokke

This was a real breath of fresh air ! Bodil took to her keyboard and built out a working game from scratch using the JavaScript RxJS reactive extensions library.There were ponies jumping around on the screen, avoiding obstacles and catching magic coins. Well done, it was real brave to get up there and code live on stage. We need more live coding at tech conferences. She showed how easy it is to compose a application using the  asynchronous reactive library without a single callback in sight. Flying ponies, live coding & reactive extension woot !!

2014-12-03 12.20.37

“ASM.js, SIMD, and JS as a compiled-language virtual machine” – Brendan Eich.

Firstly, wow I can’t believe I came face to face with the creator of JavaScript! Brendan took us through a brief history of the language  from the early days back at Netscape all the way through the present day with the ECMA 6 language enhancements , ahead of time compilation engines and then beyond to ASM.js. It’s a subset of JavaScript  which provides a model closer to C/C++ by eliminating dynamic type guards, boxed values, and garbage collection. The code can be compiled ahead of time and stored in offline storage giving you fast start up times with very good performance characteristics. Brendan shared preliminary benchmarks of C programs compiled to ASM.js that are within a factor of 2 slowdown over native compilation with Clang. Game developers like Unity are working with ASM.js as a way to get their games running on the Web without plug-ins. This would also opens the door to many new types of games and mash-ups with everything running in the browser.

Check out Brendan Eich playing a rewrite of Doom with a mash-up  inside it where another port of Doom is running in an iFrame. A game within a game – confused?, I know I was !2014-12-05 12.36.09

“Practical Considerations for Microservices” – Sam Newman

This talk was very close to my heart – I’ve spent the last 12 months working with a large team on a successful project built from the ground up using microservices. Sam did a great job explaining what microservices are and the pitfalls to avoid when you adopt this style of architecture. Great common sense stuff here, it all resonated with me and  its great to see microservices becoming more mainstream. Sam talked about what you should standardise across a project – make sure you use consistent message exchange patterns , monitoring and deployment approaches but don’t get hung up upon how the microservices are built internally. I really enjoyed this session.

“Five (or so) Essential Things to know about ASP.NET vNext “- David Fowler and Damian Edwards

Damian Edwards and David Fowler demonstrated ASP.NET vNext with some fun code samples and slides that explained the brand new stack. The key word here is “new”. Shiny shiny new !.It looks like a rewrite from the ground up to support Windows and Linux for the first time. The photo below shows the Windows components in blue and the new linux stack in orange.

2014-12-04 16.27.25

The guys shared a lot of information in 60 minutes. Web.config files are now gone ! In future you’ll be working with project.json files to store all your project dependencies. This is going to make it much easier to author .NET apps outside of Visual Studio. The guys demonstrated the cross platform support  writing the code once and running it on a Windows and Linux VM  – this got a great round of applause from the crowd !

Next it was onto the dynamic recompiling – Any changes to a dynamically compiled file will automatically invalidate the file’s cached compiled assembly and trigger a recompilation. The guys changed some C# controller code and the changes appeared with a browser refresh. This is a great step forward, in theory you can now eliminate the whole compile step from your deployment process. This is all possible because ASP.NET is now leveraging the Roslyn Compiler as a Service.

It looks like there will be an awful lot of breaking changes with the new version. All the web server middle-ware has been cleanly separated out into separate NuGet packages. I’m guessing the middle ware interfaces are very close to the OWIN Interfaces.  When you create a new  ASP.NET project everything is turned off by default. You need to enable and pull down the middleware packages you need for your app. This is a really good thing. Your web application will be much more lightweight wthout any any additional bloat. The demo’s reminded me a lot of the minimalist node.js Express Framework. Oh yeah and WebAPI is now part of the same codebase !

“Lessons From Large AngularJS Projects” – Scott Allen

Scott Allen delivered a excellent talk on patterns and approaches to consider on your next AngularJS project.  Things like error handling – how to set up an error handling service to handle all unhandled errors rather than relying on scope.emit and the evil $rootscope variable. He demonstrated some clean code to manage security tokens using http interceptors and decorators , I’ll definitely be digging into this one further. Finally he covered the $httpbackend  mocking service  that lets you program expectations for external http calls without having to go over the wire in an automated test.

“Kicking the complexity habit” – Dan North

Dan North gave a really funny talk on how we should all be avoiding unnecessary complexity at every point in the SDLC. Without rigorous care and attention software quickly becomes messy and unmanageable. Even with the best intentions entropy and complexity are a fact of life in growing applications.  From your IDE to your automated build, from DDD’s ACLs to TDD and other TLAs, from backlogs to burn-ups, we are surrounded by props for coping with complexity. As appealing as these are, they also make us less likely to address the underlying problem of complexity itself. Dan believes you can learn to recognise these coping mechanisms for what they are, and intends to set you on the path to simplicating your programming life. Great talk and very thought provoking.

TypeScript – first impressions are promising but where will it end up?

Earlier this week Microsoft announced TypeScript, an open source language that compiles down to plain old JavaScript. OK I can already guess what’s going through your head, you are thinking “is it like CoffeeScript?” or “is it like DART?!” Fortunately the answer to both questions is no!.

CoffeeScript doesn’t need improving and one DART language is more than enough! DART compiles down to JavaScript but it also targets the DART VM. TypeScript on the other hand is a superset of JavaScript, its not intended to replace JavaScript, rather it give you a more productive experience in writing JavaScript particularly on a large projects.

“TypeScript has a fighting chance of making it..”

I think TypeScript is in with a fighting chance of making it because of the tooling that it puts in developers hands. Microsoft builds excellent IDE’s and with TypeScript you now have all that intellisense goodness and static code analysis at your fingertips. Hardcore JavaScript developer are more than happy to work away in vim and lightweight text editors but there are plenty of mere mortal developers that will enjoy the TypeScript development experience.

Shipping the TypeScript compiler as a node package is a clever move. TypeScript can run wherever node.js can which covers most platforms of choice.

 Please keep the language spec clean and simple ! Less is  definitely more with TypeScript

The TypeScript language specification is currently nice and uncluttered but who knows where it will end up?. Anders Hejlsberg (lead architect of the C# language team ) is at the helm. When you compare C#1.0 and C#4.0 they are completely different beasts. In the case of TypeScript less is more in my opinion. It should be about giving developers just enough design time type checking and intellisense without completely stifling the dynamic nature of JavaScript.The road map for TypeScript includes support for generics – this scares me. Do you really need generic support in a dynamic language like JavaScript?

What’s nice about TypeScript

(1) Inheritance is nice and cleanly implemented

Below is a simple example of inheritance where specialCustomer extends the customer class and calls the base class constructor from its constructor.

class customer {
	id: number;
	name :string;

	constructor (name: string, id:number) {
		this.name = name;
		this.id = id;
	}
	greet() {
		return "Hello, " + this.name;
	}
}

class specialCustomer extends customer{
	loyaltyCardNumber :string;

	constructor(name:string,id:number,loyaltyCardNumber :string){
		this.loyaltyCardNumber = loyaltyCardNumber;
		super(name,id);
	}
}

TypeScript does the heavy lifting adding the necessary prototyping and closures for you – this is very cool and definitely saves time!

var __extends = this.__extends || function (d, b) {
    function __() { this.constructor = d; }
    __.prototype = b.prototype;
    d.prototype = new __();
}
var customer = (function () {
    function customer(name, id) {
        this.name = name;
        this.id = id;
    }
    customer.prototype.greet = function () {
        return "Hello, " + this.name;
    };
    return customer;
})();
var specialCustomer = (function (_super) {
    __extends(specialCustomer, _super);
    function specialCustomer(name, id, loyaltyCardNumber) {
        this.loyaltyCardNumber = loyaltyCardNumber;
        _super.call(this, name, id);
    }
    return specialCustomer;
})(customer);

(2) Visibility Modifiers

The visibility modifier keywords like private are enforced by the TypeScript compiler but the generated JavaScript does not reflect this. A private property is implemented as a regular property but the compiler will enforce a developers intent with regard to visibility modifiers.

(3) External Type declaration files

Type declaration files (.t.ds file extension) define all the public interfaces that your JavaScript code exposes. Check out the node.js file that is published here. By creating an external type declaration file you get to interact with other existing libraries through TypeScript. Currently these files are hand crafted which sounds really tedious but I’m sure this will be automated in a future release.

(5)TypeScript  Playground

Similar to the google DART board, TypeScript has a nice web based shell where you can get your hands dirty without downloading anything. Check it out and have a play.

http://www.typescriptlang.org/Playground/

What not nice about TypeScript

(1) The  plug in for Visual Studio 2012 install as a C# template! Confusing eh? I sure found it hard to find !

(2) Slow feedback loop in Visual Studio.

You need to compile your project to view the generated JavaScript code. It would be nice if the there is a split panel view where you can see the generated JavaScript as you are coding , similar to the playground.

What’s Missing

  • Async/Await keywords would be a really nice feature. There are several  well known JavaScript implementations to borrow from.
  • An external type declaration file generator. A tool that can load up a JavaScript library and “decompile” it to a .t.ds file.
  • Better Visual Studio experience à la TypeScript Playground.

Overall I’m very excited about TypeScript. Microsoft is clearly getting very interested in embracing JavaScript in its many forms, their arsenal includes node.js support on azure, Win.JS, KnockOut.JS (Microsoft employee) and a JavaScript Hadoop offering. While TypeScript won’t be everyone’s cup of tea I’m sure it will appeal to a large enough portion of the development community to give it legs.

may the source be with you!

Aidan