πŸ“£Postmark has been acquired by ActiveCampaign
x

Open Source Friday: Metrics and Bantam

It's not often that you see a presentation or a code repository that blows you away. That's why this past month was a stand-out. I found two incredibly useful projects floating in the Java/Scala community, that compelled me to write idiomatic ports for C#.

Bantam

Robert Nystrom wrote an interesting article about the benefits of Pratt parsing for quickly breaking down expressions into usable code. As a reference, Douglas Crockford's JSLint uses this approach to parse Javascript in order to validate it. When you're rocking Pratt, you never go back. I ported Robert's Pratt parser example as well as the tiny Bantam language that demonstrates its use. If you really want to be blown away, check out Robert's Magpie language for the JVM; it is both dynamic and static, has multiple inheritance, multimethods, and still manages to stay clean and expressive.

You can get the Pratt code here or add it directly in Visual Studio from NuGet.

Metrics

Alex tipped me off to an eye-opening CodeConf presentation by Coda Hale of Yammer fame on making better business decisions by instrumenting code, and he provided a Scala library called 'metrics' to do it. The last slide read "Please build this", so I did. The code itself is an interesting use of the new .NET 4.0 concurrent types, as well as a few borrowed concepts from Java like AtomicLong and TimeUnit. It was a fun and challenging project to put together for the CLR, and I hope you will join me in making it a useful contribution to .NET. We already instrument quite a bit of our code at Wildbit, but I'm looking forward to streamlining everything through metrics, and using HTTP-based reporting to make real-time visualizations for the rest of the team. Mainly, I am happy to ditch Performance Counters in favor of a lean and mean interface, though some of them are still in play behind the scenes.

You can get the Metrics code here or or add it directly in Visual Studio from NuGet.

Things I learned (or re-learned) during this retro Java port-a-thon include:

  • The closest you can get to magic in this industry is running a data-driven business.
  • There are no dead languages, only dead people. Cool stuff is happening everywhere.
  • The JVM is a lot more flexible, when it comes to runtime introspection, than the CLR.
  • While C# extension method usage can quickly border on the obnoxious, adding them to enums is the knees.