WriteAsync .NET

Testing, coding, in that order.

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…

By Brian Rogers | 21 February, 2020 | concurrency, design, tdd | No Comments |
Read more

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…

By Brian Rogers | 20 February, 2020 | design | No Comments |
Read more

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…

By Brian Rogers | 19 February, 2020 | design, tdd | 1 Comment |
Read more

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…

By Brian Rogers | 11 February, 2020 | concurrency, design, tdd | 2 Comments |
Read more

Watching a directory: basic intro

Let’s say we want to write a .NET Core class that watches for file changes in a single directory. The implementation should only notify for explicitly subscribed files. For example, if DIR is being watched and DIR\file1.txt is subscribed, we…

By Brian Rogers | 10 February, 2020 | concurrency, design | 1 Comment |
Read more

Let’s do DHCP: more diagnostic events

While thinking about how to combine latency measurement with diagnostic events in the DHCP server, I noticed a particular gap in the design. Right now the event interfaces look like this: However, if we want to incorporate latency metrics, we…

By Brian Rogers | 3 February, 2020 | design, diagnostics | No Comments |
Read more

Low-latency latency measurement

Measuring latency is easy with .NET. Just use a Stopwatch! This is certainly the most commonly recommended way to measure operational timings. But is it the fastest way? It seems almost absurd to ask for a low-latency latency measurement, but…

By Brian Rogers | 28 January, 2020 | diagnostics, performance | 1 Comment |
Read more

Let’s do DHCP: diagnostic events

There is always something new to do with the DHCP server sample. Today we will look at how to add diagnostic events. After all, any good server technology intended to run in real world production scenarios needs observability. One approach…

By Brian Rogers | 27 January, 2020 | design, diagnostics, performance, tdd | No Comments |
Read more

Let’s do DHCP: fuzzing

The DHCP server project is still alive and well. It’s definitely sample code, for demonstration purposes only, and other disclaimers. Even so, it is a technology that processes arbitrary network data, and we ought to worry about malicious input. To…

By Brian Rogers | 21 January, 2020 | security, testing | No Comments |
Read more

A faster TryFormat

As part of my ongoing DHCP adventure, I needed to start thinking about string formatting for some of the core data types like MacAddress. After all, these values are likely to make their way into a trace file eventually and…

By Brian Rogers | 13 January, 2020 | performance | No Comments |
Read more
  • « Previous
  • Next »
Copyright ©2025 WriteAsync .NET | Theme by: Theme Horse | Powered by: WordPress