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.
Here is an example with an almost readonly list, but as you can see it's not as … more
In Orchard you can create your own content type by welding together several content parts. Here is an example of how you'd do that in your data migration:
cfg => cfg
You can also add fields to a content type, but it's not obvious at first how to do this. You can't add a field to a type directly, you can only add fields to parts. To get round this you can add a secret part to a type with the same name as the type. This part is not shown in content … more
A business model canvas is the lean alternative to a business plan. They say no business plan survives first contact with customers, so why write a large inflexible document. A business model canvas is supposed to give you at a glance the key important aspects and assumptions of your business. It shouldn't stay the same, but should change as you prove and disprove the assumptions your business model is based on. The idea comes from Alexander Osterwalder and he wrote about in his book Business Model Generation.
I've been playing about with them for a few of my ideas and decided to create … more
The Creative Bloq App Generator Contest was sponsored by Windows 8 and was a chance for UK developers to be recognised for their excellent work. I was very pleased that my app Font Picker was one of the top ten winners, particularly because of the high quality of the other winners. Here are the all the winners of the contest.
Grand Prize Winner
Didlr – Rich Holdsworth
Didlr lets you draw and share your pictures.
Top ten prize winners
These are in no particular order, except I'm biased so mine is at the top.
Font Picker – Richard Garside
Font Picker is an app for designers … more
In an earlier post I wrote about using an XML value provider to allow you to send XML to your .NET MVC action methods. This is great, untill you want to accept XML where you have a model that needs XML atributes to control how it's deserialized. As the value provider stage happens before mondel binding it has no knowledge of the model objects that the values will be pushed into. So it can't look at your model class's XML attributes.
In cases like this, you're better of using a custom XML model binder.
To setup an XML model binder you need to create a model binder and a model binder provider. … more
My previous C# mocking framework of choice was MOQ. It's very powerful and fairly easy to use, but I recently started using NSubstitute and fell in love with how easy and intuative it was to use.
The cleverest part is that unlike MOQ the mocks produced actually implement the interface they're mocking and this makes the code much clearer and a little bit shorter.
Here is a very simple example:
var mockThing = Substitute.For<IThing>();
// Use mock thing
In MOQ this is also quite straightforward but the setup code to … more
Font Sunday is a weekly twitter phenomena where the typographically obsessed share examples of fonts around them. The theme this week was 'Fonts on Vinyl' and this turned out to be a theme that got people excited and it was the most contributed to week we've ever had.
The Design Museum started Font Sunday and set the theme each week. I help out by collating the contributions on a Pinterest board. more
This is the reading list for my talk, 'The Side Project Startup. I last gave this talk at DDD North 2 and it's slowly evolving every time I give it. If you're interested in side projects and starting your own small software business then this reading list is for you.
The Lean Startup – Eric RiesIf you've not heard of the Lean Startup or you're not convinced, then you should read this book. If you are convinced, then the next two books on this list actually go into detail you can start using today.
Start small stay small – Rob Walling
Sell more software – Patrick … more
Developing for a new platform, particularly one that's not finalised yet can come with a bit of a steep learning curve and a number of frustrating moments. It's also exciting and I can't wait for Windows 8 to come out and for my app Font Picker to be available in the new Windows Store. Something that has blown me away has been the support from Microsoft. The documentation is great, there have been roadshows and you could even get one on one time with a Microsoft engineer to fine tune your app and get it ready for the store. These were the slightly cheesily named 'Excellence Labs'.
The … more
My Windows 8 app had a GridView with grouped content and also made nice use of semantic zoom to make navigating between those groups easy. All I wanted to do was to make the headers appear in the content like the People App. I thought this would be a simple case of finding the right container template to use, but after reading this post by Mike Taulty it turns out that using the group style built into GridView can't do this. His post goes into a lot of detail about how to figure out your XAML and shows a GridView with inline group headers. I've taken his method and extended it to include … more