By Chance - Can Order Come Out of Randomness?

By Eric — 2 minute read

A few years ago I was reading some books about biological evolution. At some point, probably reading something by Richard Dawkins, I was thinking about randomness and its ability to produce apparently non-random things. All you need is a little pressure that selects one random thing over another. So I …

Read more...

Design by Contract: An Alternative to Testing for Code Quality

By Eric — 7 minute read

I recently finished reading Design by Contract by Example by Richard Mitchell and Jim McKim. The book, as its title suggests, gives advice about writing good contracts through a set of principles applied in various examples. In addition to wanting to learn more about design by contract generally, I came …

Read more...

Dell Axim X50v in a Palm User's Hands

By Eric — 7 minute read

It seems like Microsoft's typical entry into a market goes something like this. It sees an interesting market built up by someone else, and releases a product in that space. The product is crap compared to the existing market leader. Microsoft revs the product a few times until it is …

Read more...

Packing and Alignment

By Eric — 1 minute read

I've made some effort to understand the differences between the Struct Member Alignment compiler option /Zp, #pragma pack and __declspec(align()) with Microsoft Visual C++ in light of an odd bug that ultimately was caused by inconsistent packing options between compilation units.

/Zp and #pragma pack are equivalent, but /Zp …

Read more...

DeskMinder Release

By Eric — 1 minute read

I wrote DeskMinder as a Christmas gift for my family and friends. It originated as just a bit of HTML and JavaScript as an Active Desktop component for reminding me when special occasions were drawing near, like family members' birthdays and anniversaries. To make it easier to customize the events …

Read more...

InspectionPrinter Initial Release

By Eric — 1 minute read

I've released the first version of my InspectionPrinter utility. We have been renewing our efforts to do more formal code inspections at NextPage recently, which finally motivated me to finish this thing off, having originally started it nearly two years ago. It can be downloaded from the software section.

The …

Read more...

.NET Context Menu Handler

By Eric — 3 minute read

I've been working on a context menu handler shell extension in C# lately. There are a few samples that people have produced on the web (for example, The Code Project, pek.com, and TheServerSide.net). I've found a better way of implementing IShellExtInit.Initialize than in the examples I've seen …

Read more...

Microsoft's CD Replacement Policy

By Eric — 3 minute read

I noticed a while back that my Rise of Nations game CD had a big crack through it. This was likely owing to it being on the floor in close proximity to the wheels of the chair at the boys' computer. Any hopes that it might still be readable were …

Read more...

Techniques for Effective Logging

By Eric — 6 minute read

Updated September 8, 2005

Logging is a testing and diagnostic technique that lies somewhere between automated testing and debugging. It can help you understand what your application is doing, especially in cases where there is some non-determinism because of threading, or when running in an environment where debuggers are not …

Read more...

Mock Object Strategies

By Eric — 12 minute read

How do you get your production code to use real objects and your test code to use mock objects?

Here's the class we want to test (adapted from Object-Oriented Design Heuristics, Arthur J. Riel):

public class HeatFlowRegulator 
{ 
    private Furnace furnace; 
    private Set house;    

    public HeatFlowRegulator(Set house) 
    { 
        this.house = house …

Read more...