C#: Java-ish enums
We’ve been writing quite a bit of code on my current project trying to encapsulate user selected values from drop down menus where we then want to go and look up something in another system based on...
View ArticleFunctional C#: Using custom delegates to encapsulate Funcs
One of the problems that I’ve frequently run into when writing C# code in a more functional way is that we can often end up with ‘Funcs’ all over the place which don’t really describe what concept...
View ArticleFunctional C#: An imperative to declarative example
I wrote previously about how we’ve been working on some calculations on my current project and one thing we’ve been trying to do is write this code in a fairly declarative way. Since we’ve been test...
View ArticleIron Ruby: ‘unitialized constant…NameError’
I’ve been playing around a bit with Iron Ruby and cucumber following Rupak Ganguly’s tutorial and I tried to change the .NET example provided in the 0.4.2 release of cucumber to call a class wrapping...
View ArticleC#: Using a dictionary instead of if statements
A problem we had to solve on my current project is how to handle form submission where the user can click on a different button depending whether they want to go to the previous page, save the form or...
View ArticleC#: A failed attempt at F#-ish pattern matching
A few weeks ago we had some C# code around calcuations which had got a bit too imperative in nature. The code looked roughly like this: public class ACalculator { public double CalculateFrom(UserData...
View ArticleC#: StackTrace
Dermot and I were doing a bit of work on a mini testing DSL that we’ve been writing to try and make some of our interaction tests a bit more explicit and one of the things that we wanted to do was find...
View ArticleC#: Overcomplicating with LINQ
I recently came across an interesting bit of code which was going through a collection of strings and then only taking the first ‘x’ number of characters and discarding the rest. The code looked...
View ArticleFunctional C#: Using Join and GroupJoin
An interesting problem which I’ve come across a few times recently is where we have two collections which we want to use together in some way and get a result which could either be another collection...
View ArticleFunctional C#: Continuation Passing Style
Partly inspired by my colleague Alex Scordellis’ recent post about lambda passing style I spent some time trying out a continuation passing style style on some of the code in one of our controllers to...
View Article
More Pages to Explore .....