Phillip Trelford's Array

POKE 36879,255

The Promise of Polygot Programming on .Net

.Net was Microsoft’s answer to Java. Java promised a single language that could target multiple platforms. .Net offered multiple languages that targeted Windows. Back then that meant C#, VB.Net and C++/CLI,

Virtual Machines

Things have moved on for both VMs, the JVM now has a plethora of languages like Groovy, Clojure and Scala. Meanwhile .Net code has become cross platform via Mono, in fact C# and F# now have arguably offer a better story for iOS than Java. For iOS, Xamarin compiles C# and F# code to native ARM binaries.

Both VMs have been hugely successful and have seen a wealth of libraries and frameworks built on them, allowing them to interoperate with a vast array of software and devices. This makes languages built on these VMs compelling as you don’t need throw away existing enterprise investments and build everything again from scratch.

Enterprise Java

Java 8

Progress on the Java programming language has been slow, which has in part helped accelerate the adoption of new functional-first languages like Clojure and Scala. Java will be the last mainstream programming language to add lambdas when Java 8 is released potentially in March 2014.

Question marks have also been hanging over Java’s open source credentials since Oracle’s acquisition of Sun. Back in March 2012, Thoughtworks put the Future of Java in the Assess ring of their Technology Radar.

That said in London at least the Java community seems to be strong in numbers with over 3,500 members in the LJC meetup compared to just over 400 for the London .Net meetup.

C# Convergence

C#, VB.Net and C++/CLI all share similar features and so the vast majority of developers have converged over time on the C# programming language.

The dynamic CLR languages IronPython and IronRuby have lost much of their momentum and Nemerle seems to have been subsumed by JetBrains for N2.

That really just leaves F# under active development, built-in to both Visual Studio and Xamarin Studio, it uses the same compiler as F# is open source under Apache 2.0.

C# 5

On .Net, the C# programming language has seen a little more innovation than Java, adding rudimentary functional programming constructs in C# 3 for LINQ like lambdas and extension methods for expressing higher-order functions.

Progress in C# 4 and 5 has been lacklustre since Microsoft departed on a rewrite of the compiler in C#, a closed source project called Rosyln, which is yet to surface.

In C# 4 the focus was on dynamic support, where the main new feature in C# 5 was async, a feature introduced in F# in 2007.


In the enterprise one of the biggest threats to .Net code bases is migration to Linux, for which outside of Mono there is no .Net story. Xamarin, key contributors to Mono, are overwhelmingly focused on mobile. Recent improvements in Mono, particularly in garbage collection, I feel make it a viable server-side platform, but it currently lacks the support and investment seen on the JVM.

As large enterprises continue to look for cost savings, I suspect more .Net share could be lost to switches to Linux. Lower operating costs combined with the promise of higher productivity with powerful functional-first languages like Clojure and Scala, are hard for IT managers to ignore. Nowadays many finance companies use the JVM on the server-side and reserve .Net, specifically WPF, solely for their front-end applications.

I’d like to see Microsoft join forces with Xamarin to deliver a well supported server-side platform with Mono for C# and F# on Linux, to compete directly with Clojure and Scala. That also means .Net open source authors should be supporting Mono deployments too.

Polyglot Programming

The promise of polyglot programming on .Net, where you pick appropriate languages for specific tasks, now rests primarily with familiar C# and functional-first F#.

As C# and F# are statically typed languages on .Net, interop between them is seamless. Both languages also offer bridges to external libraries via C APIs with P/Invoke. F# also offers rich interop to data sources and programming languages on other platforms via Type Providers.

With F# Type Providers you can interact with languages like R, MATLAB and TypeScript and their rich libraries with intellisense support in your editor. Type Providers are a real enabler for true polyglot programming.

Edge.js also bridges the gap between the .Net and JavaScript worlds with Node.js interop.

The combination of C# with it’s familiar syntax and object-oriented constructs with F# and it’s functional-first constructs and type providers, in my opinion, offers arguably the most powerful and productive programming environment currently available.

In the same Thoughtworks Technlogy Radar that questions the Future of Java, they had this to say on F# and C#:

F# is excellent at concisely expressing business and domain logic. Developers trying to achieve explicit business logic within an application
may opt to express their domain in F# with the majority of plumbing code in C#.

I’m seeing more and more .Net shops adopt F# alongside C#, take for example Kaggle a data science consultancy based in San Francisco:

At Kaggle we initially chose F# for our core data analysis algorithms because of its expressiveness. We’ve been so happy with the choice that we’ve found ourselves moving more and more of our application out of C# and into F#. The F# code is consistently shorter, easier to read, easier to refactor, and, because of the strong typing, contains far fewer bugs.

As our data analysis tools have developed, we’ve seen domain-specific constructs emerge very naturally; as our codebase gets larger, we become more productive.

The fact that F# targets the CLR was also critical - even though we have a large existing code base in C#, getting started with F# was an easy decision because we knew we could use new modules right away.

The point here is not to throw the baby out with the bath water and rewrite your entire solution in a new language, instead leverage your existing investments and use the right tool for the job on new features.

Functional Programming

Functional programming has permeated the majority of mainstream programming languages, and is gaining increasing mind share. Here’s a nice slide from Grant Crafton’s recent session on functional programming at DDD North:

Who likes FP

It’s clear to me that many of the original protagonists of object-oriented programming are migrating towards functional. Recently I met Eric Evans, author of Domain Driven Design, in New York who spoke at length on how he’d gone all-in on functional.

At conferences like Strangeloop, I’d go as far as saying this is a done deal, very few people are talking about OOP anymore.

Functional Learning

There’s been quite a lot of FUD around functional programming being hard to learn. In general people encounter two initial speed bumps:

  • Unfamiliar syntax
  • Unlearning 

