24 December 2005

AJAX Translator

This is very nice...

An AJAX translator.

English
Twas brillig and the slithy toves did gyre and gimble in the wabe

German
"Brillig Twas und die slithy toves taten gyre und gimble im wabe"

French
"Le brillig de Twas et les toves slithy ont fait le gyre et gimble dans le wabe"

Not bad.

20 December 2005

4 unrelated links

1. More Nuggets from MSDN UK .

2. Microsoft listens to feedback on it's misleading TDD item.

3. Martin Fowler on agility.

4. 10 things about WPF from Ian Griffiths and Chris Sells.
(I think WPF is a terrible acronym.)

17 December 2005

India

My job went to India

Excellent idea, don't know if it's a good book though.

19 November 2005

06 November 2005

Kids Programming Language

KPL.

This looks quite impressive. A bit more graphical and fun than LOGO.

30 October 2005

VS 2005 and Firefox

If you have Firefox as your default browser when you install VS2005 and then you notice that VS2005 is trying to run Firefox all the time then look at this.

With 'File-Browse with' you can set the browser you want. Changing your default browser after installing doesn't seem to inform VS2005.

27 October 2005

Yipee!

Currently downloading VS 2005 Prfessional Edition... 3 hours to go.

26 October 2005

Running just to stay in the same place

There's a new generation of Microsoft Certifications...

I knew it would happen. I had hoped to have passed at least one exam first.

25 October 2005

DDD

Another excellent Developer day at Microsoft on Saturday.

It would be an understatement to say there were some good presentations. There were some brilliant sessions, particularly on Avalon, Indigo and XML.

There were plenty of other sessions I wanted to attend but didn't. It was difficult to have to choose one track out of five. I am still kicking myself for not attending the XP Planning game. I do think it would be good to have a whole day devoted to this subject though.

03 October 2005

MCAD things

Certifications to include Simulation Testing?!!? View demo.

And, a practice test demo for 70-315.

15 September 2005

The Walrus blog

On behalf of Odobenidae everywhere my brother Chris has started blogging. His blog has comments and trackbacks. Why doesn't mine?

09 September 2005

CSS tips

CSS tips and more

08 September 2005

Install MiniOddie

Fresh from the Beeb... A mini Bill Oddie

Now, back to MCAD studies.

23 August 2005

Developer Day

The TripleD Developer day agenda is looking good. Last time the difficulty was deciding which sessions to attend. This time you get to vote for sessions in advance which may help...

16 August 2005

Testing Private methods

An article on testing private methods. I don't like the idea of using Reflection to do this. But the alternative looks complicated too.

I have more sympathy for the idea of keeping classes simple. If there are a lot of private methods that are difficult to test through the public interface then perhaps it is time to refactor.

Too busy to blog...

No time to blog, I'm busy installing different versions of SQL Server. First I tried the Enterprise version, but that doesn't work on XP. So then I tried the MSDE but that didn't seem to be what I wanted either. So now I am trying SQL Server Developer edition which does run on XP.

With any luck I'll have some time for studying soon...

05 August 2005

28 July 2005

Small earthquake in Wells, no pigeons injured

An interesting article in the Wells Journal. A suspect package was delivered to the job centre, leaking a foul smelling substance. The police were called and in this time of heightened national insecurity they turned out in force with the fire brigade and declared it a CBRN(Chemical, Biological, Radioactive or Nuclear) type of incident.

As the city centre was closed the traffic built up and a local greengrocer, tired of being asked by slowly passing motorists what the problem was, put a message on his chalkboard outside the shop:- "Bomb in Wells JobCentre".

Later in the afternoon the police paid the greengrocer a visit, and seized the blackboard under the Prevention of Terrorism Act saying that it was "evidence".

I'm not sure what it could be evidence of.

The newspaper also reports 70 portions of Fish and chips were bought from Tuckers fish and chip shop for the Fire Brigade and 18 portions for the Police.

No jobcentre staff were harmed.

Extreme .NET

Craig Murphy's notes on Dr. Neil Roodyn's Extreme .NET presentation in Edinburgh.

27 July 2005

Installing ASP.NET 1.1

This link tells you how to install .NET 1.1 on IIS. You need this to create Web apps.

17 July 2005

Google Maps


I have been playing around with the Google Maps API and have created my very own photo album / map. The API is nice, but Javascript is horrible.

I have managed to get it working so that I can just edit an XML file to add new pictures. It would be nice to have a way of selecting the year and having just the markers for that year showing.

