Previously, I recounted day 1 of my adventure game project. Let’s continue. Day 2 This was a short day. First I observe that it isn’t really necessary for the caller of Game to pass the MessageBus, so I change that.…
Building an adventure game: part 1
I have written before about my early experiences with text adventure games and about how I built a GW-BASIC translator to convert one such example game to C#. It was a fun challenge but was admittedly more of a compiler…
A simple message bus: Java edition
In the previous post, we looked at competing message bus implementations in C# and C++. How about we give Java a try now? Converting to Java syntax and style conventions, the SendOneSubscriber test should look like this: Alas, there is…
A simple message bus
The message bus is a typical pattern to allow loosely coupled software components to communicate, usually in an event-driven manner. Don’t let the enterprise-y description deter you — a simple message bus for a single process scenario can be quite…
Even more performance experiments: queues and threads
Last time, we concluded that a simple producer/consumer pattern using BlockingCollection topped out at around 2200K items per second. But the profiler revealed that the Throttle itself was one major contributor to the total CPU time. Let’s first address this…
More performance experiments: queues and threads
Continuing from our previous performance experiment, I would like to see if there are any easy optimizations to apply to squeeze more throughput out of this producer/consumer queue. One possible angle of attack is to replace the implicit synchronization primitives…
Performance experiments: queues and threads
The producer-consumer problem is one of the greatest hits of computer science. The classic solution involves some sort of queue data structure and an event or two to notify the consumer(s). Let’s take a look at a simple implementation and…
Operation throttle: part 2
Last time, I introduced the topic of fixed operation rates and how one might implement this functionality with ad-hoc code. Today, I will generalize the concept with a simple Throttle library. As I mentioned before, we have to keep track…
Operation throttle: part 1
A while back I discussed some design points relating to fixed concurrency, such as when attempting to ensure a constant number of simultaneous active requests throughout a load test. Today I will jump back to the single-threaded world and discuss…
Find the issue: tainted strings
In a previous post, we introduced a wrapper object for some method parameters: In terms of encapsulation and validation, this was a marked improvement. But there is one critical issue here. Let’s zoom in on the auditMessage parameter. In context,…