Phillip Trelford's Array

POKE 36879,255

Announcing My F# Introduction Talk on Tuesday 19th May, 2009 @ Skills Matter in London

This talk is intended to provide a quick introduction to the language for existing developers, along the way comparing features with other programming languages including C#, C++ and Python. Expect plenty of code samples culminating in a playable mini-game written with F# in less than 300 lines!

Register free here: http://skillsmatter.com/podcast/open-source-dot-net/phil-trelford-f-introduction 

My previous F# talks 

My public F# game samples

"In The Brain of Gojko Adzic: What is FitNesse and should I use it?"

Thanks to Gojko Adzic for an excellent introductory talk on Fitnesse: In The Brain of Gojko Adzic: What is FitNesse and should I use it? The slides of the talk are available here: http://gojko.net/resources/whatisfitnesse.pdf.

The value of Fitnesse appears to be in providing a way to quickly and easily generate requirements documentation with examples that can be shared between customers and developers. Documentation is written as Wiki pages that describe requirements with tables of example inputs and outputs. The example tables are parsed to create automatic tests with the tests expecting some support classes called fixtures.

Fitnesse is not suitable for Unit Testing; equally Unit Tests are not typically suitable for reading by customers. In his talk Gojko humorously compared asking customers to read unit test code akin to asking them to read Klingon. 

Opening quotes on Fitnesse:

  • Fitnesse home: “Welcome to FitNesse! The fully integrated standalone wiki, and acceptance testing framework.”
  • Fitnesse from Wikipedia: “FitNesse is a web server, a wiki, and a software testing tool. It is based on Ward Cunningham's Framework for Integrated Test. FitNesse is designed to support acceptance testing rather than unit testing in that it facilitates detailed readable description of system function. 
    FitNesse allows users of a developed system to enter specially formatted input (its format is accessible to non-programmers). This input is interpreted and tests are created automatically. These tests are then executed by the system and output is returned back to the user. The advantage of this approach is very fast feedback from users. The developer of the system to be tested needs to provide some support (classes named "fixtures", conforming to certain conventions).
  • Framework for Integrated Tests (FIT) from Wikipedia: Framework for Integrated Test, or "Fit", is an open-source tool for automated customer tests. It integrates the work of customers, analysts, testers, and developers. 
    Customers provide examples of how their software should work. Those examples are then connected to the software with programmer-written test fixtures and automatically checked for correctness. The customers' examples are formatted in tables and saved as HTML using ordinary business tools such as Microsoft Excel. When Fit checks the document, it creates a copy and colors the tables green, red, and yellow according to whether the software behaved as expected. 

Example of a Fitnesse example: 

Division
numerator denominator quotient?
10 2 5.0
12.6 3 4.2
22 7 ~=3.14
9 3 <5
11 2 4<_<6
100 4 33

 

 Fitnesse examples should declare the What not the How:

  • What: the inputs and outputs
  • How: the control flow 

Or to put it another way Fitnesse examples should be Declarative not Imperative. 

Final quote: FitNesse is written in Java (by Micah Martin, Robert C. Martin and Michael Feathers) but versions for several other languages had been added over time (C++, Python, Ruby, Delphi, C#, etc)”.

Mastermind F# WPF Game Sample

While playing around with the F# September CTP over the last week, I made a short, <300 lines, implementation of the Mastermind board game using some Windows Presentation Foundation (WPF) controls. I've been impressed with the integration of F# with Visual Studio 2008 with project references and property pages now in place. It also seems pretty easy to wire up a usable UI using the WPF controls event without XAML. Anyway you can view the source on the F# wiki or download it below and have a play.

Mastermind.fs (13.69 kb)