-
December 14, 2011
Static method patterns When programming with statically-typed OO languages we all have the temptation sooner or later to implement some functionality using static methods. Static methods are “class” methods, which are called on the data types themselves rather than on an instance of a class. In Microsoft .NET, Static methods are shared among all code that exists within a given…
-
December 14, 2011
When to write a library I’ve been meaning to write this post for a while. There have been a lot of instances in my work where the debate comes up about when to start abstracting code. There inevitably comes a time where a bit of code gets copied and tweaked enough times that it screams out to be put into…
-
December 5, 2011
Full-stack programming case study There has been a lot of talk about “full-stack” programmers in the tech press recently. Along with the concept of “devops” this is an important distinction to make between pure coders and people who are capable of systems thinking. Generally speaking, in addition to a deep understanding of their core programming skills, they understand other parts…
-
December 5, 2011
Why compiled regular expressions are awesome I was doing a little code spelunking recently and found this gem of a macro in the University of Washington IMAP server code. It does some validation of various date formats in email headers. The code was written this way for performance, but I wonder if regexps in modern languages would be up to…
-
November 1, 2011
Creating softened CSS callouts Although I haven’t had much time to post on my blog, I’ve been doing a few things with CSS lately. One question someone asked me recently was how to get a nice soft callout triangle done using just CSS. I came up with three different basic solutions to this: Duplicate the element, changing the color and…
-
July 4, 2011
Parser jockeying – writing little languages in OMeta Writing domain-specific languages is something that I’ve been interested in for quite some time. I’ve done a few internal DSLs for various projects in the past including CrmQuery and one XML-based application definition language that is sadly not open-source. As nice as internal DSLs are, limitations of the host language are always…
-
June 23, 2011
Human-writable RDF I’ve done a little bit with RDF in some past projects where I used RDF entailment to do some logic for me. Once I had the data in the right format, I wrote some rules and let one of the off-the-shelf reasoners do a lot of the work for me. The trouble was, as simple as the abstract…
-
June 11, 2011
Writing a .NET unit testing framework in 100 lines of code Some time ago, I got frustrated with setting up NUnit for simple testing projects. I didn’t want to bother with the test runner, and I didn’t want to mess with any tooling in Visual Studio. My lazy default for doing the tests was to create a new console application…
-
June 6, 2011
Using the Mongrel2 web server with Mono I’ve been playing with evented web servers lately, and one of the projects that caught my attention was Mongrel2 . Actually I followed its progress via Hacker News and even made a small donation to the author during development. At the time I hadn’t envisioned myself ever actually using it. Later on I…
-
June 5, 2011
Method_missing in C# There have been a lot of instances where I wanted to intercept any call to an object in C#. In dynamic languages like Ruby, this is pretty easy, since there is a catch-all method that gets called if no method exists. This method is method_missing. Now that C# supports the dynamic keyword and the framework supplies a…