There is a strange effect where the information displayed in the InfoWindows sometimes overflows, but when you redisplay the InfoWindow it resizes correctly to contain the information properly. Not sure what is causing that.

12 July 2005

AJAX Matters

Apparently AJAX does matter.

09 July 2005

Grasshopper

Grasshopper is a free Visual Studio plugin that can compile MSIL to Java. So you can write in .NET and deploy your application to Linux.

Fragile Software Development

This is brilliant. The Fragile Manifesto. Read it and weep.

All we need now is a Fragile Alliance...

I really enjoyed this line:-
"A professional project manager, particularly one who is adept at creating and maintaining Gantt charts using Microsoft Project or another similar tool, is the most valuable person on any project."

When you get tired of this nonsense, this is where you can find the Agile Manifesto.

05 July 2005

Guidance Automation Toolkit

"Using the patterns & practices of the Guidance Automation Toolkit, you can make reusable code and pattern assets directly available in Visual Studio 2005."

As long as there is still something left for a programmer to do...

02 July 2005

Agile Advice

Agile Advice

01 July 2005

Agile Summer School

Agile Summer School - 8-12th August, 2005. Training for Agile Developers.

Alas, I shall not be attending this one. I have spent my training budget for this year on an event at MS in Reading and Dr Neil's Extreme .NET. But it gives me hope for the future of the industry that there seem to be an increasing number of agile groups, events and courses.

This looks like a very good course, with days devoted to Mock objects and FIT.

30 June 2005

Let's go!

This is very retro... The classic game of Lemmings is now available online.

29 June 2005

Google maps

Google have added satellite images for the whole globe to google maps, very impressive, although the resolution is a bit patchy in areas. Also the UK seems a bit squashed.

AJAX Wars

Microsoft probably wouldn't like to admit it, but their products improve when there is competition. AJAX is an example of this.

22 June 2005

Lots of tools

Scott Hanselman has an impressive list of developer tools that he recommends. But surely you don't put all of these on one machine?

19 June 2005

Extreme .Net

On Friday I attended another Microsoft event presented by Dr Neil Roodyn, on the subject of Extreme .Net. Dr Neil is an entertaining presenter, very laid back. I was so impressed I even bought his book.

It was a packed day, and the slides should be available for download soon. Here are some of my rough notes:-

XP puts people first, then practices then technology, as it says on the Agile Manifesto people are more important than processes.

One book he recommended was "Software for your head" by Jim McCarthy. I remember hearing Jim McCarthy speak at VBits in 1996/7, he was fun too. His ideas seem to have been quite influential in the Agile movement. Certainly I remember him saying something about building early and often. Dr Neil suggests having a machine dedicated to doing automated builds continuously. And, rather like NUnit it should display red if it fails or green if it succeeds. He demonstrated a simple batch file that he uses for this. Simple things work. In a project the first things you should sort out are the build process and intallation. This is iteration zero.

I liked the idea of killing bugs as soon as you find them, rather than putting them in a database where they can reproduce.

He also talked about promoting XP within organisations, you need to sell it as being faster and cheaper. I would honestly never have thought of that, but apparently it helps.

A recommended tool was SSW Code Auditor which is a flexible rule checking engine.

He described using MSBuild from the command line and calling custom processes from the build process.

User stories should not take more than 2-3 days to implement. Break them down into tasks of less than 4 hours, and don't spend too long on planning, maybe a couple of hours a week.
Creating tests before code is building quality in up front. It makes you think as a user of the class rather than an implementor. Changes the way you write code.

There were some good demo's of refactoring support in VS Team System. Also Team System supports a TestProject type and a nice test coverage tool.
He also showed us code for testing GUI's, it seems to take more code, but using reflection you can automate GUI testing. Another demo was of testing ASP.NET and load testing a web server.

He talked about the MS Solutions Framework and it seems there may be an XP version of this on the way.

Mehra Nikoo has blogged on his experience of the event.

17 June 2005

Autistic Pride Day

June 18th is Autistic Pride Day.

Theme for 2005: Acceptance not cure


12 June 2005

MS Acrylic

Microsoft Acrylic - a new graphics package. Obviously, acrylic pixels dry much faster than the traditional oil ones.

04 June 2005

Acceptance testing

James Shore... Beyond story cards... and Fit.

Visio Stencil for UML 2

Download from here.

Grumpy Old Programmers

What do grumpy old programmers believe?

23 May 2005

Storytelling

Today's word is...

Storytelling.

17 May 2005

Smuntzwood

