Archive for software development

Is Quality Important?

Joel Spolsky and Jeff Atwood stirred up some debate when they said “Quality just doesn’t matter that much”. At first, I was a little outraged. My entire development process is built around quality. Without it, airplanes would fall from the sky and your car wouldn’t start in the morning.

Levels-of-Quality

So can we definitively put the quality question to rest? Unfortunately, “No”.

First of all, we need to understand that quality isn’t a Boolean. It’s not “yes”, you have quality, or “no”, you don’t have quality. Quality is a gradient, but it’s even worse than that. Everyone sees it differently, and everyone experiences a different aspect of it. In short, quality is a multidimensional gradient!

I used to work at a small development company where I worked very closely with the President of that company. He was concerned with quality, but that took a backseat to the features that went into the product. The features themselves sold the product, and wowed the people writing the checks. Once they purchased our software, the integration efforts were large enough that the customer was essentially locked-in. Throw an expensive support contract into the mix, and it was a money making machine.

The company ended up being very successful, and was eventually assimilated by a huge company. The owners ended up walking away with a few million each. Try to explain to them that quality is more important than features!

Now fast-forward a few years, and we can examine what eventually happened. The product did work, and honestly it was the best in its class simply due to the scope of the problems it was trying to solve, and the high barrier of entry for competitors. However, the quality issues eventually caught up with the product. It became difficult to maintain and add extra features. The only solution was to slowly rewrite sections of it.

I think a great analogy is the turtle and the hare. If you’re in for the long haul, you want to be the steady turtle. If you’re in it for the short term, you want to be as quick as possible, even at the cost of stopping to nap. The problem is, you’re making others suffer for your negligence.

If you want the best of both worlds, build quality into your development process. I’ll be covering this in a series of articles that discuss unit testing (and testing in general) in exhaustive detail. They should be coming out by the middle of March. Stay tuned!

Don’t lose your code – 3 methods that can help

Inevitably, you’ll lose power to your computer, have a hard drive crash, have lightening strike, accidentally delete code that hasn’t been checked in, or encounter some other crazy scenario that I can’t even imagine. What is your plan? Read on if you want some solutions that may just save your ass code.

Did I just delete that code?

I’ve had it happen to me, I accidentally deleted hours of work and had to spend the time to rewrite the code. I even remember a time while working at my first job that the power went out to our whole building. At the time, most computers were desktop machines without a UPS. It was seconds after the lights went out that I heard an agonizing moan from one of the offices. Another developer hadn’t saved often enough and lost everything he was working on.

Use a automated screenshot tool

For the past few months, I’ve been using a product called TimeSnapper. Basically, it takes a screenshot of your desktop every few seconds. I have mine set up to the default of taking a snapshot every 10 seconds.

TimeSnapper Options TimeSnapper Day View

You can store the screenshots as standard image files such as PNG or JPG. You can optionally encrypt the images so that they can only be viewed with the correct encryption key.

Usually one of the first concerns with this backup method is that the image files take up a fair amount of space. Luckily, there are a few ways to optimize the screenshots. Below are the options that I use personally. I use a high level of compression for the images, and only capture the window that has focus. These settings work well with my goal of being able to read the code that was displayed on my screen at any given time.

Image Quality Options

I honestly can’t recommend this product enough. It’s well worth the $25 price tag. Its not only saved me from losing valuable code, but I’ve even used it to lookup information that I found on the web but can’t relocate.

Here is partial list of features to get you salivating:

  • Play your day back like a movie – Watch your entire day in minutes, or quickly scan a time range to find code that may have been deleted.
  • Track productivity by telling it which programs should count as “productive”.
  • View reports on how long each type of application is used. Not necessarily useful, but interesting nonetheless.
  • Flag sections to associate them with other items such as work items in a bug tracking system.
  • Filter by application – You can configure it to track only Visual Studio for example.

Use a keylogger

The next option has the advantage of being a little more lightweight, but may not offer the same level of code protection as using a screenshot tool. Basically, you install a keylogger that will record every keystroke that you make.

