21 Sept 2009

Win a ticket to TechEd Berlin!

As we approach TechEd 2009 in Berlin, NxtGenUG will be running our yearly contest to win a ticket (no flights or accommodation included) for the event.

So what do you have to do?  Well, pop over to the competition page and give us a caption on what’s happening between Richard Costall and John Price :)  Simple eh?  So what are you waiting for?  Get over to the competition page and starting captioning!

17 Sept 2009

My new eBook reader

A couple of weeks ago I treated myself to a new toy! I got myself a Sony PRS 505 just as Sony announced there new models. I’m not worried though, as I got it for £149 form John Lewis in sexy Red :)

So why did I buy one? Well I’ve got an increasingly large number of PDFs and eBooks and I hate reading them on the screen. I also wanted to be able to read them away from the computer. I choose the PRS because it is currently the cheapest of the bunch and I wanted to see if I would get on with a reader.

So, first impressions. The PRS 505 has a nice crisp clear screen and I haven’t had any problems with glare off of it. The page refresh is definitely slower in PDFs compared to the LFR/ePub books, but not to the extent where it’s a problem. In fact, I did my review of The Art of Unit Testing using it. The PDF layout isn’t ideal as it can be a bit small, but the reader can increase the font size :) So do I like it? Yes, I think it’s fantastic!

