Blog posts by Leeds# peeps

  • Leeds Sharpers at DDD North 2014

    Tags: DDDNorth

    Voting is now open for DDD North 2014, which is excitingly going to be in Leeds. There are a lot of good talks to vote for, but my biased opionion is that the following Leeds Sharpers should all have their talks voted for.

  • Testing DateTimes (and other things) with an Ambient Context

    Tags: patterns, TDD, Unit Testing

    One issue you’re likely to face while writing automated tests is that it can be tricky to check anything related to DateTimes, as they are typically accessed statically using:

    1
    var startTime = DateTime.Now;

    The approach I’ve typically used is to create some kind of IDateProvider interface, and supply that as a dependency as needed using Dependency Injection.  However, with things used throughout a system like DateTime can be, this becomes quite a chore and make the code more complex with an ever-increasing list of dependencies.

  • ASP.NET you're doing it wrong. Part Two: The Views

    In my previous post I spoke briefly about how to setup routes and handle route arguments etc. In this post I’m going to run through the various options you have for returning and presenting your data in views. If you haven’t already I suggest you read the first part of this series.

  • Real readonly lists in C#

    Tags: c#, code

    In C# there is the readonly keyword that enforced the rule that the variable must be initialised as it's declared or in the constructor. This works as expected for simple types, but for objects and lists it's not quite like that. With a list, you can still add, remove and change items in the list. You may also expose a list as a property with a public get and a private set. You want the owner class to be able to modify the list items, but you don't want anything outside the class to modify the list items.

  • Using Named Parameters for Constants

    Tags: readable-code

    I might not being telling you anything new here, but a friend pointed out a good use for named parameters other than the usual optional parameters.

  • Making a simple State Machine with F# Actors

    Tags: f#

    F# comes with a built-in Actor framework, using the MailboxProcessor class.  The main reason for using actors is to simplify concurrent processing, but they also hit another sweet spot – they’re pretty good for implementing Finite State Machines (FSM).

  • Localising JavaScript strings in ASP.NET

    Tags: javascript, asp.net, localising

    In recent years there has been a huge explosion of rich javascript and jquery plugins giving you everything from drag and drop to wysiwyg editors and autocomplete to fartscroll.js. Using some of these plugins can be a great way to speed up development and cash in on someone else’s hard work. However doing this always comes with an element of risk and it may lack the specific details that you require.