Geeks With Blogs
Liam McLennan hackingon.net March 2010 Entries
Syntax Highlighting for Gherkin (Cucumber Language)
SyntaxHighlighter is the de facto standard for syntax highlighting on the web. I am currently working on a tool for publishing BDD specifications on the web and I want syntax highlighting. Unfortunately, SyntaxHighlighter does not support Gherkin, the language Cucumber and SpecFlow use to define BDD specifications. Writing new language parsers for SyntaxHighlighter is very easy, so I implemented one for Gherkin. Here is what a syntax highlighted Gherkin file looks like: # A comment here Feature: ......

Posted On Tuesday, March 30, 2010 1:35 AM

New Company Website

For a long time now my company website has been showing its age. It was a dot net nuke monstrosity.

Today I have deployed a new website for my company. I hope that it reflects my commitment to quality and minimalism.

Please have a look and let me know what you think.

Posted On Thursday, March 25, 2010 12:36 AM

Software Craftsmanship Explained

craftsmanship

Posted On Wednesday, March 24, 2010 7:23 PM

A Reusable Builder Class for Javascript Testing
Continuing on my series of builders for C# and Ruby here is the solution in Javascript. This is probably the implementation with which I am least happy. There are several parts that did not seem to fit the language. This time around I didn’t bother with a testing framework, I just append some values to the page with jQuery. Here is the test code: var initialiseBuilder = function() { var builder = builderConstructor(); builder.configure({ 'Person': function() { return {name: 'Liam', age: 26}}, 'Property': ......

Posted On Tuesday, March 23, 2010 5:01 PM

A Reusable Builder Class for Ruby Testing
My last post was about a class for building test data objects in C#. This post describes the same tool, but implemented in Ruby. The C# version was written first but I originally came up with the solution in my head using Ruby, and then I translated it to C#. The Ruby version was easier to write and is easier to use thanks to Ruby’s dynamic nature making generics unnecessary. Here are my example domain classes: class Person attr_accessor :name, :age def initialize(name, age) @name = name @age = age ......

Posted On Tuesday, March 23, 2010 4:50 AM

A Reusable Builder Class for .NET testing
When writing tests, other than end-to-end integration tests, we often need to construct test data objects. Of course this can be done using the class’s constructor and manually configuring the object, but to get many objects into a valid state soon becomes a large percentage of the testing effort. After many years of painstakingly creating builders for each of my domain objects I have finally become lazy enough to bother to write a generic, reusable builder class for .NET. To use it you instantiate ......

Posted On Monday, March 22, 2010 10:32 PM

Software Craftsman Pilgrimage Comes Together
Last week on Software Craftsman Pilgrimage I was trying to organise where I will be travelling, and the companies I will be pairing with. I now have a confirmed itinerary. 9 - 11th April Alt.NET Seattle 12th April Craftsman visit with Didit (Long Island) 13th April rest day :) 14th April Craftsman visit with Obtiva (Chicago) 15th – 16th April Craftsman visit with 8th Light (Chicago) 17th – 18th April Seattle Code Camp I am looking forward to all of my visits and talking to all the smart people who ......

Posted On Friday, March 19, 2010 9:04 PM

