Friday, 30 November 2007

Bad service from domains4less.co.nz (Don't use them!)

Two weeks in the process of registering some domains with domains4less and they completely screwed it up. They charged my credit card twice and they didn't register the domains! Its taken them ages to try and sort the problem out, last email they asked for all the registration details again!

So walking away from that one! The domains have been registered through another registrar.

My advice, never use domains4less.co.nz

Wednesday, 28 November 2007

Programming Weapons

In a recent email conversation with Rick Mugridge the topic of Agile tools came up.... Which got me thinking about what tools we make use of as software creators. And possibly more interesting, what the tools of the future might look like.

So anyways I came up with a number of categories of tools.

1. Composition
2. Transformation
3. Validation
4. Thinking
5. Collaboration
6. Ergonomic

Which I will talk more about soon....

Part of my thinking process was that there are some interesting correlations between software development and martial arts.

I see martial arts and software development made of the following

Weaponary - Tools we have at our disposal
Tactics - the coordinated and organised application of weapons
Strategy - A plan to achieve a goal using a set of tactics (including adaptable plans that change tactics)
Philosophy - A system of rational thinking based around what one believes to be true.

Being able to fight or create software comes from a holistic application of all these things.

In the world of "Agile" there are some shared "values" of software development. They feed in at the level of "Philosophy" giving some sense of the epistemology ( what knowledge is thought to be "true" ). However that is about it. From there Agile is expressed with many different Philosophies / Strategies / Tactics and Weapons. Some things get shared ( especially the more effective weapons and tactics )

Choosing to be "Agile" really doesn't mean a lot. Choosing to do Scrum or Extreme Programming is more useful. Often choosing to be "Agile" results in making choices similar to....

"Punching? yep sounds good, we'll do some of that"
"Kicking? well, that sounds a bit difficult, perhaps we'll do that later"
"Throws and Takedowns? Seem to be a waste of time"
"Grappling? Supposedly that's good, we'll do a bit of that"

Now we end up with a system where there is no guiding philosophy, strategies that are not cohesive, tactics and weapons that sometime work and sometime don't without much clue as to why.

I think it pays to gain mastery in one holistic system then learn to create (or adapt) holistic systems that tie everything together in some cohesive and coherent way.

Having said this, a holistic system isn't a foolproof plan for winning. It might fail badly in certain contexts. However, once you have mastered one system you can "train" in various contexts and learn and adapt and incorporate new things based on your experience.

Also depending on what your fighting/creating depends on what kinds of strategies/tactics/weapons you apply to the situation.

What I have seen is if you don't have a guiding philosophy for adapting and changing things then you can actually create situations where your strategies and tactics end up fighting themselves.

Over the next few blogs I'll try and flesh out some of what that all means to me and how these categories of tools come together and get applied to create various tactics.

Saturday, 17 November 2007

Mintshot

I logged in and had a look at this tonight.... I pretty much thought this was going to be crap. I actually found it strangely addictive and I ended up winning a $125 Atlas :-)

www.mintshot.co.nz

Theres a bunch of stuff to be won on there.... you can either bid on them with "mintshot" dollars or you pay to play a game and whoever has the highest score will win the prize. This is potentially a really addictive thing to do. Its kind of like playing pokies except you can have all kinds of games. Certainly gives you motivation to view the ads....which are between 15 and 30 seconds lond typically

Thursday, 15 November 2007

Looking up from Blub

Thanks to Randy I have had a good few days looking up from "Blub".

So, Randy posted a comment about the soloution in J for the bowling game. I read that article a while back also. Except I looked at the J code and went "what a load of crap". And who could blame me? The code looks like crap, from http://www.xprogramming.com/xpmag/dbcBowlingVector.htm , heres the code :-

