Category Archives: C

A DSL For Handling Zero, One, Many

All this talk about refactoring to clean up code and monads to create pipelines has put me on a code composition kick… I wrote this code today: 1: private AddAssetResult HandleAssetFamily(SortContainer container, SystemAsset systemAsset) 2: { 3: AddAssetResult result = … Continue reading 

| Leave a comment

Monads in C#: Which Part Is The Monad?

In my previous post on refactoring some code, several people responded in the comments and via twitter that I should look at the Maybe<T> monad as an option. Now, I have to be honest… the potty-humor-teenager in me wants to … Continue reading 

| Leave a comment

A Refactoring: Explicit Modeling And Reducing Duplication

A coworker showed me a method that had a series of guard clauses at the top and a series of sequential steps that had to be processed after that. All of the guard clauses and sequential steps were executed the … Continue reading 

| Leave a comment

Domain Models, Dependencies And Fighting Anemia

For a long time now, I’ve been in the camp that says you shouldn’t have domain entities take dependencies… but at this point I’m having a hard time remembering why. I’m sure I could dig up my old notes and … Continue reading 


A question for Rubyists

I was checking out this post from Derick Bailey today, and something struck me rather odd.  Not the “DI only enables testability” argument, but the ruby code: class Foo    def bar     baz =     baz.do_something   end end I’ve been very … Continue reading 


A Few Thoughts On IoC, An Idea For A different Type Of Container, And A Lot Of Questions

With all the comments on my previous post, there actually is a lot of great insight to be had. I’ve picked up on a few underlying themes and several of the commenters were able to cut through the cruft of … Continue reading 


Design And Testability

In the line of business applications that I build, it’s considered good practice to use a test-first approach; Test-Driven Development, Behavior-Driven Development, or whatever you want to call it. Write a test, verify that it fails for the right reasons, … Continue reading 

| Leave a comment

Serving Images from an Image Controller

Found this solution rather simple when you want to serve images from your database. public class ImageController { readonly IImageQueries Queries; public ImageController(IImageQueries queries) { Queries = queries; } public FileResult Show(int id) { DateTime? dateCreated = Queries.GetDateCreatedById(id); //invalid image, … Continue reading 

Also posted in arduino, electronics | Leave a comment

Dynamic View Page, MVC without a View Model

Hello fellow techies on this roller coaster called life. It has been a while since my last post, I have been focusing on some other more important aspects of my life. What I want to talk about in this post … Continue reading 


Capturing Rhino Mocks arguments in C# 4.0

As a quick review, a test fixture has inputs and outputs.  We set up our test fixture by configuring inputs.  We observe the results through the fixture’s outputs. Inputs and outputs can be grouped into direct and indirect variants.  Direct … Continue reading 

| 1 Comment