.NET R&D Digest (July, 2020)

The new issue of .NET R&D Digest (July, 2020) is here (yeah, it is that simple this time).

This issue includes bits of computer science (even a link to a paper!), software development and a few learning resources which you can use to learn something new! Ah, yeah, and .NET of course 😊

Enjoy and have a great weekend!

Computer Science

  1. Faster remainders when the divisor is a constant: beating compilers and libdivide (by Daniel Lemire)
    It is quite well-known that in mathematics you can do a lot of interesting things 🙂 probably, one of the most obvious examples is an ability to replace division with multiplication. In real life, this doesn’t sound quite useful, however, in computers, division is more expensive than multiplication, so such “replacement” can be quite beneficial. That is why compilers and libraries try to use this optimization whenever possible (division by constant, division by power of 2, …, etc.). In this post Daniel Lemire describes the general case of how to replace division with multiplication for signed and unsigned integers. The post doesn’t include complex math, which makes it very easy to read and get the general idea but if you need more details, there is a corresponding paper 🙂

Software Development

  1. A Guide to Threat Modelling for Developers (by Jim Gumbley)
    In modern software development world security is everyone’s responsibility. However, when it comes to real project it is easier to say than implement. One of the main reasons behind that is a lack of understanding of how to make everyone involved in the project closer to security questions. In this post Jim Gumbley shares a detailed guide about how you can start doing “Threat modeling sessions” and bring security closer to everyone in your team and project in overall. This guide addresses the questions of who should be included, how these sessions should be conducted and what should be the outcome. In addition to detailed descriptions every section is covered by a realistic example.
  2. The Many Meanings of Event-Driven Architecture (by Martin Fowler)
    When it comes to architecture discussion it is always important to ensure everyone who is involved in the conversation has the same understanding of what this or this architecture pattern and term means. This may sound strange at the first glance, but you can easily experience this by trying to talk with a colleague about SOA or REST. In this video (from a conference) Martin Fowler talks about event-driven architecture. Well, about several things which are usually meant when you speak about event-driven architecture. Besides presenting a different architectures Martin also talks about their pros, cons and reasons to use or not to use each of them.

Windows

  1. Creating Registry Links (by Pavel Yosifovich)
    Windows Registry is very well-known. I think, almost every developer at least once in their life has “tweaked it for good” 🙂 Many of us, who have been in desktop development probably used it to store application settings or read different system values to perform correct application initialization, enable or disable features. But have you ever heard about registry link? In this post Pavel Yosifovich explains what registry links are and how you can create or delete them using… well, a bit of magic, a custom tool and some Windows API.

Visual Studio

  1. How Do I Think About Async Code?!, How Do I Debug Async Code in Visual Studio? and Debugging Async Code: Parallel Stacks for Tasks (by Leslie Richardson)
    In last few years asynchronous programming became so popular that it looks like everyone knows about it and knows how to use it. However, it is not entirely true. There are many developers who had no chance to use it or have a very little experience with it. In this case, how to get started? – Just read some posts 🙂 In these posts Leslie Richardson provides a very intuitive and easy to get explanation of how you can think about asynchronous code and when you wrote it – how you can debug it.
  2. Visual Studio Tips and Tricks (by Gérald Barré)
    Visual Studio is very powerful. However, with this power also comes the complexity. Visual Studio has so many functions and tricks inside, so it is almost impossible to remember them all (and sometimes, it can do things we could never think of). In this series Gérald Barré shares multiple Visual Studio gems you can utilize in everyday development.

