Archives
-
Why scons is cool
I’ve recently started playing with scons a little for some small personal projects. It’s not perfect, but I’ve rapidly come to the conclusion that it’s a probably far better choice than make in many cases. The main exceptions would be cases where you need to integrate into legacy build systems, or if asking or expecting [...]
Nov 7th, 2010 | Filed under Software Engineering -
Using Haskell’s ‘newtype’ in C
A common problem in software engineering is avoiding confusion and errors when dealing with multiple types of data that share the same representation. Classic examples include differentiating between measurements stored in different units, distinguishing between a string of HTML and a string of plain text (one of these needs to be encoded before it can [...]
Oct 11th, 2010 | Filed under Software Engineering -
Write yourself an strace in 70 lines of code
Basically anyone who’s used Linux for any amount of time eventually comes to know and love the strace command. strace is the system-call tracer, which traces the calls that a program makes into the kernel in order to interact with the outside world. If you’re not already familiar with this incredibly versatile tool, I suggest [...]
Aug 29th, 2010 | Filed under Software Engineering -
Some musings on ORMs
I’m pretty sure every developer who has ever worked with a modern database-backed application, particularly a web-app, has a love/hate relationship with their ORM, or object-relational mapper. On the one hand, ORMs are vastly more pleasant to work with than code that constructs raw SQL, even, generally, from a tool that gives you an object [...]
Jul 18th, 2010 | Filed under Software Engineering -
Implementing a declarative mini-language in the C preprocessor
Last time, I announced Check Plus, a declarative language for defining Check tests in C. This time, I want to talk about the tricks I used to implement a declarative minilanguage using the C preprocessor (and some GCC extensions). The Problem We want to write some toplevel declarations that look like: #define SUITE_NAME example BEGIN_SUITE(“Example [...]
Jul 4th, 2010 | Filed under Software Engineering -
Check Plus: An EDSL for writing unit tests in C
Check is an excellent unit-testing framework for C code, used by a number of relatively well-known projects. It includes features such as running all tests in separate address spaces (using fork(2)), which means that the test suite can properly report segfaults or similar crashes without the test runner crashes. My main complaint about Check is [...]
Jun 26th, 2010 | Filed under Software Engineering -
Lab Notebooking for the Software Engineer
A few weeks ago, I wrote that software engineers should keep lab notebooks as they work, in addition to just documenting things after the fact. Today, I’m going to share the techniques that I’ve found useful to try to get in the habit of lab-notebooking my work, even though I still feel like I could [...]
Jun 20th, 2010 | Filed under Software Engineering -
Confessions of a programmer: I hate code review
Most of the projects I’ve been working on today have fairly strict code review policies. My work requires code review on most of our code, and as we bring on an army of interns for the summer, I’ve been responsible for reviewing lots of code. Additionally, about five months ago BarnOwl, the console-based IM client [...]
Jun 6th, 2010 | Filed under Software Engineering -
Getting carried away with hack value
Recently, I’ve been working on some BarnOwl branches that move more of the core functionality of BarnOwl into perl code, instead of C (BarnOwl is written in an unholy mix of C and perl code that call each other back and forth obsessively). Moving code into perl has many advantages, but one problem is speed [...]
May 23rd, 2010 | Filed under Software Engineering -
Software Engineers should keep lab notebooks
Software engineers, as a rule, suck at writing things down. Part of this is training – unlike chemists and biologists who are trailed to obsessively document everything they do in their lab notebooks, computer scientists are taught to document the end results of their work, but aren’t, in general, taught to take notes as they [...]
May 2nd, 2010 | Filed under Software Engineering