Rolex logo design using the replica watches crown icon and letter design would like to combine, which also positioned Rolex in the breitling replica watch industry status of the king, while the entire Swiss watch industry in the swiss replica watches folk has a good reputation.
John's Corner | Technology and .NET wanderings | Page 2

Blog

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.

Posted in Review, Testing | Leave a comment

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.

http://content.screencast.com/users/ImajiWolfshead/folders/Jing/media/f9373624-cb21-41d6-8d31-ff695a2e1f86/jingswfplayer.swf

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.

Posted in .Net, .Net 4.0, Visual Studio 2010, VS, VS2010, WF, WF 4.0, Workflow | 1 Comment

WF 4.0 – Part 1. The Sequential Designer

Posted in .Net, .Net 4.0, Visual Studio 2010, VS, VS2010, WF, WF 4.0, Workflow | Leave a comment

Slides for the Intro to WF 4.0 talk

I’ve uploaded the slides for my Windows Workflow Foundation 4.0 to my SkyDrive, you can get at them via this link.

http://cid-b80e09d7827ce7cc.skydrive.live.com/embedrowdetail.aspx/Intro%20to%20WF%204.0

Now includes code for the 5 basic demos.  Enjoy the coding goodness!

Posted in .Net, .Net 4.0, Visual Studio 2010, VS, VS2010, WF, WF 4.0, Workflow | Leave a comment

Upcoming events at NxtGenUG Southampton

Over the next couple of months we will be continuing our Web technologies theme by having Ben Hall down to talk about Testing ASP.Net applications on the 20th August. We’ve also managed to grab some uber swag from TypeMock and some of Roy Osherove excellent “The Art of Unit Testing” eBooks to give away! You can register here.

Then on 17th September we’ve got Yossi Dahan stopping by Southampton again, no BizTalk this time, but the new Windows Identity Framework! The Windows Identity Framework is Microsoft’s offering for dealing with federated security. You can register here.

Then on 22nd October for our 2nd Birthday(!) we’ve hosting the follow up grudge match between Phil Winstanley and Sebastien Lambla as they duke out the merits of ASP.NET WebForms against ASP.NET MVC (and OpenRasta!). This was a very highly rated session in London, and promises to be very entertaining and informative. You can register here. More details to follow for this session on the site soon!

Posted in .Net, ASP.Net, Geneva, MVC, NxtGen, Testing, TypeMock, Windows Identity Framework | Leave a comment

Twitter on Windows Mobile 6

Over the last month or two I’ve been looking for a Twitter client for my HTC Touch Pro, as I wasn’t too keen on the mobile web version. I asked for recommendations on Twitter and the majority of people recommended either Pocketwit or Twikini.

I downloaded both clients so I could test them out simultaneously on the device during my day to day activities. All pictures taken from the relevant twitter client site. So here are my findings:

Pocketwit

Pocketwit had the more flash of the two interfaces, allowing the user to scroll up and down the timeline using via the phones touch screen. The tweets were in a nice big font with the person avatar to the right hand side.

Navigation was performed by dragging the tweets either left for context specific options on a tweet or right for a main menu like set of options. Whilst this looked excellent I found the binding to selected tweet was a little dodgy as sometimes the context menu wasn’t for the currently selected tweet.

I also had problems swapping from vertical to horizontal screen orientation when I opened the keyboard. The screen would get stuck in the previous orientation which meant options and navigation became a bit fiddly.

Twikini

Twikini has a more classic windows feels to it and doesn’t take advantage of the touch screen for navigation. Friends, Mentions and Direct Message are selectable from a menu option which then loads the appropriate timeline.

The tweets themselves are not always displayed in full, so you do have to open a tweet from time to time to read it in its completeness. Each tweet has the users avatar to the right of their tweet, and the text is in a very readable font.

During my use of Twikini I didn’t encounter any of the selection and orientation problems I had with Pocketwit, which has lead me to stump up the huge charge of $5 to get a full license :) A couple of weeks on, and I’m still happy with the client.