Neither of these speed bumps are insurmountable, otherwise there wouldn’t be such a large number of developers turning to functional languages.

Lack of familiarity with syntax can be overcome with just a few hours of immersion. For F# I’d recommend the F# Koans to guide you through the language syntax step-by-step and a Cheat Sheet to lookup common operations as you code. F#’s syntax is based on the ML programming language, once you’ve got the hang of it you’ll be able to read a host of other ML based languages like Erlang and Haskell.

Unlearning tends to take longer than learning, so unfortunately if you’ve been programming in an imperative or object-oriented style for a long time, it will be slightly harder to pick up functional programming. That it to say learning functional programming is not inherently hard, just that thinking differently can take some time. I’d recommend tackling short programming exercises like Code Katas or Project Euler problems to break the back of it.

Be patient, once you’re over the hump you could find the experience fun and rewarding:

Happy learning!

Software Developer in Test Role at Trayport

At Trayport we’re serious about quality, and are now hiring for a software developer in test.


  • Are enthusiastic about building automated tests that help continuous delivery of exceptional quality software.
  • Are skilled with .NET and have strong development and debugging abilities, with knowledge of test frameworks and design patterns.
  • Love to work in lean and agile environments, delivering software through TDD, ATDD and BDD.
  • Want to work in a team of talented technologists who will challenge and inspire you.


  • Have a track record of delivering high quality software the energy trading industry depends on.
  • Have a Joel Test score of 11 of 12.
  • Offer a great benefits package including healthcare, gym membership, bonus scheme and a well-stocked kitchen.
  • Hold regular social events for the whole company, including an annual weekend away.

What can we offer you?

  • Good spec hardware, access to a decent library and an office with top facilities.
  • A relaxed environment which includes a casual dress code, regular tech talks, hackathons and opportunities to attend top conferences.
  • Flexible working hours and paid-for home PC and broadband.
  • An induction period to get you up to speed with our business and a buddy to make sure your questions are answered.

What will you be doing?

  • As part of one of the three software teams at Trayport, you’ll automate the testing of top-of-class trading software – both front ends and servers.
  • Have the responsibility and flexibility to choose and develop tools and technology required to enable the team to continuously deliver high quality software.
  • Contributing to the whole spectrum of automated testing from end-to-end UI tests to improving and refactoring unit tests along with promoting good practice to the rest of the team.
  • Experience work on a range of features and products, helping the team produce top quality tested code and have a say in all areas across the business.

Trayport was founded in 1993 and now has around 200 employees, we’re proud of our small company feel but boast a global vision. Our range of clients spans household energy companies, banks, hedge-funds and regulation bodies – providing Windows-based front-ends and servers to facilitate all aspects of trading. We’ve recently moved to top-class offices in a great City location – if you’re interested in what you’ve read, apply today by letting us know how you can help shape our future.

Email me: with your CV (no recruiters please).

DDD North 2013

I’m heading home on the geek train back from a cracking DDD North, this year held in Sunderland and attracting 430 attendees and three well attended F# talks.

I managed to deliver the first pony of the day in F# eye for the C# Guy:

Starting with live samples of immutable classes in C# and then in F# using the class and record syntax. Then instantiating the classes via the F# interactive (REPL) window and from C# which simply requires a reference to the F# library project, it’s all .Net IL underneath.

Then we moved on to unit testing in F# using a selection of libraries from Nuget including NUnit, FsUnit and Unquote. On the unit testing theme Ian Cooper gave a talk on TDD, where did it all go wrong at the same time which was well received.

Leading on from unit testing we took a look at automated acceptance testing with TickSpec, and how this was used in the open source spreadsheet Cellz.

Finally for fun I showed a couple of FunScript samples including the Mario Tutorial (only working in IE at the moment) and a Pacman Sample. FunScript is an open source F# to JavaScript compiler with a Type Provider to TypeScript type definition files which provides typed access to common JavaScript libraries.

If you’re interested in picking up F# I’d recommend trying the F# Koans (where you can pick up the syntax while making a set of tests pass), the online Try F# site, and the F# Tutorial project in Visual Studio.

Hadoop Kickstarter

Next up in the same room Gary Short gave a great introduction to Hadoop and some of the related tools like Pig.

If you’re interested in trying out Hadoop with F# check out the Hadoop Type Provider online on the Try F# site which gives you typed access with intellisense:


WTFP?! Functional Programming and why you should care, with examples in F#

Before lunch Grant Crofton gave a great introduction to functional programming with F# using lots of live code snippets in Visual Studio


Grant also managed to slip some ASCII art into his scripts :)


Lightning talks

Lunch time saw a selection of lightning talks including Ben Nunney on Twillio and Anthony Steele on Feature Folders which emphasised the importance of focusing on the problem domain in your architecture.

The Joy of Wires: an introduction to Netduino

After lunch I popped over to see Iain Angus’s lively talk on Netduino which showed how much fun it can be playing with electronics.

You've learnt the basics of F#: What's next?

The last session of the day for me was Ian Russell’s fun talk which covered a selection of F# Type Providers for typed data access and F# Agents for taming concurrency.

Audience at Ian's talk at DDD North

Ian demonstrated the SQL, CSV, JSON and World Bank type providers all available either bundled with F# or via Nuget. For F# agents he showed a simple chat server that he ran from F# interactive using a local web server.

You can get the samples from Ian’s github repository: DDDNorth F# Presentation

Testing Crap in Web Applications Like ASP.Net MVC

The last pony of the day was spotted in Rob Ashton’s talk/rant which unfortunately I missed as it was on at the same time as Ian’s:


Hanging out at the close with my fellow F#ers, Ian and Grant:



A big thanks to the DDD North team especially Andy Westgarth for hosting a great event!