Have I mentioned Smuntzwood? It's the perfect site for anyone thinking of buying some handmade wooden furniture. Especially if you live near Ashcott in Somerset.

DeveloperDeveloperDeveloper Day

The slides from the Microsoft Developer Day at MS in Reading are now available.

There were some really good sessions, I enjoyed:-
Patterns of Data Access in .NET: described a lot of patterns and NHibernate.
Test-Driven Developer Toolbox: Unit Testing, Mocks Objects Stephan Schoenig: A very good demo of NUnit and NMock.
What's new with web services in .NET 2.0: I don't know enough about Web Services.

It was really difficult to decide which sessions to attend.

04 May 2005

Time travellers convention

I don't understand this Time Travellers Convention thing...

"If the time travelers don't leave us their secrets, we won't be able to go back in time and see our convention in all its glory unless it is publicized in advance. "

Surely it doesn't matter if you publicise it in advance or after if someone is coming from the distant future. Hold the convention and then spend the rest of your life publicising it. But, if no one comes then you don't need to bother to publicise it and you can do something useful instead. I know there is a paradox here somewhere.

Personally, I think we are all time travellers, but it's a one way trip.

And if I am proved wrong, thank heavens I can come back and edit this. Hooray for Blogger's edit facility.

29 April 2005

FxCop gives interesting advice. With it's help I've gone from a very simple and incorrect...
using System;
namespace calc

To a much more impressive and correct...
using System;
using System.Reflection;
using System.Security.Permissions;
using System.Globalization;
[assembly:CLSCompliant(true)]
[assembly: AssemblyVersionAttribute("0.9.0.0")]
[assembly: System.Runtime.InteropServices.ComVisible(false)]
[assembly: SecurityPermission(
SecurityAction.RequestMinimum, Execution = true)]
[assembly: PermissionSet(
SecurityAction.RequestOptional, Name = "Nothing")]
namespace Calc

What all this means is as follows:
[assembly:CLSCompliant(true)]
This marks the code as CLS Compliant

using System.Reflection;
[assembly: AssemblyVersionAttribute("0.9.0.0")]
Allows versioning by adding an instance of AssemblyInfo.cs. This is also seems to be where you can specify a keyfile for strong naming.

using System.Security.Permissions;
[assembly: SecurityPermission(
SecurityAction.RequestMinimum, Execution = true)]
[assembly: PermissionSet(
SecurityAction.RequestOptional, Name = "Nothing")]
Marks the code as having the minimal security permissions.

[assembly: System.Runtime.InteropServices.ComVisible(false)]
The code is not COM visible.

using System.Globalization;
Allows for some culture info to be used when converting strings to double sor vice versa. Nice to be told about this now, before I decide to sell my calculator in France. :)

And finally...
namespace Calc
The namespace identifier should use PascalCase. Tut, tut.

It's a fairly impressive start to a program, and I can understand why they keep all this out of all the simple example code you see. The other recommendation is that the assembly should have a strong name, which is definitely something I should look into.

27 April 2005


FxCop. A very nice utility indeed... Posted by Hello

FxCop

I downloaded FxCop and installed it. It is something like NuMega Code Review.

I opened my calculator project .dll and ran the FxCop analysis...

FxCop scans the code and checks it against it's built in rules database which is based on Microsoft's .NET Framework Design Guidelines.

Apparently there are 1370 rules to follow, so I forgive myself for making 12 mistakes. The code review is very helpful, for each problem it finds it tells you how critical the fault is and provides a link to a help page that tells you how to resolve the problem. This is a very good way to learn about the design guidelines.

For example, it picks up on any instances where you have used the wrong case for identifiers. Obviously the more experience you have the fewer issues there should be. Definitely something to run regularly before checking code in.

21 April 2005

Unit Testing with TestDriven.Net

I downloaded TestDriven.Net a free tool that integrates with Visual Studio to make Unit Testing easier. You have to register and there is a survey to take before you can download.

After installing the add-in I added my test class to the project. Previously I had been keeping it separate. I also added a reference to nunit.framework.dll in the project. After this I right clicked on the TestCalculator.cs file in the Solution Explorer and chose Run Test(s). It ran immediately and 0.11 seconds later the results were ready...

------ Test started: Assembly: calc.exe ------
18 succeeded, 0 failed, 0 skipped, took 0.11 seconds.
---------------------- Done ----------------------

But alas, no green bar! The output is just not as pretty. Well I suppose that would be difficult to do.

Then I made one of the tests fail by asserting that it would get the wrong value. Again the output was not as pretty as in NUnit.

