At this point we have a Windows build and remote Linux build working from Windows in the Visual Studio IDE. This is all good and it’s hard to beat VS in terms of productivity while actively developing the code. However,…
Cross-platform without complexity: remote Linux
Previously, we showed how to enable the Visual Studio IDE to work with an ostensibly cross-platform CMake project. Today we will prove that the project indeed can work on a non-Windows platform — at least as much as is possible…
Cross-platform without complexity: VS IDE
Let’s say you want to start a modern C++ project. However, you have some requirements in mind that may be hard to achieve. First, the project should support development in the Visual Studio IDE but also provide a simple command…
Switch expression performance: part 2
Previously we looked at the performance of simple switch statements and expressions. Today we will consider switch expressions with when clauses. This example shows a simple letter grade calculator as might be defined for a US high school: The first…
Switch expression performance: part 1
Being the good multi-paradigm language that it is, C# has adopted features from across the programming spectrum. One recent addition of the functional programming variety is pattern matching, first arriving in C# 7.0 with enhancements in C# 8.0. The latter…
Null operator performance
The null-conditional (AKA “Elvis”) operator and null-coalescing operators were introduced in C# 6.0 and C# 2.0 respectively. They’ve been with us for years and help make our code more concise. But have you ever wondered about their effect on performance,…
Watching a directory: debouncing
Over the last few posts, we have created a relatively full-featured DirectoryWatcher library, but it has one glaring omission. To demonstrate, let’s review the output of the sample program which randomly modifies the files it is watching: For many types…
Watching a directory: composability
Last time, I mentioned that our DirectoryTreeWatcher code demonstrates composition but not composability. To see what I mean, imagine that you wanted to add logging so you could track whenever a subscription is created or destroyed. A nice separation-of-concerns way…
Watching a directory: composition and thread-safety
We have a testable DirectoryWatcher; now what? Given that the DirectoryWatcher can only watch files in a single directory, we can extend this to a whole directory tree. Perhaps the best way to achieve this is with composition (in the…
Watching a directory: testability
Previously, I introduced DirectoryWatcher but it was woefully untestable. Tight coupling to the file system is something that would be at odds with a microtesting practice as described by “Geepaw” Hill. I agree with him and nearly always avoid extraneous…