A conceptual implementation of the async/await State Machine …
Author: Vasil Kosturski
The async/await State Machine can be easily understood with a comprehensive workflow diagram that models the program flow and the state transitions. Such a higher-level representation is a mandatory step before diving into the implementation details. Let’s see how that looks! …
The Awaitable Pattern plays a vital role in the whole async/await workflow behind the scenes. The best way to understand how it works is to build your own awaitable type. Let’s see how! …
How are closures implemented in C#? How do they “capture” environment variables from different scopes? The idea is simple, but it can have complex implications. That’s why it’s essential to understand the concept in detail. Let’s get some practical intuition inspecting the IL code as a source of truth. …
The common understanding of Polymorphism takes into account only the runtime type of the “receiving” object. That’s the implementation in most languages. But what if we also consider the method arguments as part of the runtime method resolution logic? That’s the idea behind “Multiple Dispatch.” …
The "Clash of Styles" series compare OOP and FP from a very practical standpoint. Modern general-purpose languages support both of the paradigms. Being conscious of that and choosing the right style for your use case is vital for ending up with an elegant and maintainable system. …
The Visitor Pattern addresses a fundamental limitation of Object-Oriented modeling. In OOP, adding a new “operation” is tricky. You have to modify the existing classes, which is error-prone and violates OCP. Let’s look beyond the standard UML diagram and see how the Visitor solves this problem. …
OOP is established to the point that we sometimes follow absurdly complicated “idiomatic” patterns(tricks). One example is the Double Dispatch technique, which is a quite puzzling chain of polymorphic calls. Let’s see it in action and compare it to a quite elegant Functional alternative. …
FP or OOP is not a binary choice. You can have a healthy mix of the two in your program. Whatever paradigm you select to be central to your design, there will be cases when the other style fits better. Let’s start exploring this in Part #4 of the Clash of Styles series. …
The choice between FP and OOP can directly affect the maintainability characteristics of your program. What is “easy” to add in OOP is “hard” in FP and vice versa. How can that be presented in terms of the Open-Closed Principle? What are some practical examples? Explore those topics in Part #3 of the Clash of Styles series. …