ISC’s dhcpd uses this code to check for an already-running daemon:
/* Read previous pid file. */
if ((i = open (path_dhcpd_pid, O_RDONLY)) >= 0) {
status = read (i, pbuf, (sizeof pbuf) – 1);
close (i);
if (status > 0) {
[...]
Read the rest of this entry »
I’ll take an array over a giant switch-case statement any day.
The array definition will be more compact and easier to see all at once.
Defining actions in an array enforces uniformity.
You can put checks in the code to automatically verify that the array definition is complete. (I.e. verify it contains a definition for every item it [...]
Read the rest of this entry »
At some point your team is going to be gone. Not all at once (well, maybe, but in that case you won’t care), but over time turnover will completely replace your team.
If you are the manager, and you outlast the team, you’re going to pay for low quality code when you try to bring in [...]
Read the rest of this entry »
The items below are useful systems based on my experience working with a bunch of different software teams at a handful of companies over the past decade-plus. I haven’t bothered to list things like compilers, interpreters, libraries, etc. If you don’t have those, you aren’t making software…
Source control. This almost belongs in the “if you [...]
Read the rest of this entry »
It’s your job as a reviewer to find as many defects as possible. If you’re not finding defects, you’re wasting time.
Read the rest of this entry »
In “Talent is Overrated”, Geoff Colvin at one point discusses how superstars in many fields use the memory technique of “chunking” to boost their short term memory.
His simple example is the 13-letter word “lexicographer”. To you and I (assuming you speak English and have a decent vocabulary), it is easy to remember. We don’t have [...]
Read the rest of this entry »
When you’re writing python, you don’t need a lot of debate over the minutiae of most coding standards. PEP 8 does that for you. Even better, there are some tools that make it really easy to stick to the standard.
Why do this? Well, for one thing it makes code reviews easier when everyone follows the [...]
Read the rest of this entry »
This post was inspired by recent experience with some horrible build scripts from the open source world — but I’ve seen enough in-house badness over the years that I wanted to establish some basic parameters for build scripts.
This is a really broad way to divide the world, but I see two important categories of build [...]
Read the rest of this entry »
From The Peanut Gallery