Articles by Eric

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...

Testing Styles: Favor Unit Testing

By Eric — 8 minute read

Ideally, human efforts in testing should focus on building tests -- figuring out the strategies, test cases, and test data. From there, we'd rather let the computer run the tests and verify the results. If you had to test everything manually every day, you would either not do it, or really …

Read more...

Why Exceptions Are Better Than Returned Error Codes

By Eric — 3 minute read

I'm occasionally surprised that some programmers prefer an error handling system of returned error codes over exceptions. After spending several years with both approaches, I've become convinced that exceptions are a superior model. If you agree, great! If not, read on and let me try to persuade you. I'm always …

Read more...