Saturday, July 30, 2005

Uml Pocket Reference


Just been looking through this book and it is an excellent little guide to UML. And very cheap too, so there is no reason not to have it on your desk.


Wednesday, July 27, 2005

C# Xml Documentation

I was planning to write a short article on using the Xml based documentation tags for your C# code. But I just read my CodeProject newsletter and someone has beaten me too it. So i'll include their link instead.

I've only recently started using the xml doucmentation features in C# as at my last company they had their own documentation format and chm generation tools. But I think the C# documentation style is very good and complete. You can use a program called NDoc to generate your compiled help in a variety of formats.

Sunday, July 24, 2005

NUnit - The Unit Testing Framework

I recently started using the NUnit testing framework with a project at work. This is a reflection based system that can scan through your assemblies and execute specially declared test methods that you have written. This is very useful as you can run repeated tests on your code to make sure nothing gets broken. I think this tool is extremely useful and it has already helped me to track down quite a few bugs.

You can download the testing framework from here. Basically you include the NUnit assembles in your project, and then you create a test class. You prefix the test class with the
[TestFixture] attribute. Then you declare a load of methods of the form 'void MyFunc()'. You then prefix these methods with the [Test] attribute. You can have as many of these methods as you like testing bits of your code. The testing framework provides an Assert class and this has lots of methods like IsTrue, IsFalse, IsEqual etc. You can use these to check the return values from your code. If any of these methods fails, the Test Framework UI will report the errors and you can easily see where something went wrong and fix it. The screen shot below shows a series of tests I have run on a assembly. All the tests have passed in this example, but if one of the green dots turns red, that test has failed.



The following book is a very good book about unit testing with NUnit. Not only does it cover how to setup and use the framework, it also talks about different methods and techniques for testing your code. If you intend on using NUnit, then I seriously recommend you buy this book.


Traversing Hash Tables

I was talking to an engineer the other day who was just starting out with C# and he had a program that maintained a hash table. But for one part of his program he wanted to iterate through all the elements of the table.

Now for a non keyed collection such as an ArrayList you can use a simple foreach statement for the base type of the collection. So for example if you had an ArrayList of Int32's you would write the following:

foreach (Int32 myint in MyArrayListCollection)
{
// myint contains an element from the collection
}

Now to iterate through a hash table you need to iterate using a DictionaryEntry. So again for example, if you had a hash table containing a load of Int32 objects you would need to write:

foreach (DictionaryEntry dict in m_MyHashTable)
{
// myint contains an element from the collection
Int32 myint = dict.Value as Int32;
}

Or you could use an Enumerator:

public static void PrintKeysAndValues( Hashtable myList )
{
IDictionaryEnumerator myEnumerator = myList.GetEnumerator();
Console.WriteLine( "\t-KEY-\t-VALUE-" );

while ( myEnumerator.MoveNext() )
Console.WriteLine("\t{0}:\t{1}", myEnumerator.Key, myEnumerator.Value);
Console.WriteLine();
}

Nothing to complex, but if this new C# coder needed to know this, then I'm sure it would be usefull for someone else too.

Microsoft Vista

Recently Microsoft annouced 'Vista' their new operating system. To most of us for the past few years this has been known as Longhorn.

You can view a video of the annoucement and find details for joinng the beta program here.

Powering The Presentation Layer

Since started at my new job, I needed to decide on a .NET GUI library to use to save us a load of time when developing our tools. My job involves writing development tools for teams of game developers in the company. These tools need to be as user friendly as possible and look like standard Windows XP applications. That includes things like dockable windows and tool bars, and XP/Visual studio style visual themes. Now I could write that level of functionality myself but it would take ages and cost the company quite a bit of money.

The 2 options available to me really were Syncfusion Essential Tools, or Infragistics NetAdvantage. We used Syncfusion at a previous company, but I tried out both, and thought NetAdvantage to be the stronger of the two products as it was more focused on the UI elements that I would want to use. Also NetAdvantage was a lot cheaper. Our initial license cost about $995 dollars including priority support.

Book Review - Coder To Developer


I found a good review of this on amazon so I pinched it as it sums up the book nicely:

"As someone who is responsible for managing a small team of programmers and developing the methodologies and processes we use: I found this book a outstanding resource. It is generally a bit more biased towards the practical, rather than the theoretical. Giving reviews and advice on software such as bug tracking systems, code review tools, testing tools etc. It also contains good advice on coding practises, with helpful tips and code samples. The book best covers small teams or single developers, but may be useful for larger teams. Overall an excellent resource for any developer and particularly for anyone who leads a development team. "



Friday, July 22, 2005

Quick UML Tutorial

If you're looking for a quick uml tutorial to teach you the basics at about 400mph, then I recommend this tutorial on the Borland site. I found it very useful as I have only just started using UML myself.

Reflector

Reflector is a tool that lets you decompile the contents of a .NET assembly and view the source in a .NET language like C# or VB.NET. The decompiled assembly isn't identical to the original source as variable names are not preserved, and some optimizationd may have taken place, but this tool is great for seeing how things work, especially in the .NET framework base classes. I highly recommend downloading it.

Book Review - Head First Design Patterns


I finished reading this book this week, and I have to say that it is very good. This book is not my first experience with design patterns as I already own and have read the Gang of Four design patterns book. But that book I found very hard going in that it is very long winded. Although I'm not saying the Gang of Four is bad, because it is very good. But the head first book takes a unique approach into learning design patterns which makes it actually fun. Head First Design Patterns is very visual, and lots of pictures and diagrams are used to describe what is going on. It is also quite humorous both in the examples and the explanations, and because of this a lot of the principles stuck in my mind better. I personally recommend you buy Head First Design Patterns along side the Gang of Four book. Read the Head First first though. This book is ideal for students starting out with design patterns on a software engineering course.

You can buy the book from Amazon.co.uk

Thursday, July 21, 2005

An Extensive Examination of Data Structures

I found a useful article on the MSDN site. This article discusses some of the built in .NET collections, and discusses creating other collections like graphs and sets.

Here is the summary from the article:

" Summary: This article kicks off a six-part series that focuses on important data structures and their use in application development. We'll examine both built-in data structures present in the .NET Framework, as well as essential data structures we'll have to build ourselves. This first installment focuses on defining what data structures are, how the efficiency of data structures is analyzed, and why this analysis is important. In this article, we'll also examine the Array and ArrayList, two of the most commonly used data structures present in the .NET Framework. "

New Blog

Hi

This blog is a place for me to collate information about software development. The main purpose is a repository of information so that I don't forget things, but hopefully this information will be useful for other people too. I generally read a lot of books on software development so I will also post book reviews here too. I was going to include this information on my personal blog, but decided it would be good to create a separate one. My personal blog can be found at

http://thehauntedhouse.blogspot.com/

The main software development platform I use is C# and the .Net framework, so this will be the main emphasis for this blog.