.NET South East November 2017 Meetup With guest Michael Newton

Last night we held our November .NET South East meetup at Madgex HQ with the amazing Michael Newton speaking. Here’s a brief summary…

Intro and news

At 7pm I opened the evening with my introduction, including thanking our fantastic sponsors. I then went on to discuss some of the news items I had gathered. I was a bit short on details for the item’s I’d picked due to being out sick (cough) for the week prior to the event. I managed to put together notes on two headlines an hour or two before the event started.

Visual Studio Live Share

This first item was announced at the recent Microsoft Connect() event in New York. It’s an early announcement of a new feature being worked on for Visual Studio 2017 and VS Code.

The idea with Live Share is that teams of developers will be able to interactively collaborate on code directly from their editor/IDE. A developer can start a shared session on their machine which will generate a link that provides access to a shared, private workspace. They can send this link to their collaborators who will then be able to connect and see the code for your workspace. There is no need to explicitly clone the code or install any dependencies.

Once connected your partner will be able to view your code and even see where your cursor is. You can select code and that will reflect in your partners editor. Any changes being made will be visible to both parties.

Taking it a step further, you can even share a debug session that your partner can participate with. Your partner will be attached and will see a live stack trace, locals values and can even hover over variables to see their current value.

This looks like a really exciting way to enable remote pair programming and perhaps as a way for people to assist contributors of open source projects for example. No release date has been given but it’s certainly one to watch.

https://code.visualstudio.com/blogs/2017/11/15/live-share

https://channel9.msdn.com/Events/Connect/T254

Nullable Reference Types in C# 8.0

This item came from a recent MSDN blog post stating that a trial version of the planned C# 8.0 feature to provide non-nullable reference types is now available. Microsoft want to capture feedback on the current proposed design of this language feature to help finalise on something that works well for the developer community.

The ideas being proposed are to add the concept of non-nullable reference types to the language with a view to removing bugs and making it easier to express intent in the code. Nulls should not exist except in cases where the domain design makes them reasonable.

In C# 8.0 the plan is to introduce this and as a result, all current reference types will be assumed to be non-nullable as the default. Any cases where a reference type is assigned a null will then be marked as warnings by the compiler.

To enable developers to use nullable reference types, we’ll also be able to add a question mark (?) as we can currently with value types to identify any reference types which will then be considered nullable. In those cases it will likely result in many warnings from the compiler where null checks are missing before dereferencing those objects. This is expected to help catch and resolve potential bugs that could result in NullReferenceExceptions being thrown in your code.

The compiler warnings can be disabled if you do not which to be warned of these issues and the existing IL code produced by the compiler will not change.

You can read more about this announcement here: https://blogs.msdn.microsoft.com/dotnet/2017/11/15/nullable-reference-types-in-csharp/

Michael Newton – Making Distributed Systems in .NET Easier

Michael Newton presenting at .NET South East

This month we were joined by local consultant and trainer, Michael Newton. Michael started by talking a little about good API design. He explored a few examples where the API design is critical to providing a clear way to work with a library. Just as importantly these APIs need to aim to help protect the user from making bad / incorrect decisions.

He cited examples of the NodaTime API which has a quite complex API surface but is also tackling a quite complex problem. However it does ensure that it’s hard to shoot yourself in the foot as one example showed. In that case you’d have to ignore the fact that you had made calls to 3 methods you did not understand in order to get things wrong. This API therefore forces a reasonable level of understanding of the problem before you can use it. Once you do have that understanding, it makes sense and gives fine control of the intent you have when working with the complexities of date and time across time zones.

Michael went on to show us EasyNetQ, a simple .NET library for working with RabbitMQ. This library was originally conceived by Mike Hadlow when he was working for 15Below in Brighton. The original .NET library from RabbitMq was extremely complex and required lots of knowledge before you could consume it. The EasyNetQ library sits on top of that and abstracts away the complexity with a much more simplified API. This comes at the cost of some functionality, but for the majority of general use cases provides everything people need. It favours simplicity over a complex feature set.

EasyNetQ worked well for general scenarios but as the need for more complex workflows began to appear it was clear that more was needed. This led to the development of an EasyNetQProcessManager library by Michael while working for 15Below. This came after Michael read Enterprise Integration Patterns by Gregor Hohpe and‎ Bobby Woolf. Michael set about designing a library to sit over EasyNetQ.

November audience for Michael Newton at .NET South East

It was interesting to hear these thoughts and to set the scene for next section of the talk where Michael shared his alpha code for a new version of a process manager called RouteMaster. Here Michael is working to develop a slick API that helps protect the user of the library from making mistakes, where possible making use of the .NET type system to do so. It’s very functional in nature and the main code is written in F# with a C# API having been completed in the afternoon prior to this meetup (so very, very alpha)! This library aims to make developing distributed workflows a relatively simple affair.

Along the way Michael shared some useful tools and info. For example he showed us briefly that he uses a Docker image for a product called adminer to provide a management UI over the underlying Postgres database. I’ll be checking this one out for sure. Another piece of advice was using FsCheck for property based testing and how this can be a great way to fully test your code using many randomly generated inputs.

It was a really interesting evening so a huge thanks to Michael for presenting his content to us.

Prize Draws

With the end of the evening closing in, before heading off to the pub we drew the winners of the prizes from our fantastic sponsors for the event. The prizes we had to offer were:

JetBrains – One year individual subscription to any single JetBrains Toolbox product

Manning – Free eBook

elmah.io – 6 month Small Business license

PostSharp – License to PostSharp

Again I used the WPF app created by Dan Clarke, who organises the .NET Oxford meetup. This time however I trialed pre-drawing names just before the event started to speed up the process of prize winner selection. The rules as with the last event were:

a) names are added from the RSVP list (as at about 1-2 hours before the event)
b) if the name drawn is not in attendance, we redraw.

Next events

We have some great speakers lined up for 2018. Our December meetup is currently under consideration. Our planned speaker has unfortunately had to withdraw so I’ll be assessing fall-back options.

For January I am working on a plan which is a long shot but will be announced if I can align a few puzzle pieces in time.

February 2018 – Ian Cooper
https://www.meetup.com/dotnetsoutheast/events/244109542/

March 2018 – Joe Stead
https://www.meetup.com/dotnetsoutheast/events/244109560/

April 2018 – Jon Smith
https://www.meetup.com/dotnetsoutheast/events/245021956/

Links

http://mavnn.co.uk/
https://nodatime.org/
http://easynetq.com/
http://www.enterpriseintegrationpatterns.com/
https://hub.docker.com/_/adminer/
https://github.com/fscheck/FsCheck
https://blog.mavnn.co.uk/easynetq-process-management/
https://github.com/RouteMasterIntegration/RouteMaster