------ Test started: Assembly: calc.exe ------
TestCase 'NUnitTest.TestClass.DisplayInitialisesToZero' failed:
String lengths differ. Expected length=2, but was length=1.
Strings differ at index 1.
expected:<"01">
but was:<"0">
------------^
d:\source\c#\calc\calc\testcalculator.cs(25,0):
at NUnitTest.TestClass.DisplayInitialisesToZero()

17 succeeded, 1 failed, 0 skipped, took 0.12 seconds.
---------------------- Done ----------------------

This gives you exactly the same information you'd get in the NUnit GUI, except there is no red/green bar. It would be nice if the output was more graphical, but even so, it is much better to have the tests running inside Visual Studio.

20 April 2005

Other things

Lots of people are talking about things that are mostly not .NET...

Ruby on Rails which is an open source web framework

And Google maps which is now available in the UK.

And there is even a .NET wrapper .dll for AJAX

16 April 2005

Music software

It's amazing what you can do with a PC these days. It seems all you need to buy in the way of music hardware is a MIDI keyboard.

Free software from Psycle

Personal Web sites

The Personal Web Site Starter Kit is a Microsoft tool for creating personal websites.

More testing tools

Fit is a tool for unit testing. It can be used collaboratively to create user acceptance tests. The results appear as a web page. Fit was created by WardCunningham. It is free to download.

TestDriven.net is a tool for unit testing that integrates with the Visual Studio IDE. I've downloaded it and will be trying it out.

13 April 2005

TDD continued

Now my new calculator is working I have 18 tests and they all pass. I have deliberately not thought about the design too much.

There is quite a bit of duplication in the code. I'm tidying it up. It's almost refactoring, but as there is only one little class, really it's just reviewing the software as a whole. Up till now I'd been looking at just the functionality I was adding to satisfy each new test. This lead to a working program, but not one that I'd be proud to display.

To start with I moved any common code into new methods and then recompiled and ran my tests. Occasionally this warned me that I was introducing a bug and I was able to roll back and see that indeed the tests were right and it was not quite common code after all.

Then I reviewed the names I'd used. Some of them were pretty vague so I gave each method property or variable a meaningful name. The tests confirmed everything still worked.

What I plan to do now is to work on something else for a week or so, then come back to this project and try to add some more functionality. Perhaps I'll add some memory keys. The idea is that the tests should make it easy to continue development.

I added some comments as I was coding, but now I have removed these. The theory is that you don't need comments if you have unit tests and readable code. We shall see...

12 April 2005

Unit Testing Notes

The continuing story of my attempts at Test Driven Development...

I'm now writing a GUI application, a simple calculator. Windows needs a new calculator.

I've structured the application so that all the logic is in a calculator.dll file, the GUI only handles input and output, just as it should. This means I can have a separate test class to test the logic of my calculator.dll. I've used some modified sample code to add an array of buttons to the calculator form dynamically when it loads. This is in a buttonarray.cs file, which I'm not testing as it is part of the GUI.

After years of writing code first and then (maybe) writing tests a lot later, it is a very difficult habit to work against. This time I forced myself to write a unit test first, test it to see that result was red, and then start writing code to turn it green.

The first few tests felt really odd; it was a bit like trying drive somewhere using only reverse gear. Once I had about 10 tests done, and had run out of short term memory to recall exactly what they were, it started to feel more sensible to add another test as a way of starting on the next bit of the problem.

I deliberately didn't spend any time on restructuring or refactorinng the code, I took the approach that if it passed the test then it was complete.

It is true, each time you run the tests and the result is green, it does begin to give you more confidence that the latest change hasn't broken anything. And, when I did break the code trying to handle a particular condition, I was able to roll back a bit and start again.

This does mean that you really can focus on just the problem at hand, the new tiny bit of functionality you are trying to add, because you don't need to worry about breaking anything. If you break it, you will know. It feels a lot safer changing the code, when your tests are automated. It only takes seconds to run all those tests again.

I can see unit tests have some real benefits, so far I am not sure about some of the other claimed benefits.

04 April 2005

Unit Testing with NUnit

I downloaded NUnit version 2.2.0. To test that it was working properly I opened the bin\nunit.tests.dll and ran them. NUnit performed 605 tests which all passed so I guess it must work.

I started following Ron Jefferies Unit Testing examples. I got stuck because they didn't seem to work. It was telling me that .Assertion was deprecated and I should use .Assert instead. I didn't really want to get stuck on this so I decided to look for another "Getting Started" article.