The downside? There is one, and it’s the software you get with it. Sony have really let us down with their library software. First off it regularly crashes if you either try syncing all your books in one go, or on some large books. Secondly the UI is terrible! They’ve based it on iTunes off yester year and the feedback for copying UI files it terrible. A single progress bar that never moves :( Guys, seriously, progress bar per book, not per number of books! Lastly, and this is the biggest shame on Sony, it’s not Windows 7 compatible! Come on, Windows 7 has been available for an age to developers now, why isn’t it compatible. Oh, and before you say well the OS X version is better, it’s not I’ve tried it on my Mac with exactly the same problems!

So to sum up, an excellent reader let down terribly by the software. Now that I know I like eReader, I’m looking at getting a BeBook. If you’re getting a BeBook, please help me by using my email address imaji dot wolfshead at ntlworld. dot com in the discount coupon box and you'll get 25 Euros off!

14 Sept 2009

Review - The Art of Unit testing by Roy Osherove

I was lucky enough to get hold of a review copy of The Art of Unit Testing by Roy Osherove from Manning.

I thought this book was excellent, but it came to me 6 years too late! If you're just starting out down the unit testing/TDD route then I would highly recommend you get this book and give it a read. It's broken up into 4 parts, each part building on the concepts from the previous part.

The first part sets the arena for the rest of the book by providing concise definitions of what Unit and Integration tests are, as well as introducing the reader to the concept of Test Driven Development (TDD). Part 1 ends with chapter 2 that walks the reader through an example of putting together their first unit test.

The second part then starts looking at ways of making your code loosely coupled so that you can test more effectively and start using Fake objects. Roy does this by introducing the concept of Dependency Injection (DI), otherwise known as Inversion of Control (IoC), and then how you can utilise DI to make use of Stub and Mock objects in your tests. The second part ends with the introduction of Isolation Frameworks and looks at how they can ease the complexity of using Stubs and Mocks in your Unit Tests.

The third part then starts moving in to the more practical side of Unit testing now that the groundwork has been established in the first 2 parts. Roy takes the reader through the various patterns that can be used for test classes and how you can utilise them in a Test Hierarchy. Roy highlights that a Automated Build process is essential for running your test regularly to pick up any breaking changes that may have occurred in your app. Chapter 7 then moves onto the critical area of how to write tests that are maintainable, trustworthy and readable.

The final part is aimed at the the devs out there who are coming from existing organisations that don't do Unit Testing, but want to introduce it, or have started Unit Testing in their new app, but want to start Unit Testing their legacy code. Roy provides some good pointers on how to get Unit Testing accepted by teams less than eager to pursue new practices :)

The book also contains 2 appendices, one attempts to answer the question of how much testing should influence the design process and the second provides a good overview of the Isolation Frameworks, Tools and Test Frameworks currently available to make your life a little bit easier when you're testing.

Summary

If you're looking for a good book to get yourself, your fellow developers or team up to speed with good Unit Testing practices, then I'd highly recommend this book. If however you're a TDD guru, or have been unit testing for a while you probably won't get as much out of this as those who are new to Unit Testing.

7 Sept 2009

WF 4.0 - Part 2. The Flowchart Workflow & Designer

UPDATE – Now Beta 1 Friendly!

The following is based on Beta 1 of WF 4.0 and as such might change or be missing in futures releases.

In Part 1 of this series of articles on WF 4.0 we started by looking at the new Sequential Workflow Designer, and creating a basic Sequential Workflow that added greeted a User. In this second part we will be looking at the new Flowchart Workflow and its designer.

So whats a Flowchart Workflow?

The Flowchart Workflow is a new hybrid of the Sequential and State Machine Workflows that we are already familiar with from 3.x. Even though WF was designed to be extensible so that people could extend it with their own custom Workflows, Microsoft found that a very large percentage of their customers using WF were bending over backwards to crowbar their Workflows into either the Sequential or State Machine types when neither were appropriate. From this Microsoft identified the need for a hybrid type, and this is the result.

So what do you use it for? This is easier to follow if we define when you'd want to use a Sequential and State Machine Workflow first.

So when do you use a Sequential Workflow?

The Sequential Workflow is ideal when you want to model a process that has a defined start and end points and follows a defined (linear) path through a number of Activities. Here's an example:

As you can see even though we have branches in the Workflow, we always go through the same activities and end at our defined point. The Sequential is ideal for modelling Processes.

So when do you use a State Machine Workflow?

The State Machine Workflow is ideal when you want to model a process that doesn't have a defined path and could be one of many paths that will be taken through the Activities. A State Machine does not necessarily need an End Point. Here's an example we're all familiar with.

The State Machine was for Version Control, and as we all know there is no definite path as to how we perform our check in/check outs. One of the best uses for the State Machine Workflow is for Lifecycles of objects, where we have a defined number of States an object can be, in but the direction of state changes comes from an external source.

What about this new Flowchart Workflow?

So hopefully you've now got some idea as to what the original Workflows could do and where they might be used. We can now take a look at the Flowchart Workflow. One of the biggest differences between 3.x and 4.0 is that there is no longer any restriction on which kind of Workflow an Activity can be used on, so our Flowchart Workflow can use exactly the same activities as we did on the Sequential example.

So first off the designer.


As you can see we have the same features as before from the Sequential designer, but this time we have different rules as to how the Activities interact. First off we no longer get connections for free between activities. This is of course down to the nature of the Workflow type, as the designer can't guess what Activities we want to join together and how. So to join Activities together we select the start Activity and then drag one of the edge connectors to the target Activity's edge connector.



Again Variable and Arguments are used in exactly the same way as we did with the Sequential Designer. The Flowchart Workflow currently comes with 3 extra Items (not Activities) that allow us to add decision logic into the Workflow. The first is the FlowDecision which acts as a simple If statement in the logic.



This is actually a very simple Item to use, again dragging from either the green True connector or red False connector to another Activity will give you the path when either a True or False result comes from the Condition you set. The Condition is something that evaluates and returns a boolean result. So far I've been using things like VariableName.Equals("StringToMatch") for the condition. I suspect that in future releases this may have some sort of Expression Editor to it (but this is just my speculation).

The second new item is the FlowSwitch, and looks very similar to the FlowDecision.


OK, so lets put this altogether. I'm going to create a simple Workflow for Pizza management at User Group talks. It's going to ask us our location, if its the home region of Southampton then it'll tell me I need to order Pizza. If it's not Southampton, I'm doing a WF talk somewhere else so I remind the User Group leader. Then because I could in theory be doing a marathon number of talks in one day, it'll ask if my location has changed and if it has we go back to the beginning, otherwise the flow end.

Using the custom Readline and Writeline Activities that were also used on the Sequential Workflow, this is the result. For details as to how to bind to Variables and create them, see Part 1.


A screen cast with the construction of the Pizza Flowchart, will follow shortly.

In Part 3, we will be looking at creating a custom Activity.