framex =: 10 {. 0 {~^:a:~ _1 _1 ,~ i.@# >:@:+ 10&~:
scoreifframe =: 3 +^:(9<])`+/@|.\ ,&0 gamescore =: [: +/ framex { scoreifframe why waste your time with anything that looks like that? Well, as it happens, I think its a case of being a Blub programmer and running into "The Blub Paradox" as coined by Paul Graham and written about here http://www.paulgraham.com/avg.html

Basically, when you see a language which is more powerful than the ones you know, you're not going to immediately recognise it.

Anyways, having got Randys comment on my blog I thought I should be a bit thorough and have a look at this J stuff. I winced at the cryptic nature of the code. But even if it was cryptic, the quicksort on wikipedia in J code did impress me as its a single line of code....

quicksort=: (($:@(<#[) , (=#[) , $:@(>#[)) ({~ ?@#)) ^: (1<#) Which is a great example of Tacit Programming ( http://en.wikipedia.org/wiki/Tacit_programming )

and J is an example of Function Level Programming ( http://en.wikipedia.org/wiki/Function-level_programming )

and J is also a a non-Von Neumann programming language ( http://en.wikipedia.org/wiki/Von_Neumann_programming_languages )

So, anyways, I downloaded J and started to wade my way through a fantastic tutorial on J at http://www.jsoftware.com/help/learning/contents.htm

Surprisingly quickly the cryptic squiggles started to all make sense and the stuff on hooks and forks in http://www.jsoftware.com/help/learning/03.htm was really quite cool.

Anyways!

All this stuff comes back to a guy called John Backus, which most anyone who's done computer science will know, is responsible for Fortran and BNF ( a notation to define context free grammars ). He wrote a very famous paper where he basically criticises languages and their designers and tells them they are intellectually crippling the world of programming. Pretty much anything in the C C++ Java C# strain of languages is crap. Or at least a crippled way of writing programs.

Anyways, the paper is http://www.stanford.edu/class/cs242/readings/backus.pdf and its from 1977. It is a very good read. Except! I have read this before, really early on in my education. I remember the idea of getting around the von-neumann bottle was pretty cool but I barely paid any attention to it because it meant very little to me. There were more practical things to be doing like trying to write C and hack VGA X mode code.

Having said all that, I'm not sure if J is really *hugely* more powerful than other programming ideas however it provides quite a unique way of thinking about programming. That in itself is very good.

Friday, 9 November 2007

Wait Wait.... Another Version of TDD F# Bowling Game

No sooner I post I reflect on the code again and see that there's some hangovers from my orginal mucking around


let score_bowls bowls =

    let rec score_bowls' frame l  =

        let nextframe = score_bowls' (frame+1)

        match l with

        | _ when frame = 11 -> 0

        | [10;s] -> 10 + s + s

        | 10 :: s :: n :: tail -> 10 + s + n + nextframe (s :: n :: tail ) 

        | f :: s :: n :: tail -> f + s + (if((f+s)=10) then n else 0) + nextframe (n :: tail)

        | _ -> List.fold_right (fun x y -> x + y) l 0

    score_bowls' 1 bowls

New F# Bowling game

After a bit of feedback from a number of sources and addressing some of my concerns with the duplication



let rec score_bowls bowls =

let rec score_bowls' frame l =

let sum b = (List.fold_right (fun x y -> x + y) b 0)

let nextframe = score_bowls' (frame+1)

match l with

| _ when frame = 10 -> sum l

| [10;s] -> 10 + s + s

| 10 :: s :: n :: tail -> 10 + s + n + nextframe (s :: n :: tail )

| f :: s :: n :: tail -> f + s + (if((f+s)=10) then n else 0) + nextframe (n :: tail)

| _ -> sum l

score_bowls' 1 bowls

Wednesday, 7 November 2007

TDD and F#

I've been playing around with F# a bit more lately since its been announed that its going to be a first class language in .NET.

The following code is some TDD'd code that does classic Bowling game TDD example. Interestingly it came out to be 10 lines of code, which is much shorter than equivilent C# / C++ / Java implementations. However I'm not entirely sure its super readable. It was super writable. It was very easy to add in new cases as the code progressed. I'm also not sure how much more I could improve this as I'm not a F# whizz. This peice of code makes use of F#s pattern matching abilities (not regex pattern patching). However there are so many other toys in the language to play with. I think async will be the next thing I have a play with.

The F# community is pretty small at the moment, it will be interesting to see how people exploit the language as it becomes more main stream. I also posted this code over at the hubFS .



#light

open System

open NUnit.Framework

let rec score_bowls bowls =

let rec score_bowls' frame l =

match l with

| _ when frame = 10 -> (List.fold_right (fun x y -> x + y) l 0)

| [] -> 0

| [f] -> f

| [f;s] -> f + s

| f :: s :: n :: tail when f = 10 -> 10 + s + n + score_bowls' (frame+1) ( s :: n :: tail )

| f :: s :: n :: tail when (f + s) = 10 -> 10 + n + score_bowls' (frame+1) (n :: tail)

| f :: s :: n :: tail -> f + s + score_bowls' (frame+1) (n :: tail)

score_bowls' 1 bowls

[]

type BowlingTestCases = class

new() = {}

[]

member x.SimpleScoring() = Assert.AreEqual(6, score_bowls [1;2;3] )

[]

member x.ScoreSpare() = Assert.AreEqual(12, score_bowls [2;8;1] )

[]

member x.ScoreStrike() = Assert.AreEqual(16, score_bowls [10;1;2] )

[]

member x.ScorePerfectGame() = Assert.AreEqual( 300, score_bowls [for i in 1..12 -> 10] )

[]

member x.SpareLastFrame() = Assert.AreEqual( 11, score_bowls ([for i in 1..18 -> 0] @ [2;8;1]) )

[]

member x.StrikeLastFrame() = Assert.AreEqual( 21, score_bowls ([for i in 1..18 -> 0] @ [10;10;1]) )

end