software development
Unit testing framework for BizTalk solutions
I didn’t know such a thing existed before today, but thanks to a couple of consultants in my office, now I do. The cleverly-named BizUnit is available at codeplex.
The information on this project indicates no dependencies on any existing unit-testing frameworks (NUnit, MbUnit, etc). Having not used BizUnit, I’m not sure whether that’s good or bad either way.
Unit testing assemblies with internals
How do you unit test an assembly if the vast majority of its methods are declared “internal” (in C#)? Before today, I had no idea. Fortunately for me, one of my consultants had this exact problem last year. The solution:
[assembly: InternalsVisibleTo("UnitTestAssemblyName")]Putting the following line in AssemblyInfo.cs for the assembly you wish to unit test makes everything declared "internal" available to UnitTestAssemblyName.
This is a vastly superior option to cloning the assembly you want to test and making all the internal members public.
App_Offline.htm
I came across a couple of useful posts from Scott Guthrie about App_Offline.htm. This page appears and disappears automatically when the “Publish Web Site” option is used. What I didn’t know is that it’s part of the .NET framework (not the IDE). This means the page can be added and removed manually. This will be especially useful in my current environment, where we depend on network engineers to deploy web applications to test and production sites.
Here are the posts: App_Offline.htm and IE Friendly Errors
SQL Server Cursors
Personally, I dislike them. I avoid using them whenever possible. But I came across this excellent post that talks about cursors, alternatives to cursors, and provides a performance comparison between them.
The performance comparison in particular was quite useful. If I’m able to reproduce the results for myself in a local environment, I may have to revise my current stance on cursors.
Getting rid of ThreadAbortException
We came across this on one of my current projects. It didn’t prevent the application from working, but I didn’t want a bunch of instances of it in our error logs. One of the consultants who works for me found this Knowledge Base article that solved the problem.
The basic fixes are:
- Call Response.Redirect like this:
Response.Redirect ("nextpage.aspx", false);
- Call Server.Execute instead of Server.Transfer
Short circuiting in .NET
Last week revealed an interesting difference between C# and VB.NET. C# operators like “and” (&&) and “or” (||) do it automatically. The VB.NET operators “And” and “Or” don’t do this by default. So if you use these, all the conditions are evaluated, regardless of whether or not that’s necessary.
In the .NET 2.0 Framework, instead of making these operators work like the C# ones, VB.NET added two new keywords: AndAlso and OrElse.
It’s good that VB.NET has the facility, I just don’t like the implementation. It’s another reason to prefer C# at the very least.
Agile vs. Waterfall
It seems clear enough to me which approach is the best way to develop software, but not everyone in my office seems to agree. So I thought I’d do a bit of research on the two approaches and summarize my findings here. I really wanted to find some impartial statistics that compared the productivity of the two approaches. In addition to the usual Google searches, I included information I could find from the Software Engineering Institute (SEI) and the Association for Computing Machinery (ACM).
The first comparison of the methodologies I reviewed was on pages 23-24 of a PDF I found at SEI. The comparison mapped waterfall activities to agile activities and highlighted the key difference–the waterfall methodology lacks an opportunity to demonstrate the output of an iteration and make improvements based on feedback.
The first statistics I could find came from this wiki entry. While they’re specific to a single company, they make a very compelling case for the use of agile methods. Agile methods (specifically SCRUM) delivers more lines of codes, with fewer defects, in less time than waterfall methods.
Coding Guidelines
Another free e-book, this time on C# and VB.NET development standards. Fair warning, you do have to provide an e-mail address to download it.
We’ve needed something like this at my current employer for a long time. Come to think of it, my previous employer could have used this too. I worked with some colleagues to put together a small SQL standards guide to direct our database development. I wanted to write a companion document for our .NET development efforts but have had far too much other work to do.
Free .NET Book
Charles Petzold has written a book titled .NET Book Zero. It’s a guide to implementing application in C# targeted at C and C++ programmers. I haven’t read it myself yet, but I plan to. I hope it’s a resource I can use to help build the skills of developers that report to me who aren’t familiar with C#.
The author has made it available in PDF and XPS formats. There’s source code too.
Sandcastle Rant
I came across this excellent post on the problems with Sandcastle, the Microsoft offering for generating help documentation for .NET 2.0 assemblies. In addition to pointing out the problems with Sandcastle, the author (Grant Drake) brings us up to date on the status of other successors to NDoc. As someone who used NDoc 1.3 a lot on projects in the last couple of years, I was very disappointed that the author decided to discontinue work on NDoc 2 (especially since we have mailbombers to thank for the loss).
More on VSI files
A bit of “googling” turned up these links:
- An MSDN entry on the subject
- This link to a Power Toy for automating the creation of VSI files
Visual Studio Templates for Test-driven Development
I came across this blog post earlier today via Mike Gunderloy’s Larkware.com. One of the comments requested .VSI files (the templates are for NUnit and MbUnit and are made available as zip files). That probably would be a nicer way to package this. Even without it, I’m glad to see anything that encourages test-driven development. I’ll definitely use this with my development team soon. I should probably learn how to create VSIs anyway.
India Skills Gap
I came across this article in one of the e-mail newsletters I subscribe to. It’s highly relevant to my current role because we use a lot of offshore staff for our work through companies like Tata Consultancy Services (TCS).
The rise in salaries and the springing up of private schools for training people in IT is just what basic economic theory would predict. The quality concerns are predictable as well. Before I joined APS, I asked some consulting colleagues how they would rate the various Indian IT firms. They had strong opinions on which firms were best. A lot depended on where they recruited and how experienced their hires typically were.
One area the post didn’t address that is quite important is turnover. Because salaries in India are going up, that makes it challenging for firms to retain talent for any length of time. This can certainly impact quality for companies like mine that use one or two offshore firms exclusive because we just don’t know who they’re backfilling with when they lose talent to other companies.
It’s certainly possible that India could start losing IT work to China. But I suspect that eastern Europe and some of the former Soviet republics are just as likely to get some of that work. Philip G. Armour’s column in the latest issue of Communications of the ACM talks about a technology firm in the midwest that’s been quite successful with an offshore team in the Ukraine.
Yet another xUnit testing framework
I wasn’t aware of the existence of SPUnit until a consultant mentioned it yesterday. I’m not sure how deeply I’ll look into it (if at all) because of how many other testing frameworks that I really need to understand.
The SHAPE command is the bane of my existence
I inherited some classic ASP code not long ago that needed some enhancement. The look-and-feel of the site is pretty nice, but under the covers there’s tons of the inline SQL I hate so much. But worse than that is the previous developer’s use of the SHAPE command. I’d never used it, even when I last wrote classic ASP with my own hands (around 2003). Once this project is over, I hope never to see it or use it again. I’m really struggling to understand how it works (and why things were done this way). I’m hoping this article will help me figure it out. I’m grateful that someone took the time to actually develop a formal grammar for this command. It reminds me a lot of the BNF notation we learned as 1st year computer science majors in college.
More on databases and business logic
This particular entry in the “forever war” of whether to use object-relational mapping or stored procedures does a better job than most in these ways:
- It changes the argument from "either-or" to a situational one.
- It broadens the scope of database objects in the discussion beyond stored procedures to include functions, triggers, views, constraints, and referential integrity.
- It rates the suitability of each database object to a particular task.
Source Code Control
I came across this post from Joel Spolsky last week (though I’m just now getting around to blogging about it). We’re using Team Foundation Server for source code control at work, and we’ve managed to have the problems of check-ins breaking the build and too few check-ins to have a good delta of changes at the same time. While the applications we build at APS Healthcare aren’t the size of an operating system as far as lines of code, the branching-and-merging idea Spolsky describes would probably be useful to us.
Common causes of the System.NullReference exception
I came across this blog post today while researching a problem with one of our applications. The most interesting thing I found about this article was the comparison between VB.NET and C#. It’s one of a few I’ve seen that goes beyond the syntactic differences to deeper issues. The examples in this article show cases where C# wouldn’t even compile code that runs in VB.NET (and throws exceptions at runtime). C# makes you work harder to write code that compiles and throws exceptions at runtime. It’s yet another argument in favor of C# I hadn’t considered before reading this post.
The right penalty for breaking a software build
Maybe I should institute this at my office on Monday.