Tag Archives: writing software

CJ68: My Virtual CPU

Long distance runners talk about “hitting the wall” — the point where their body runs out of resources, making it almost impossible to continue. I hit an intellectual wall late Monday night. Fortunately, I not only finished the race but went an unexpected extra mile. (And now my brain circuits are fried.)

Not an actual race (beyond a vague self-imposed deadline), but a hobby project like one of those ships in a bottle. A painstaking and challenging task in the name of fun and exercise of acquired skill. But no race, no ship, no bottle. This was a software project.

My inner geek rampant, I built a virtual 32-bit CPU (in Python).

Continue reading


CS101: Four Principles

If nothing else (and I think there is plenty of else), I can look back on all those years of writing code and pick out the main themes and principles, the things that seemed to matter most.

That’s what this CS101 series is about: things I think matter most when it comes to designing software.

Lately I’ve been looking into fours, doing things in fours. With that in mind, here’s Four Primary Principles for Programmer:

Continue reading


CS101: Always Use LT

Here’s a simple tip! I can’t begin to count how many potential code bugs this has eliminated. It takes some getting used to but once you make it automatic it’s a real help in keeping code and your thinking correct.

The tip is this: when you write relational expressions, always use less-than, never use greater-than.

Tip: Always write (B < A), not (A > B).

Continue reading


CS101: Clarity Trumps Everything

Clarity is the #1 priority when writing code. Clarity trumps everything else; it’s even more important than the code being correct! One of the biggest wins a serious programmer can offer is writing clear, readable code.

Source code is for the human reader; it’s not written like that for the computer. If it were up to the computer, humans would use the same ones and zeros it does. It would be much more efficient that way.

But we (inefficient) humans need ways to write and talk about computer programs.

Continue reading