But it works on my PC!

The random thoughts of Richard Fennell on technology and software development

'Aah, VSTO!' ... cooking up an OBA solution

I have been doing some Visual Studio Tools for Office (VSTO) development in Word of late, not exactly a pain free experience.

First thing to say is that even given all the marketing spiel, VSTO is not that different from VBA in older versions of Office.

To get going I create a new VSTO 2008 Word 2007 Template project based on an import of our old Word template (to get styles, layout etc.). I then basically cut and pasted the logic from our old VBA macros into an ActionPane in the new one and it just worked.

Well I said it just worked, I had out of habit I had picked a C# project, I should have chosen VB.NET (as is commonly recommenced for VSTO development) as then the code would have been virtually correct. As it was I had to spend a while adding {} and ; to do the language port.

So why did this work? VSTO is new(ish) any shiny and VBA is old and VB. However, they are both in effect wrapper APIs to the underlying Office COM Interop layer, so what they can do and how they do it is dependant on Office, in my case Word 2007. Ok you can do different things in Word 2007 to Word 2.0, but it is still in essence a Word processor where you manage content with ranges.

The reason people recommend VB.NET for VSTO development is due to the COM Interop. Visual Basic has always made it far easier to use COM objects, not least due to optional parameters and variant types.

Now as of yesterday some of these problems are addressed by the release of VSTO Power Tools and it COM wrapper API, but this API will certainly not address all issues.

Another thing that has has not changed over the years is the documentation, the MSDN references are OK but there is little is else. Especially when doing integration work with Sharepoint WebServices as I was. I have found I had to make heavy use of the debugger to investigate the XMLNode object being returned to work out that was going on.

In Word development I have commonly found that initially there are things I think I can't do because the object I need does not appear to be exposed by the object model; only to find what I am looking for in a place that is not that obvious to me. However you still have to use the object in some 'dark arts' style to get the effect you require. A classic example of this is managing programmatically the document cover page from the building block gallery. To get this to work there are many hoops to jump though.

VSTO is powerfully but not as flexible as you would hope as you have to live inside the design metaphor of the Office application you are hosted in. You have to consider carefully if the functionality you are trying to add is really relevant to the application it will be hosted in.

Sharepoint is like a shelf that is too short.....

You have all these books to put on a shelf and as you put one on at one end another one falls off at the other. You just can't get them all on at the same time.

What do I mean by this?

Sharepoint has many features and with these come limitations due to the way features have been implemented. I am repeatedly finding that to use feature A means that you cannot use all of feature B. Historic choices can have a huge impact on what can be done in the future.

A classic example is the choice for AD or Forms authentication. Many WebParts rely on one form of authentication or the other. Few will work with both; and using AD authentication as a back-end to Forms authentication (via LDAP) just raised new issues on top of the existing ones.

This means some careful planning and pilot studies need to be done early in any Sharepoint project to make sure that set of features you want to use are compatible with each other and you are not painting yourself into a corner for the future.

Next meeting of the Extreme Programming Club

The next meeting of the extreme programming club is going to be held on the Thursday the 14th of February 2008 at the Victoria Hotel, at 7.00pm, Leeds. Get Directions ยป

Next meeting is happening on Thursday 14th of February

There are going to have two shorter, or rather more agile talks:

"CRAP hits the fan - Change Risk Analyzer and Predictor" - new kid on the block of software metrics and static code analyzers presented by Daniel Drozdzewski - Java developer at Erudine. This presentation focuses on software metrics in general or rather their failure and proposes gentle solution supported by examples in Java.

"Zero tolerance for bugs" - Ralph Williams one of very few agile testing gurus out there with many years of experience as a test manager in various IT companies is going to present his view on bugs and promises to support it with plenty of examples and anecdotes from the industry.

New Banner Image

I felt it was time for a new banner image, my triathlon photo had been up a while. So I have used one of the new cartoons our designer Lauren has done for all the staff at Black Marble.

Commemorative limited edition collectors plate will soon be available.

Oh to be a tester....

Whilst at the Alt.net conference it was pointed out that I have a different view of the role of a tester in a software development team to many other people. It seems a tester, to many people, is viewed as a person who follows manual test scripts and/or monitors automated systems, they are really part of the QA process not part of development.

Now to me this is just wrong. I started, a good while ago, in electronics testing and yes we did have people who sat with test gear and checked circuit boards gave the right voltages etc.; but we also had a test development team who built the test harnesses, scripts  and tools. It is this second group in my option that equate to software testers - they are developers who write code to enable testing. They might do some manual testing but as much as possible this should be automated; we have computers available to us, so make them do the repetitive test work whenever possible.

This all takes some explaining when recruiting as many people do see testing as a bit second rate, just something to do until you get a 'real' development job. As you might guess I refute this idea, to me a test role (or should I call it test development role) is where you get to play with the cool tools. If you are doing main line of business development your life is all datasets, standard UI controls and web services. Most line of business work does not thrive on innovation so you are bound to be doing repetitive work.

But the test developers get to use reflection, writing development tool extensions, play in edge conditions and innovate using things like generic algorithms and open source tools to test the boundary of what is possible. They get to think outside the box.

Also there is a great chance to show what you can do in the community. I would say community test tools and frameworks are one the most active areas.

There is also the satisfaction of seeing the whole picture of a project, by the very nature of the build process and integration testing the test developer gets to play in every area.

Is this a view of testing I am alone in holding?

I have convinced you all to become a test developer?

First Alt.Net.UK Conference thoughts

I am sitting on the train heading north. After deciding trying to stream the England/Wales match from iPlayer on the train WiFi was probably not a good idea, especially after just reading the score, I though I should write about the Alt.Net UK Conference; a very interesting experience. It is great to meet so many people who are so enthusiastic over their jobs and learning how to do it better. There were some faces I knew from DDD and other community events, but also many new faces. I was surprised by the distance some people had travelled, I met a good few from around Europe, but I think Roy won the prize with a trip from Israel.

One of the ideas of Alt.net, being an open spaces conference, is to be surprised and I have certainly come away with things to think about, and a good set of tools to try. Anyone who was here will have heard me bang on about how Sharepoint is a pig to test and deploy; but I may have seen a distant light at the end of the tunnel (maybe an on-coming train I admit) and think I can apply MVC to SP webparts (and hence IOC) which should make my testing life easier. Expect a post on this soon.

Another surprising thing for me was that people we vaguely interested in the GUITester framework I wrote a while go that allows you to express GUI functional tests as attributes on WinForm GUI controls, thus trying to address some of the brittleness of GUI testing (a common discussion today i.e. when you refactor code - if you alter a control definition at least the attributes are close by to edit).

Today for me was focused on best practice like so many events I have been to in the past year. To me this is a great sign of maturity in our industry, people want to talk about how to start projects so they have the best chance to succeed and continue to improve as they go on. However, the question does remain how to engender this attitude the (below?) average development team who is doing 9 to 5 and does not want to learn because that ended at University.

For more notes on what went on today, have a look at http://altnetpedia.com/, attendees should be adding their notes over the next few days.

Anyway I reaching Doncaster so I have to change to a non-WiFi enabled local train now, more later.