When I first had the idea to use a keylogger, I discovered that there are a number of legitimate keyloggers out there. Apparently, book authors frequently use keyloggers to save their work.

You have two options for the type of keylogger you can use. You can use a hardware solution that plugs into your computer on one end, and the mouse plugs into the other. The other option is to use a software keylogger such as PyKeylogger (open source, free).

The biggest problem with keyloggers is that they store the information as you originally typed it, not as it is in your code files. That means that if you’re jumping between files, or making a lot of edits or corrections, the key log won’t be of much use to you.

Most keyloggers do allow you to encrypt the recorded information so that your passwords and other sensitive information are fairly safe.

Automate code backups

There are a number of automated backup tools that will run scheduled backups of your local files. Personally, I like offsite backups for smaller files because they’re portable. I use a product called JungleDisk, which I’ve mentioned before. I have it set up to backup my code every 15 minutes. It minimizes my potential loss of work to 15 minutes at most.

JungleDisk Backup Selection

If you frequently work on a specific network with access to a secure file share, you can also automate network backups. Windows Vista actually comes with a sophisticated file copy tool that supports quick differential copies. Keep in mind that if you’re not connected to the network, you won’t have any protection against lost code at all.

Conclusion

I’ve given you a few ways that you can protect your precious code (in addition to your source control system of course). Personally, I use a combination of JungleDisk and TimeSnapper. Between the two, I could potentially lose a maximum of 15 minutes of work, and in most cases, I won’t lose ANY work. Can you say the same thing?

Advantages of a 3rd party diff/compare tool

I recently spent nearly an hour trying to figure out why all of my unit tests stopped working in a particular class. It turns out that I had accidentally deleted a single character in one of my strings, but the built in diff tool that comes with Team Foundation Server is very simplistic. Learn how and why you can replace your stock compare tool with something a little more powerful.

Here is a screenshot of what you’ll see in the stock Team Foundation Server compare tool:

Default TFS Compare Tool

See how hard it is to spot the difference? The problem is, ANY change on the entire line causes it to show up as “changed”. That includes whitespace changes. For this reason, I frequently end up with extra full lines that are colored as having been changed, making it harder to see the actual code changes. For the most part, I really don’t care about whitespace changes because they deal with the formatting of the document, and I’m more concerned with functional changes to my code.

The good news is that those smart guys at Microsoft make it easy to integrate a third party compare tool right into their tools. James Manning was even kind enough to include detailed instructions and the exact settings needed for every major compare tool. You can even use them for merging if you like.

Since my background is in Subversion and TortoiseSVN specifically, I pulled out my trusty KDiff3 (SourceForge) compare tool. It’s a common alternative for TortoiseSVN’s own diff tool.

After wiring up KDiff3, here is what I saw when I compared revisions:

KDiff3 Character Difference

Notice how easy it is to see that I changed a single letter (it’s obviously easier when it’s full-size).

There are other good reasons to use a third party compare tool (which vary by tool obviously):

  • Easily compare entire file structures (folder diff)
  • Inline editing
  • Easy to use outside of Visual Studio – often with an explorer context menu

I recommend giving a few of the compare tools a try and see which works best for you. I don’t really see any risk in using a third party compare tool, but there are certainly a lot of advantages that you may not even know you’re missing right now. I suggest also taking a look at WinMerge in addition to KDiff3, since it seems to be fairly popular and feature-rich as well.

ClearType in Remote Desktop with XP

A new feature in XP SP3 that should of particular interest to developers is ClearType over RDP (remote desktop protocol). If you occasionally use remote desktop to work from home, or work remotely to your development machine, please read on.

If you’re not familiar with ClearType, you can head over to Wikipedia for a full explanation. In a nutshell, it takes advantage of the fact that each pixel in an LCD screen actually has 3 sub-pixels. They can be “hacked” to improve the anti-aliasing of text displayed on the screen. I’ve been a huge fan of the feature, especially for source code, and I have a hard time living without it. In XP (locally), it’s turned off by default, but turned on in Vista.

