Some things never change… and some things do. The year has changed – to 2022 but .NET R&D Digest is still here, and this is not going to change 🙂
This issues includes bits of computer science, software development, distributed systems, .NET, Windows, diagnostics, COM and low level performance.
Enjoy your reading!
- Exception Handling in CLU (by Barbara Liskov and Alan Snyder)
Nowadays exceptions are natural part of modern programming languages. The interesting fact is, implementation of exception and exception handlers is very similar in all these languages. In this paper (1979) by Barbara Liskov and Alan Snyder, you can read about exception handling mechanics in CLU programming language. It is fascinating to see ideas mentioned in this paper alive in modern programming languages (including C#). Recommended to read.
P.S. Unfortunately the quality of PDF is not the best but the content definitely worth to read.
- Two Phase Commit (by Unmesh Joshi)
Making atomic changes in a sequential application is easy. Making it in a parallel (or even multi-thread) application is much harder but still manageable. Making it in a distributed application is very hard and doing it right might seems almost impossible without correct patterns. In this post Unmesh Joshi describes one of such patterns — a two way commit, which is all about what you need to do, what you need to remember and how all these together works and produces the right result. This post is part of the huge and amazing series which I have already mentioned and it is a pleasure to mention it once more – Patterns of Distributed Systems.
- Critical Aggregator, Legacy Mimic and Divert the Flow (by Ian Cartwright, Rob Horn and James Lewis)
I have already mentioned (September, 21) an interesting series (or a huge post) by Ian Cartwright, Rob Horn and James Lewis and I am not going to repeat myself about the main article. However these three patterns are significant addition to the main narrative as they describe real life structures which you might see in long living software or you can use to replace a legacy component with a new one.
- You Can’t Buy Integration (by Brandon Byars)
Wiring systems together isn’t simple. When done right it provides value, otherwise is causes a lot of pain and struggle. However, what does it mean to “do it right”? In this post Brandon Byars goes through this rough topic describing an idea of how can you look at integration as strategic, not tactical decision and where it is better to build vs buy. A very interesting post, recommend to read.
- Paxos (by Unmesh Joshi)
Having an agreement on something is hard even when everyone is in the same room. Now imagine, agreeing on value between multiple servers in a situations when some of them might have a delay or even go offline. In this post Unmesh Joshi describes the protocol invented in ancient times to support parliament (if you are interested in the backstory you can read the original paper by Leslie Lamport, which is interesting but not can be complex to read) agreement on single decree (in case of software — a single value). As well as two phase commit this one is a continuation of Patterns of Distributed Systems series.
- Customising generated code with marker attributes
Finding a type declaration’s namespace and type hierarchy
Saving source generator output in source control (by Andrew Lock)
There are more in source generators than meet the eye. In these posts Andrew Lock continues to describe how to write source generators. In particular, he demonstrates how to improve usability of the generator by improving customisation of generated code by passing arguments into marker attribute and make sure the code is generated in right namespace and later, can be reviewed as part of the PR. All posts are detailed and include code samples.
- Minimal APIs in .NET 6 — A Complete Guide (Beginners + Advanced) (by Hammad Abbasi)
At the first glance, Minimal API introduced in .NET 6 might seem like a «syntactic sugar» for writing tiny apps. However, it is not 100% true because you can write real services with this stuff. In this post Hammad Abbasi demonstrates how you can use Minimal API to write a service which exposes CRUD endpoints, Open API documentation (using swagger) and implements authorisation through JWT token. And all of this is done in a minimum lines of code. The post is very detailed. Every step is covered by screenshots and code samples (the final source code is available on GitHub).
- Strings and the CLR – a Special Relationship (by Matt Warren)
Everyone knows — in .NET, strings are special, mostly because one of the first things developers learn is — strings are immutable. However, it turns out. Immutability isn’t the major thing which makes strings so special. In this post Matt Warren describes a set of interesting optimisations done in CLR specifically for strings (including JIT tricks, allocations and access) to ensure best possible performance. The post is a bit old (2016) but not outdated 🙂
- .NET’s Cryptographic One-Shots (by Kevin Jones)
Doing security right is tough. Even encrypting something could be problematic if you need to think about memory consumption, performance or streaming. That is why having simple to use API is critical. In this post Kevin Jones does an overview of new cryptographic API introduced in .NET 6, which significantly improve development experience and offer better performance. Also saving us from writing “our own cryptography”.
- 20 New APIs in .NET 6 (by Oleg Kyrylchuk)
There are so many new things introduced in .NET 6, that it is simply hard to review them all at once. In this post Oleg Kyrylchuk describes (with code samples) 20 new API added in .NET 6, including security, math and reflection. The post is easy to follow and, what is important, it is simple to try all these things yourself.
- Creating a simple COM+ component in C++ and COM+ revisited (by Sebastian Solnica)
Have you missed COM? Or maybe you want to implement a COM+ object yourself? If some of these is true then you will definitely find these two posts very handy. In these posts Sebastian Solnica demonstrates how you can write a simplest COM+ component and register it manually. Then, the example is extended to demonstrate how you can utilise all the goodies of COM+ infrastructure and build a better version. In addition to development guidelines, these posts provide guidance to inspect and debug COM+ components using WinDbg.
- Concurrency Analyzers (by Sergey Teplyakov)
Understanding what is happened in concurrent application might be confusing. These Concurrency Analyzers by Sergey Teplyakov are designed to get a simple but useful analysis of a dump file or a running process, like an overview of all the threads with their unique stack traces, the state of the thread pool or task-to-task dependency diagram.
Watch & Learn
- Performance Ninja Class (by Denis Bakhvalov)
If you are interesting in low-level performance (even if you aren’t going to use it at work) and want to know what you can do about «false sharing» or «vectorisation» or perhaps you want to get at least high level understand of what these things are, then this performance ninja labs is what you need. All these labs are about practice. A short introduction video — and code, tests and more code. These classes are led by Denis Bakhvalov an author of Performance analysis and tuning on modern CPUs book (which is now open-source) and are of real fun.