From Good to Bad
By Jonathan Goodyear
As I write this article, I m giddy as a schoolboy. Why? Because today is the opening day of Star Wars: Episode III Revenge of the Sith and I m taking everybody in my company to the first showing at midnight. I ve been following the Star Wars saga for (quite literally) my entire life, and tonight the final piece of the puzzle will be filled in. Specifically, the process of how Anakin Skywalker went from Jedi Knight to the evil Darth Vader. Yeah, I know that I m taking a journalistic risk by digging into the details of a pop culture phenomenon, but I ll bet that most of you geeks out there know all too well what I m talking about (perhaps to your spouse s chagrin).
All this talk of good and evil lately got me thinking about how good data sometimes goes bad in an application. One minute you re testing your application by filling out a Web form, then WHAM! you re staring at the business end of a white screen with big red letters in your browser telling you that your data is not in the right format. How the heck did that happen? How did your good data go bad?
Thankfully, Microsoft has done a fantastic job in recent years of building great debugging tools into its Visual Studio.NET suite of products. The superior debugging tools alone are reason enough for me to use .NET over any other development platform. Thankfully, Microsoft keeps raising the bar and Visual Studio.NET 2005 introduces some great new debugging features to help you figure out where everything went wrong. Let s take a look at a few of the best, shall we?
Enhanced DataTips. DataTips are the ToolTip-looking popups that appear when you hover your mouse over a variable in your code at run time. In VS.NET 2005, you can also drill into complex objects right in the DataTip, without having to drag it into the Watch window. This is ideal for quick-and-dirty checking of the properties of your business objects.
Visualizers. Traditionally, when you viewed variable data, like strings in the Watch window, you were simply presented with a dump of the raw data. In VS.NET 2005, you can build your own visualizer to parse that data and present it in a more meaningful way. Imagine how much easier it would be to discover problems in an EDI transaction if it were formatted nicely with descriptions, versus having to wade through that same data in a fixed-position string. You can even launch a Visualizer from a DataTip. Visualizers for common data formats such as XML and HTML come out-of-the-box.
Tracepoints. Tracepoints are like Breakpoints on steroids. You can set actions to be performed when Tracepoints are hit, like running macros or writing out debugging statements. This can be very useful when processing, say, a loop that you don t want to stop on every time, yet still want to learn something about on each iteration.
Design-time Debugging. You can use the Command/Immediate window to test out and debug library functions at design time. This can save you the trouble of having to fire up your Web application each time you want to try out a change to your business logic. If it takes you awhile to navigate to the logic that you want to test, then this feature can save you a lot of time and effort.
There are a host of new debugging features that don t have a strong correlation to ASP.NET development, so I won t go into much detail here. Some of these are Edit-and-Continue (see my June 2004 BackDraft column at http://www.aspnetpro.com/opinion/2004/06/asp200406jg_o/asp200406jg_o.asp), Breakpoint filters, secure remote debugging, and enhanced SQL Server debugging (including debugging of CLR Types and their interactions with T-SQL).
I ll resist the temptation to end this column with a cheesy knockoff quote from Star Wars. Instead, I ll simply urge you to take some time to examine and get familiar with the new debugging tools at your disposal in Visual Studio.NET 2005. They may not be as glamorous as Master Pages and the GridView control, but I ll bet you they ll save you more time and stress in the long run.
Jonathan Goodyear is president of ASPSoft (http://www.aspsoft.com), an Internet consulting firm based in Orlando, FL. Jonathan is Microsoft Regional Director for Florida, a Microsoft Certified Solution Developer (MCSD), and author of Debugging ASP.NET (New Riders). Jonathan also is a contributing editor for asp.netPRO. E-mail him at mailto:[email protected] or through his angryCoder eZine at http://www.angryCoder.com.