ClearType Effects Dialog

I had always noticed the remote desktop would not give me ClearType. However, I became curious when I found the following options on my Vista machine. Apparently ClearType over RDP is now supported in the client, and is also supported when using Vista as the RDP server (no hacking needed).

RDP Experience Options

Unfortunately, these options have no effect when using XP. If you want ClearType over RDP with XP SP3 (sorry, only SP3+), add the following registry key:

Windows Registry Editor Version 5.00

[HKEY_LOCAL_MACHINE\SYSTEM\CurrentControlSet\Control\Terminal Server\WinStations]
"AllowFontAntiAlias"=dword:00000001

After you add that registry key, simply reboot the server (XP), and reconnect. From what I can tell, the client options no longer matter. Even if I uncheck the “Font Smoothing” option, it still uses ClearType. It’s not a big deal, but I thought it was worth mentioning.

So far, after using this option for a while, I haven’t seen a significant performance impact over a VPN on the Internet.

If you want to take this a step further, install Consolas, it’s a font designed specifically for software development, and to take advantage of ClearType. It’s a free download from Microsoft.

.NET Development Perf Testing in a Cloud VM (EC2)

If you haven’t heard, Amazon’s EC2 service provides cloud-hosted virtual machines. Initially, they just supported Linux machine images, but recently have allowed Windows machine images. This means that you can create on-demand hosted virtual machines accessible from anywhere.

image

I decided to do some simple, informal performance testing. To do development performance testing, I like to run a build process and time it, since compiling is typically the bottleneck on a development machine (other than the IDE and the developer).

I downloaded the source code for SharpDevelop, since I knew it would be a fairly large, yet automated build process. The only thing I needed to install was .NET 3.5 SP1. As a baseline, I ran the build on my personal laptop, with these specs: 2.0GHz Core 2 Duo, 3GB RAM, 250GB 5400RPM hard drive. To test the performance of the build, I ran it once, ran a “clean” operation, then ran the build a second time, timing it only on the second run.

  • My laptop:  1 minute, 37 seconds
  • EC2 Small Instance: 2 minutes
  • EC2 Medium Instance: 41 seconds

As you can see, the EC2 “medium” instance, was over twice as fast as my local machine.

To continue my testing, I installed Visual Studio 2008 Professional, ReSharper, TortoiseSVN, and the Silverlight toolkit. My initial impression was very positive, and I could certainly see myself using it on a regular basis. From a professional standpoint, I would probably prefer a dedicated development machine. However, for an occasional hobby development environment, this might be a viable alternative.

EC2 has many advantages over running VMware or Virtual PC on your own computer:

  • Can take snapshots of drives
  • Doesn’t use resources from your computer
  • CPU can be upgraded/downgraded as needed
  • Theoretically ultra-stable host
  • Very fast Internet connection (I downloaded 800mb in less than 30s!)
  • Theoretically updated virtual hardware as time goes on
  • Potentially faster (especially if you use a laptop)

However, there are a few obvious disadvantages:

  • Pay-per-hour can get expensive if you use it full-time
  • Can’t drag and drop in and out of the VM like desktop virtualization can
  • Need to remote connect using something like remote desktop so graphics performance isn’t the best
  • Only available when you have access to the Internet
  • Not necessarily great multi-monitor support
  • Virtual machines take a while to start and snapshot

Pricing

Right now, Windows based machines are priced starting at $.15/hr (medium for $.30/hr). For a machine that runs 24/7, this can get expensive compared to dedicated hosting. However, for a machine that’s used for only a couple of hours each day, the pricing is very reasonable.

As an example, if you run a medium instance machine for 8 hours/day, 20 business days/month, you’ll end up paying $48/month.

Conclusion

Having virtual, dedicated computers available on-demand for pennies per hour is very exciting. This is half of the cloud computing equation, and I believe it’s going to be an important part of the future of the web.