WriteAsync .NET

Testing, coding, in that order.

Find the issue: unbounded growth

Last time, we implemented a MyCommands class to keep track of commands invoked by the MyCommandsController. Here is the MyCommands as we left it: What possible issues do we have here? The first one that comes to mind is the…

By Brian Rogers | 7 October, 2018 | design, tdd | No Comments |
Read more

Find the issue: long requests

In the previous post, I discussed a few design changes to a sample Web API controller to fix up the parameters. Here is where we ended up: Of course, we’re not done yet. I ask again: can you find the…

By Brian Rogers | 30 September, 2018 | async, design | 1 Comment |
Read more

Find the issue: parameter types

Can you find the issue in this ASP.NET Web API code snippet? I admit that this is sort of a trick question because there is certainly more than one issue. But let’s start today with the Post() method signature. Judging…

By Brian Rogers | 23 September, 2018 | design | 2 Comments |
Read more

The right tool for the job

In my earlier days of designing and coding .NET projects, I would strive to build pure C# implementations, no matter the scenario. For example, if my .NET app needed to capture and log standard output from an external process, I…

By Brian Rogers | 16 September, 2018 | design | 1 Comment |
Read more

Exact square roots (continued)

Last week, I introduced a data structure kata involving exact square roots. At the time of that writing, I had implemented a RootTerm struct which could represent real and imaginary square roots. Today we’ll pick up where we left off…

By Brian Rogers | 9 September, 2018 | design, math, tdd | No Comments |
Read more

Data structure kata: exact square roots

Many programming courses introduce the concept of data structures with complex numbers as a motivating

By Brian Rogers | 2 September, 2018 | design, math, tdd | 1 Comment |
Read more

Microbenchmarks with BenchmarkDotNet

They say that the fastest prime number algorithm for small inputs (up to 216) is a lookup table. But this got me thinking — would it be faster to use HashSet.Contains or a List.BinarySearch? The answer to this type of…

By Brian Rogers | 26 August, 2018 | performance | 2 Comments |
Read more

Edge cases: overflow

Consider this (rather suboptimal) prime factorization algorithm: You can run it like so and see that it returns the proper factorization for a variety of Int32 values: In fact, it works properly for any possible Int32 — except one very…

By Brian Rogers | 19 August, 2018 | testing | No Comments |
Read more

The binary coverage hypothesis

Everyone loves to hate code coverage. But I have started to notice one interesting consequence of using coverage metrics that I refer to as the binary coverage hypothesis: A class should either have full unit test coverage or none at…

By Brian Rogers | 12 August, 2018 | design, tdd, testing | No Comments |
Read more

Interface anti-patterns: overload overload

Continuing on the theme of interface anti-patterns, let’s talk about overloaded methods. Specifically, let’s talk about overloaded method overload. You’ve probably seen it before. You need to implement an interface and find that there are multiple overloads of each method.…

By Brian Rogers | 5 August, 2018 | design | No Comments |
Read more
  • « Previous
  • Next »
Copyright ©2025 WriteAsync .NET | Theme by: Theme Horse | Powered by: WordPress