My New BDD Style
I have made a change to my code-based BDD style. I start with a scenario such as: Pre-Editing * Given I am a book editor * And some chapters are locked and some are not * When I view the list of chapters for editing * Then I should see some chapters are editable and are not locked * And I should see some chapters are not editable and are locked and I implement it using a modified SpecUnit base class as: [Concern("Chapter Editing")] public class when_pre_editing_a_chapter : BaseSpec { private User ......

Posted On Tuesday, March 16, 2010 8:04 PM

Changing Platform
From time to time a developer makes a break from their platform of choice (.NET, Java, VB, Access, COBOL) and moves to perceived greener pastures. Zed Shaw did it, jumping from Ruby to Python, and Mike Gunderloy went from .NET to Rails. But it can be difficult to change platform. My clients don’t come to me looking for a software developer, they come looking for a .NET developer. This is a tragic side effect of big software companies marketing. If your village is under attack by bandits, would you ......

Posted On Tuesday, March 16, 2010 4:17 PM

Trying to Organise a Software Craftsman Pilgrimage
As I have previously written, I am trying to organise a software craftsman pilgrimage. The idea is to donate some time working with quality developers so that we learn from each other. To be honest I am also trying to be the worst. “Always be the worst guy in every band you’re in.” Pat Metheny I ended up posting a message to both the software craftsmanship group and the Seattle Alt.NET group and I got a good response from both. I have had discussions with people based in: Seattle, New York, Long ......

Posted On Tuesday, March 16, 2010 4:37 AM

My Message to the Software Craftsmanship Group
This is a message I posted to the software craftsmanship group, looking for a week-long, pairing / skill sharing opportunity in the USA. I am a journeyman software craftsman, currenlty living and working in Brisbane Australia. In April I am going to travel to the US to attend Alt.Net Seattle and Seattle codecamp. In between the two conferences I have five days in which I would like to undertake a craftsmanship mini-apprenticeship, pairing and skill sharing with your company. I do not require any ......

Posted On Sunday, March 14, 2010 5:03 PM

Handy Javascript array Extensions – distinct()
The following code adds a method to javascript arrays that returns a distinct list of values. Array.prototype.distinct = function() { var derivedArray = []; for (var i = 0; i < this.length; i += 1) { if (!derivedArray.contains(thi... { derivedArray.push(this[i]) } } return derivedArray; }; and to demonstrate: alert([1,1,1,2,2,22,3,4,5,6... This produces 1,2,22,3,4,5,6,7 ......

Posted On Thursday, March 11, 2010 3:35 PM

Handy Javascript array Extensions – contains(…)
This javascript adds a method to javascript arrays that returns a boolean indicating if the supplied object is an element of the array Array.prototype.contains = function(item) { for (var i = 0; i < this.length; i += 1) { if (this[i] === item) { return true; } } return false; }; To test alert([1,1,1,2,2,22,3,4,5,6... // true alert([1,1,1,2,2,22,3,4,5,6... // false ......

Posted On Wednesday, March 10, 2010 10:33 PM

Sneaky Javascript For Loop Bug
Javascript allows you to declare variables simply by assigning a value to an identify, in the same style as ruby: myVar = "some text"; Good javascript developers know that this is a bad idea because undeclared variables are assigned to the global object, usually window, making myVar globally visible. So the above code is equivalent to: window.myVar = "some text"; What I did not realise is that this applies to for loop initialisation as well. for (i = 0; i < myArray.length; i += 1) { } // is equivalent ......

Posted On Tuesday, March 9, 2010 8:56 PM

Documenting the Success Scenario
Posts like my intro to jQuery client-side templates may appear, at first glance, to add nothing to the existing body of knowledge. However, the trouble that I regularly encounter with technical documentation is that the author tries too hard to be exhaustive. When first approaching a new topic the reader is most interested in the success scenario. Under normal conditions, how would I use this technology? What is the most basic syntax? A great example of documentation that focuses on the core usage ......

Posted On Wednesday, March 3, 2010 7:08 PM

jQuery client-side templates with jqote and Asp.Net MVC
Why Use Client-side Javascript Templates? When building rich internet applications you often need to construct html on the client. I am going to demonstrate how to construct DOM elements using the jqote jQuery plugin (2.0.0). The naive approach to client-side html generation is to embed html inside javascript like: var text = 'Some text'; $('body').append($('<div id="content>' + text + '</div>"')); This approach fails as the complexity of the html increases. It is also a clear separation ......

Posted On Wednesday, March 3, 2010 1:57 AM

Copyright © Liam McLennan | Powered by: GeeksWithBlogs.net