Showing posts from February, 2010

Partials in Spark View Engine

Continuing my journey with Spark , the next natural stop for me after the basics was “partials”. I am a uber-fan of DRY (almost fanatical) so was keen to try and cut down the dupe of HTML etc. I thought I would share the “partials basics” for both you and me :) What Are “Partials”? “Partials” are basically snippets of HTML/”code” markup that can be used throughout your MVC application. This reduces code duplication and helps keep your site maintainable. It can also make your markup easier on the eyes, since you can isolate chunks of markup into “units of functionality” (e.g. a “navigation bar”). What Are Partials NOT? UserControls . People often relate/confuse partials with user controls, and they are NOT. While UserControls can encapsulate HTML, code behind, events and be packaged into assemblies etc. Partials are still (or at least should ) be pretty “dumb” views. Why Use Partials (and MVC) When UserControls Do More? If you are more interested in mashing up code with ma

RCP: Spark View Engine Bootstrapper

So, tonight I had a RCP session with @JohnnoNolan – we decided that for our topic, we would like to “File > New Project” and see what it is like to replace the default ViewEngine in ASP.NET MVC with the Spark View Engine . Why Spark View Engine? I have heard a lot of buzz about it from the developer community. Also, I heard the podcast on Hanselminutes and the notion of it all just sat right with me - there shouldn’t be such an epic battle between HTML/C# in your views. Our sole purpose in the View is to render HTML based on some model data – make it easy . RCP Session Aims Neither myself or Johnno had any real experience with Spark before the session. As a starting point, I thought it would be good to cover what I would consider to be the “basics” for views: Using variables from ViewData. Using strongly-typed model data. Using master pages. I decided to spend 1 hour before the session having a quick run-through of the install process and the basics in th

TomatoTimer Now on GitHub

Not sure if you guys remember me talking about TomatoTimer in the past , but after some thought I have decided to whack it on GitHub as a public repository . Why GitHub? Cos it’s awesome. Even when it fails it’s awesome because I think Octocat is awesome :) Why a Public Repo? Put simply, there are people that were interested in using the application, and there a couple of bugs in it that I can’t guarantee a fix time on. I am not (and likely to remain not) invested in WPF applications at all at this time. I am instead focusing my efforts on ASP.NET MVC. So, rather than keep people waiting, I thought I would throw the code online so they can at least use it. If it just so happens that someone sees the problem and they send me a pull request, even better. Where Do I Get the Code? You can get (read-only) access to the repository here : . The code is C# 3.5, with a WPF front-end. xUnit is used for testing, and Rhino Mocks for mocki

“Getting Started with Ruby” Kata

I have been having talks/ideas for some time about starting a bit of a affair with Ruby . As a .NET geek, you may be wondering “why?”. I don’t want to “go on” too much here, if you’re curious about these, please feel free to ask: It’s Designed for Programmers It’s Dynamic and Not JavaScript Rails Looks Interesting Massive Community Movement/Involvement Strong Open Source Community I got thinking. I want to get started, but have no idea where to begin. I make no claims that I am anything other than a complete n00b. So, I started feeling my way through the darkness and decided to try and formalise it into a kata that can be repeated. NOTE: This is totally a “bootstrapping” kata – if you have done anything beyond the basics with Ruby, this is of no good to you! The Kata Problem Create a simple class that returns a number formatted as a percentage. For whole numbers, “zero” decimal places should be removed, for fractions, they should be