If I were to change anything about Twikini I would include some sort of status bar on it so I can see any new mentions or direct message, as currently I have to open those timelines up explicitly to see if any have arrived.

Conclusion

Both are cracking clients, but for the time being I’ll stick with Twikini, even though Pocketwit is free. Once Pocketwit gets out of Beta I’ll be revisiting it to see if they’ve managed to sort out the bugs that were enough for me to opt for Twikini.

Posted in Twitter, Windows Mobile, WM | 4 Comments

PRISM Assault Course and Julys event at Southampton NxtGen

Yesterday I passed the WPF MCTS, YAY! One of the reaons I wanted to get this done is to help me with the PRISM Assault Course I’m currently putting together with Peter Cook (who’s blog can be seen here). If there’s an area of PRISM you’d be interested in seeing, drop me an email or leave a comment and we’ll see if we can work it into the agenda.

We’re currently tracking down a venue and sorting out the agenda, but we hope to be kicking off the event in either August or Septemeber. Further details to follow :)

Also this month at NxtGenUG Southampton on the 16th (July) we’re be hosting Mike Ormonds ASP.NET 4.0 talk, which promises to be damn interesting as it will be covering all the new exciting areas of the upcoming release.

We’re also be having a nugget from Mark Heath on managed Audio wrappers in in .Net.

You can register for the event here.

Posted in Assault Course, NxtGen, PRISM | 1 Comment

Slides for my PRISM-tation

Here are the slides for my Introduction to PRISM session that I given at Birmingham and Southampton.

http://cid-b80e09d7827ce7cc.skydrive.live.com/embedrowdetail.aspx/PRISM

The code examples are to follow.

Thanks to everyone who attended! All comments welcome :)

UPDATE – The code is now up as well :)

Posted in .Net, CAB, NxtGen, PRISM | Leave a comment

WF 4 talk at the GL.NET User Group

I’ll be doing a Windows Workflow Foundation 4 talk at the GL.NET User Group on the 12th August 2009.

The talk will be covering the Beta 1 release of VS2010 and Windows Workflow Foundation, unless Microsoft releases another Beta/Release Candidate by then ;). I’ll be looking at the new features of WF 4.0 like the new Workflow Designers and the WPF based Activity functionality.

If you fancy coming along go here to register and I’ll see you there!

Posted in VS, VS2010, WF, WF 4.0, Workflow | Leave a comment

Typemock Giveaway!

In my current contract they use TypeMock and I must admit that before I’d started here I used the free mocking frameworks like Moq and RhinoMocks instead. Having three coding API styles is really nice so you can choose the syntax that suits you best :)

I just found out typeMock are running this promotion adn I just at the chance to get a TypeMock license.

Unit Testing ASP.NET? ASP.NET unit testing has never been this easy.

Typemock is launching a new product for ASP.NET developers – the ASP.NET Bundle – and for the launch will be giving out FREE licenses to bloggers and their readers.

The ASP.NET Bundle is the ultimate ASP.NET unit testing solution, and offers both Typemock Isolator, a unit test tool and Ivonna, the Isolator add-on for ASP.NET unit testing, for a bargain price.

Typemock Isolator is a leading .NET unit testing tool (C# and VB.NET) for many ‘hard to test’ technologies such as SharePoint, ASP.NET, MVC, WCF, WPF, Silverlight and more. Note that for unit testing Silverlight there is an open source Isolator add-on called SilverUnit.

The first 60 bloggers who will blog this text in their blog and tell us about it, will get a Free Isolator ASP.NET Bundle license (Typemock Isolator + Ivonna). If you post this in an ASP.NET dedicated blog, you’ll get a license automatically (even if more than 60 submit) during the first week of this announcement.

Also 8 bloggers will get an additional 2 licenses (each) to give away to their readers / friends.

Go ahead, click the following link for more information on how to get your free license.

Posted in TypeMock | Leave a comment