Wednesday, July 14, 2010

In the Cloud

Diligent Software is now hosted in the Cloud courtesy of Rackspace Cloud. What does this mean? For one, I am now able to deploy the latest technologies such as Windows Server AppFabric and Microsoft .NET 4.

I am also looking closely at Microsoft Windows Azure as a future deployment vehicle.

Sunday, August 16, 2009

Code Coverage in Visual Studio Team Suite

I recently started using Visual Studio Team Suite 2008. Normally these tools are not very affordable, but through the magic of  Microsoft Bizspark, they are within reach for the software startup.

One of the VSTS features that interests me most is code coverage metrics for my unit tests. I normally use Resharper as my test runner, but to enable code coverage I needed to use the VSTS test runner. My first challenge was to get my NUnit 2.5 unit tests to work properly in VSTS.

Here are the steps I used to make this all work for me:

  1. Download and install NUnitForVS, an open source plugin that enables the Microsoft test runner to see the NUnit project as a test project.
  2. Next modify the project (.csproj or .vbproj file) to be marked as a test project. This can be accomplished by:
    • Right clicking on the project and selecting Unload.
    • Right clicking again on the project and selecting Edit (project name) to open up the project xml file.
    • For a C# project, insert
      as a child of the first <PropertyGroup>. For a VB project, insert
    • instead.
  3. Re-Build the project. The tests won't show up in the Test View (Test -> Windows -> Test View) if the test project assemblies are not built.
  4. Create the Test Run Configuration. This is a solution item and needs to be created at the solution level.
    • Select the solution
    • Right click on it and select New Item
    • Select the Test Run Configuration and then select the Test Run Configuration template.
    • Type in a suitable file name and press the Add button.
  5. The Test Run Configuration editor should now be displayed. The important settings to configure are located under the Code Coverage section. Select all the assemblies you want track code coverage on. Save the configuration. See NOTE below for some caveats regarding selecting the proper assemblies.
  6. Run the tests: Go to the Test View again. Select all the tests (Ctrl+A). Right click and Run Selection.
  7. Check the code coverage results: Open the Code Coverage window (Test -> Windows -> Code Coverage Results).

Some Gotchas For Selecting Assemblies For Code Coverage

My typical layout for a Visual Studio solution is something like:

The UnitTestProject has project references to ProjectToTestA and ProjectToTestB. When I build the solution I get output files as follows:
1: ProjectToTestA\bin\x86\debug\
2:    ProjectToTestA.dll
3: ProjectToTestB\bin\x86\debug\
4:    ProjectToTestB.dll
5: UnitTestProject\bin\x86\debug\
6:    ProjectToTestA.dll
7:    ProjectToTestB.dll
8:    UnitTestProject.dll
This works fine for unit testing but doesn't work so well for coverage testing. The reason is that the Test Run Configuration requires that you select each assembly to instrument for coverage testing, but only presents you items 2, 4, 8 from above. If you select only lines 2 & 4 to instrument you will get no results in the coverage tests. This is because when the unit test in line 8 is run, only assemblies 6, 7, and 8 are loaded. Lines 2 & 4 are not loaded and you get no coverage on them. To solve this problem, select line 8 from the list above and the click the Add Assembly... button. Now select line 6 & 7 as well. Everything should now work as expected.

Thursday, July 30, 2009

Test Driven Development

I have been working hard to catch up with the current state of the software industry. One area of interest I have focused on in particular is the art of Agile Software Development. Why haven't I jumped in to the "deep end" of agile before now? Well, for starters, I was completely engrossed in starting and operating a construction company since the beginning of 2004. Before that I only knew a little about Extreme Programming--not even enough to be of use.

So what is agile? It is an umbrella of ideas that covers many different practices and emphasis. It is a way to better serve the customer. It makes the customer an integral part of the development process and keeps the software development cycle accountable. When done well it can save both time and money.

I have been working to learn both the software development and software management parts of agile. Since April I have implemented continuous integration and unit testing into my software craftsmanship process. I have also worked on learning the SOLID principles as well. More recently I have worked to learn the practice of Test Driven Development.

So what is TDD? It is the process of writing the unit test before writing the unit. When done well it serves several purposes: A) It generally produces better test coverage. It is less likely that a unit of code will be written with no tests when the tests are always written first. B) Code will be designed with unit testing in mind. In fact it will become very difficult to write untestable or hard to test software when the unit tests are written first. C) And the unit tests can be written in such a way as to self specify the design of the software. If the tests are written clearly they become the description of how the software is to perform.

For me TDD is a very different way of approaching software development. In the past I would dive into a project thinking about algorithms and implementations. Now with TDD I am having to force myself to think of interfaces and design specifications for my software. But the resulting quality of the software is well worth it.

One final note: I have noticed that TDD requires practice to do well. It may seem to be a slower way to write software in the beginning but the results are worth it. The initiate to TDD must have patience!

