Design by Contract, Ruby Style

Posted on June 15, 2011. Filed under: Uncategorized |

I recently encountered a situation in which I was writing data to a key/value data store. There was a code layer that insulated the business logic layer from the data store internals. I wanted to be able to unit test this business logic without needing access to the data store.

I could mock the data access layer, but I wanted something more functional — something that would behave like the data store layer, and possibly even be used to test it. I decided to write something mimicking the production data store layer that used a Ruby Hash for storage. How could I use the language to help me know that I had faithfully reproduced all the functions in the original object?
(more…)


Read Full Post | Make a Comment ( 2 so far )

Recently on Keith Bennett's Technical Blog...

Android GUI’s — The Case Against GUI Builders and Data Driven GUI Configuration

Posted on May 28, 2011. Filed under: Uncategorized |

Singapore and Its Red Dot RubyConf

Posted on May 10, 2011. Filed under: Uncategorized |

Sun Java Coding Conventions Revisited

Posted on March 6, 2010. Filed under: Uncategorized | Tags: , , , , , |

Bangspace — Bangkok Hackerspace

Posted on March 2, 2010. Filed under: Uncategorized | Tags: , , |

GPartEd – Free and Open Source Disk Partitioner

Posted on July 1, 2009. Filed under: Uncategorized | Tags: , , , |

The Loss of One’s Adopted Country – Another Result of the Economic Crisis

Posted on March 30, 2009. Filed under: Uncategorized |

Dabbling in Clojure

Posted on March 16, 2009. Filed under: Uncategorized | Tags: , , , , |

JRuby — A Better Language for the Java Virtual Machine

Posted on February 26, 2009. Filed under: Uncategorized | Tags: , , , , , , , , |

Applying User Interface Design to Source Code

Posted on November 28, 2008. Filed under: Uncategorized | Tags: |

Liked it here?
Why not try sites on the blogroll...

Follow

Get every new post delivered to your Inbox.