← Back to blog

4Developers 2017 -- Back to Reality

conference dsp2017 dotnet csharp azure tpl functional

Originally published on speedydev.pl in 2017 as part of the Daj Się Poznać blogging contest. Republished here for archival purposes.

4Developers 2017

Ahh. Back home, a shame it’s over. Emotions settled, knowledge still indexing — but it was worth it. The entire .NET track was solid, with a side trip thanks to @konradkokosa. Let’s go through it.

Before Party

Driving from Jasło, we were sure the venue would be packed. But we made it in time for free beer for the first 100 — I was scan #43. Four beers later the whole party moved outside. The MC was @j_palka, shouting memorable words of unity: “We drink, we drink, we drink!” Maximum fun.

F# → C# by @bartsokol

Head was still pulsing from the night before, but Bartek’s talk was a perfect warm-up. And despite the lightweight vibe, it wasn’t low-level at all.

The idea: use two generic classes (Result<T> and Optional<T>) and two operations (Map, Bind) to bring F#-style composition into C# and eliminate nested if-chains.

Before (my version of a nick-change endpoint):

public Response ChangeNick(ChangeNickModel model)
{
    try
    {
        string error = UsersManager.ValidModel(model);
        if (string.IsNullOrWhiteSpace(error))
            return new { Error = "Nick already taken", Success = false };

        using (var db = new DbContext())
        {
            var user = UsersManager.GetUserModel(model.nick, db);
            if (user != null)
            {
                if (UsersManager.CheckNickIsFree(model))
                {
                    if (UsersManager.ValidPassword(user.nick, user.pw))
                    {
                        UsersManager.SetNewNick(user.nick, user.newNick);
                        EmailManager.SendNewNick(user);
                        var newUserToStore = UsersManager.GetUser(user.newNick);
                        return new { Success = true, NewUserToStore = newUserToStore };
                    }
                    else return new { Error = "Wrong password", Success = false };
                }
                else return new { Error = "Nick already taken", Success = false };
            }
            else return new { Error = "Unknown user", Success = false };
        }
    }
    catch (Exception)
    {
        return new { Error = "Something went wrong", Success = false };
    }
}

After (Bartek’s approach — note: I may have mangled the details):

public Response ChangeNick(ChangeNickModel model)
{
    return model
        .Map(UsersManager.CreateChangeNickContext)
        .Map(UsersManager.ValidModel)
        .Bind(UsersManager.GetUser)
        .Bind(UsersManager.CheckNickIsFree)
        .Bind(UsersManager.ValidPassword)
        .Bind(UsersManager.SetNewNick)
        .Bind(EmailManager.SendNewNick)
        .Map(context => new { Success = true, NewUserToStore = context.User });
}

More readable? Obviously. Yes, it requires the support classes, and yes you’ll write a context class — but returning to this code after 9 months, you instantly know what’s happening. Bonus: if step 2 fails, the error propagates through all remaining steps without executing them. NO MORE IFS.

Slides: speakerdeck.com/bartsokol

TPL DataFlow by @maklipsa

I thought I knew TPL. I did not.

Szymon showed how to chain Tasks into an ordered, structured dataflow pipeline using TPL DataFlow blocks. Each block can have its own queue, its own degree of parallelism, its own bounded capacity — and crucially, you can funnel everything back down to a single-threaded block for non-thread-safe operations like raw SQL writes. Beautiful architecture.

Repo: github.com/maklipsa/donetconfpl_tpldataflow

ETW & Memento Mori by @konradkokosa

I could listen to Konrad for hours. Two talks:

ETW (Event Tracing for Windows): Has existed forever, somehow never replaced file logging — even though it adds zero production overhead and you can toggle logging on/off without stopping any service. It’s the engine behind Windows Event Log and Resource Monitor. We already use it every day and don’t realize it.

Memory & the L3 Cache: The classic principle — “If you don’t know how it works, you don’t know what’s happening.” Konrad walked through concrete examples of how L3 cache behavior can silently destroy performance in ways that are invisible at the code level. Mind-expanding.

Blogs worth following: tooslowexception.com and blog.kokosa.net

Serverless: Azure vs AWS by @gutek

Apparently it’s a tradition for Gutek to have a live typeof(Exception) moment — he announced it upfront so no surprises. Good comparison between Azure Functions and AWS Lambda. Bottom line: try it, it’s free: azure.microsoft.com/services/functions

The Only Thing That Matters by @Scooletz

First time seeing Szymon live. I need to catch this talk again at rzemioslo.it in Rzeszów — still processing it.


Bottom line: 4Developers is highly recommended. Even more recommended: follow these speakers. Their conference talks are a shot of energy — their blogs are where the deep knowledge lives.

Now, back to real life.