I found an article on Unit Testing with C# on 4GuysFromRolla which has some sample code.
At first the TestClass wouldn't compile as the Person class was not visible. Anyway when I changed it to public I was able to compile it.

Then I tried modifying the Person class to be a Dice class with a single method Roll(), to roll the dice and return an integer, and a single property, Max to define the maximum value. I should have written the tests first.

To compile my dice class and it's test class I created a .bat file as follows:
csc /target:library dice.cs
csc /target:library /reference:nunit.framework.dll /reference:dice.dll TestDice.cs
The TestDice class references both the nunit testing framework and the dice.dll I want to create. Both .cs files are compiled as .dll's.

I wrote a test for the Max property and ran NUnit.

[Test]public void IsMax6()
{
Assert.AreEqual(6,dTest.Max);
}
It succeeded.

It was at this point that it dawned on me that choosing a dice as my first class to test was a bit daft. How do I test the roll method? The output is going to be random, I hope. I thought about testing the distribution of a number of rolls, but that would really be testing the random number generator from the .NET framework rather than testing my code. I decided I needed to test what I'm doing with the random numbers instead, whether I am scaling them correctly. Are the results in range?

I guess most of the time you are testing things that are repeatable or shouldn't be random. I decided to call the Roll() method a 100 times and check the maximum like this:-

[Test]public void isMaxRolled()
{
int j;
int maxRolled =
dTest.Min;
for(int i=0; i < j =" dTest.Roll();"> maxRolled)
{
maxRolled = j;
}
}
Assert.AreEqual(dTest.Max,maxRolled);
}

If I'm unlucky this could fail but most of the time it should pass. For some reason it was failing.

From having the Roll() method write a value to console and examining the Console output in NUnit I found out that I needed to create my Random object not in the Roll method but at the Dice object level, so that it is seeded once when the Dice is instantiated, not everytime Roll() is called. Otherwise with frequent calls you get the same seed value repeated for a while and then a new value.

I wrote a test for a Minimum property and found that I hadn't initialised it so the dice was actually rolling values from 0 to 6. After fixing that all the tests passed.

The code so far is…
TestDice.cs:

using System;
namespace NUnitTest
{
using NUnit.Framework;
///


/// TestDice for testing dice.dll
///

[TestFixture]
public class TestClass
{
Dice dTest;
public TestClass()
{
// TODO: Add constructor logic here
}


[SetUp]public void Init()
{
dTest = new Dice(1,6);
}


[Test]public void IsMax6()
{
Assert.AreEqual(6,dTest.Max);
}


[Test]public void IsMin1()
{
Assert.AreEqual(1,dTest.Min);
}


[Test]public void isMaxRolled()
{
int j;
int maxRolled = 0;
for(int i=0; i < j =" dTest.Roll();"> maxRolled)
{
maxRolled = j;
}
}
Assert.AreEqual(dTest.Max,maxRolled);
}


[Test]public void isMinRolled()
{
int j;
int minRolled =
dTest.Max;
for(int i=0; i < j =" dTest.Roll();" minrolled =" j;">


Dice.cs:
using System;
namespace NUnitTest
{
///
/// Dice - Random number generator.
///

public class Dice
{
int max;
int min;
Random
autoRand = new Random( );

[STAThread]
static void Main(string[] args)
{
Dice d = new
Dice(1,6);
}

Dice()
{
min = 1;
max = 6;
}

public Dice(int iMin, int iMax)
{
min = iMin;
max =
iMax;
}

public int Max
{
get{return max;}
set{max = value;}
}

public int Min
{
get{return min;}
set{min = value;}
}

public int Roll()
{
int i = Min + (int)((Max + 1 - Min) *
autoRand.NextDouble());
Console.WriteLine(i);
return i;
}
}
}

After this I went outside and planted three rows of potatoes because man cannot live by software alone...

28 March 2005

Free as in...

Free as in Freedom - Richard Stallman

100 year old eggs

How to make 100 year old eggs.

Not that you would want to!!

XAML

Chris Anderson's AvPad

10 March 2005

MS Agile

MSF for Agile Software Development

Various things

XAML.Net is a web site dedicated to informing you of everything XAML.

An item on .NET Memory Usage by Tim Anderson.

Test Automation for ASP.NET Web Services.

An article on Web Service Enhancements and WS-* specifications

14 February 2005

ASP.NET hosting

ASP.NET hosting

29 January 2005

C# eBook

Free eBook on c#, Dissecting a C# Application

02 January 2005

Dilbert...

Wally should have realised he was meant to write his own objectives, because "he owns his career".