.NET

  1. Performance Improvements in .NET 5 (by Stephen Toub)
    Performance improvements can come in different forms: in a form of new API or components you can now use to efficiently solve the “slow” task, in form of support of “new and shiny” technology or protocol that you can now incorporate in your application or (I my opinion this is the best form) in form of runtime / framework improvement which simply, make you application faster at zero cost (yeah, you still has to install new framework and recompile the app, but this is almost no costs). In this huge post Stephen Toub describes a numerous, stunning performance improvement we could expect to ship with the .NET 5 release. Most of these improvements are related to runtime (GC, JIT) and framework libraries (the “third form”) but there are also new tools (i.e. the linker) and new components which will help us make our apps better.
  2. The danger of async/await and .Result in one picture (by Konrad Kokosa)
    As .NET developer you’ve probably heard about “sync over async” and how bad it is, about how it can cause a deadlock. You’ve probably saw some code sample which demonstrate this “awful” thing in action… and most probably read the explanation but what about diagrams? In this post Konrad Kokosa illustrates the whole danger of “sync over async” in two pictures, both “worth a thousand words“.
  3. Customizing the ASP.NET Core default UI without editing the PageModels (by Andrew Lock)
    Most of the software we write are unique, however, they are also have a lot in common. Such common things are usually separated in reusable components which we use from project to project. Usually, there components are well-done and implemented with latest technologies and best practices. However, usually these components are quite hard to customize. In this post Andrew Lock describes a way to customize one of such reusable pieces – ASP.NET Core Identity, in particular, he explains how you can customize default UI without having to take ownership of code behind.
  4. Building End-to-End Diagnostics and Tracing (by Jimmy Bogard)
    Since microservices emerged into masses the amount of distributed applications increased dramatically. However, with all the benefits, distribution has its own costs – and one of the major one is overall system and diagnostics complexity. In this series Jimmy Bogard demonstrates how you can introduce diagnostics and tracing into .NET Core based distributed application. The demonstrated solution is build using NServiceBus, OpenTelemetry SDK for .NET and standard .NET Activity API. The series isn’t over, so subscribe keep looking for the updates.
  5. await false & await true (by Konrad Kokosa)
    async-await keywords are very close to Tasks. A lot of guidelines you may find will say something like: “In order to make method awaitable it should return Task or Task<T>“. Well, some of them may also include “ValueTask“. But you aren’t limited to these types. In this post Konrad Kokosa demonstrates (just for fun, please do not repeat in real projects) how you can make bool.. well, awaitable 🙂 If you are interesting in how all this machinery works, I recommend you read this series by Sergey Tepliakov.
  6. Setting global authorization policies using the DefaultPolicy and the FallbackPolicy in ASP.NET Core 3.x (by Andrew Lock)
    Applications we write are tend to evolve. We introduce new features, new design. We improve or replace existing workflows. We do this to make sure our users benefit the most. Exactly the same evolution process also applies to the frameworks. In this post Andrew Lock describes how you can update your authorization configuration code to benefit from new endpoint based authorization mechanism introduced in ASP.NET Core 3.x.

Learning

  1. Machine Learning Path (by Ahmad Mustafa Anis)
    Days ago machine learning wasn’t about day to day software development and was mostly a field for computer scientists and enthusiasts. However, things change and now you can find machine learning in quite ordinary products. But one thing still differs ML from learning one more development technology – you need math, which makes it harder to start. Besides the above link you will find a list of courses and books, composed by Ahmad Mustafa Anis, which will help you to get started with machine learning from scratch.
  2. .NET Garbage Collection with Midnight (Part 1, Part 2) (by Maoni Stephens)
    Have you ever ask yourself “What GC does on process initialization?”. If yes, then you should know – you are not alone. Recently, Midnight asked Maoni the same question 🙂 In these short clips Maoni Stephens provides an information dense explanations of what GC does on process initialization and why every generation starts with an empty object. Currently there are only two clips, however, I hope there will be more. At meantime, you can find a lot about GC in “the book“.
  3. Blazor University (by Peter Morris)
    When starting with a new technology it is critical to learn not only a practical aspect of how to do a particular thing you need right now but also it is important to get understanding of how technology works and what it can do in general. The second very important point it to find a learning path. Of course it is always possible to learn on case by cases basis but this usually leaves you with shattered knowledge which you have to glue yourself later. This site by Peter Morris provides addresses exactly these things when it comes to learning Blazor. The site isn’t complete, there are still topics to cover, however, it is a very good place to start with Blazor. Besides decent explanation it also includes source codes for many samples.

History


  • 2020/08/31 – Added authors information in italic right after the post / article title.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s