Sunday, May 31, 2009

Austin Code Camp 2009

I attended Austin Code Camp 2009 yesterday.

It was free for attendees and and paid for by the sponsors. There were quite a few interesting sessions centered around agile practices and bleeding edge technologies (mostly, but not all Microsoft related.)

My software background has been heavily influenced by databases so I made sure to attend the Dynamic Data session presented by Shawn Weisfeld. The technology basically drives and automates the data portions of the UI by integrating rich meta data from the data model (Entities Framework) with the user interface components. Currently it only works with ASP.NET Web Forms, but it looks like the technology will be extended to other front end frameworks before too long. Basically Microsoft Access for the web :-).

Later in the day I also attended the Entity Framework session by Rob Vetter. This is the foundation for a number of other Microsoft technologies including Dynamic Data and ADO.NET Data Services. This session went into some detail on the Entity Framework but did not compare the framework against other ORM tools such as NHibernate or Subsonic. I'm definitely going to have to try this technology on a future project.

I have an ongoing interest with web technologies and with ASP.NET MVC in particular. So I attended the ASP.NET MVC Views session presented by Jimmy Bogard. It was a good presentation. But I'm already fairly familiar with the basics so it didn't offer much new information for me. One question I still have: How do the tool vendors plan on supporting MVC in a meaningful way?

I've been working hard to internalize the SOLID principles and put them into practice. Along these lines I attended the session on Practical Inversion of Control presented by Matt Heinz. This session helped to clarify a few points and answer a few questions that I had about this method of writing loosely coupled applications. I believe I'm getting close to making this technique a core part of my daily coding pattern.

The final session I attended was on the Ruby language session presented by Scott Bellware. This presentation focus on newby Ruby developers, like myself, who have a background in C#. This session tickled my curiosity to the point of firing up NetBeans when I got home and working through a 20 minute Ruby tutorial. Maybe I'll whip up a Ruby on Rails app sometime soon to cement the key concepts and ideas into my head. Scott's passion really showed through as he presented his topic well.

I will be looking forward to Code Camp 2010. Who knows--maybe I'll even present a session...

Thursday, March 12, 2009

Making Google Chrome the default browser in Windows Vista

I have been using Google Chrome since it was first publicly released. I really like it a lot. It's clean and fast. The tabs are quite a bit more useful than Apple Safari's tabs (in my opinion.) Everything just kind of works. Mostly. It is beta after all. :-P

But I tried awhile back to make Chrome my default browser without success. Whenever I would try to click the "Make Google Chrome my default browser" button in the options dialog I would get the following message: This file does not have a program associated with it for performing this action. Create an association in the Set Associations control panel.

So I googled the error message and here is what I found: In order to make this button work on Windows Vista, you need to run Chrome as administrator. This is a side effect of User Account Control (UAC). Google Chrome should support UAC better, but it is beta, so what can you expect?

Here are the steps I used to fix the problem:

  1. Close all instances of Google Chrome. I first tried the following steps with a non-administrator Chrome still open. But that didn't work.
  2. Right click on the icon you use to open Chrome. I have mine in the "Quick Launch" toolbar, but yours might be in the Start Menu or on the Desktop.
  3. Select the "Run as Administrator" option. The UAC confirmation dialog will come up stating that A program needs your permission to continue. Press Continue.
  4. Go to the Options menu item under the wrench icon (upper right of Chrome).
  5. On the bottom of the Basics tab will be the Make Google Chrome my default browser button. Click it. Everything should now work. Theoretically.

Thanks to this Google Chrome Help forum post with the correct answer by englitmajor. That is what clued me in to the proper solution.

I hope this helps.

Wednesday, March 4, 2009

Inside the IT Recruiting Scene

A fascinating blog from inside the Austin IT Recruiting Scene.

I have used recruiters to look for jobs and also to find employees. It is interesting to see how they (or at least one of them) operate under the hood.

Monday, March 2, 2009

Hello and Welcome

Welcome to my new blog! Pull up a chair and make yourself comfortable :-)

My name is Peter Stephens and I live just north of Austin, TX in the city of Liberty Hill. I have worked professionally in the software industry since 1994. Of course I got my first taste of computers and things technical long before that while in the third grade with a hand-me-down Sinclair ZX-81. Since then I have learned a bit of everything from C to WPF and a whole lot in between. You can read more about my history with computers here.

Recently, I decided to start a software consulting business. I possess extensive experience with Microsoft .NET and Microsoft SQL Server. If you have need of custom software, I can write your web application in ASP.NET or your Windows desktop application in Windows Forms or Windows Presentation Foundation. If this all sounds like Greek to you, drop me a line and I will be happy to advise you on the technical aspects for your project.

I hope to discuss both the business and technical side of software in a way that is both interesting and useful to the internet community. Technology on the internet is a fast moving target. Hopefully I will be able to document my journey as I learn the latest the tech field has to offer.

Do you need custom software?