An Rx Event Aggregator in C#

I have a web project that is made up of several modules, each of which generates DDD domain events. Right now my C# project is small and divided into well-defined modules which run in a single process, so using a message queue like Kafka is a bit of overkill. But as the program scales, I may break these modules out and run them as full microservices in their own processes. At that point, I will need to use a real messaging system like Kafka or the Azure Event Hub. [Read More]

TypeScript and React, Part 5

HOC Example: Access the Query String

This is part of this series of blog posts introducing TypeScript and React. Here’s Part 1. React-router 4 removed the query string parsing feature that was present in past versions. This is a good example of where a React higher order control would make a good substitute. Instead of forcing Components to take dependencies on both the location and a query-string parser, making things hard to test and refactor, it’d be much easier to create a wrapper that does the boring parsing work for you and DRYs out your code. [Read More]

TypeScript and React, Part 4

React Higher Order Components in TypeScript

This is part of this series of blog posts introducing TypeScript and React. Here’s Part 1. Edit, Feb 26, 2019: Nobody on the team liked this approach as much as Render Props, so we’ve switched to that. Our experience was that HOCs can create mind-bending types. React’s Higher Order Component pattern is a technique to help developers design better components and component interactions. Refactoring out cross-cutting concerns from a complex component with HOCs touches on at least three or four of the SOLID principles, but creating a cohesive design can be difficult without proper typing. [Read More]

TypeScript and React, Part 3

Stateless React Components in TypeScript

This is part of this series of blog posts introducing TypeScript and React. Here’s Part 1. TypeScript’s inferred typing gives you some flexibility on how you declare “Stateless Function Components”. Here are some examples. Simple: If you are wondering what the extra curly braces are for in the parameters of the three examples, myvar and onClick are extracted from props via destructuring assignment. This next one is a little strange, because the types are declared inline. [Read More]

TypeScript and React, Part 1

TypeScript with React: is it worth it? I started using them together a few months ago with some hesitation. I wanted the long-term benefits that strong typing brings to a larger code-base, but I always hesitate before wandering off of the main path. When it comes to mainstream software development, it’s usually best to stick with the group rather than struggling to survive in the woods on your own. So, on balance, do you gain more than you lose? [Read More]

Debugging React Native/Android with IntelliJ on Windows

Facebook’s developers are mostly Apple People, so they don’t waste many mental cycles fretting over React-Native developers who are on other platforms. I don’t like straying too much from the main path when it comes to deciding on which tools to use, so I wondered if it was advisable—or even possible—to debug React Native at all on Windows. Google Search didn’t reveal much information about what Windows React-Native developers do when their app crashes with no error message. [Read More]

JWT Tokens, SignalR and Single Page Applications

A new-ish alternative to session-based cookies that’s well-suited to single page apps is token-based authentication. There are many SaaS services such as Auth0, Stormpath and Login Radius that are pretty easy to set up. If you can use one of those in your organization, you should—it will save you a lot of time. But if you’re stuck hosting your data yourself you will need to look at a product like IdentityServer4 or ForgeRock. [Read More]

SignalR and Akka.NET on DotNet Core

Note: this post is out-of-date—Akka.NET now runs on Dotnet Core Currently there is no DotNet Core runtime support for Akka.NET or SignalR. I was about resign myself to the idea of waiting for another year or so to try them out together in the new environment, but I randomly came across a blog that mentions that you can run non-core libraries on ASP.Net Core — if you target . [Read More]