Posts

Showing posts with the label development

Learning how to debug

There are a lot of smart programmers coming out of college. You learn a lot of great and important things about computer science and how to be a good programmer. However one thing I think more junior developers (and even us senior) ones can always learn more about is debugging. What debugging you say? Everyone knows how to debug man, just set a break point and step through the code. Well believe it or not but a time will come when you don't have complete access or control over the code you're relying on. So debugging is a lot more then just being able stop code execution. Because of this I recommend everyone read the following blog: Using winDBG winDBG is a debugging tool that allows you to debug windows based applications (even .net ones). It's quite powerful and while not easy to use can allow you to track down exceptions/crashes/hangs in your code. I'm just starting with it myself and the learning curve is huge but I have already learned several new technique...

String.Empty vs ""

Image
So I've always heard you should use String.Empty vs "" the dreaded blank string in C#. So I decided to write a little test program to find out. It simply takes a string variable and assigns it to "" or String.Empty. I do this 1 million times each and time how many milliseconds it takes to do that assignment. My system is a p4 1.5 GHz RAM running .net 2.0. Source code can be sent upon request. The results are surprising and can be seen below. Other then the first run the String.Empty beat the "" by a few milliseconds. Hardly the creaming I've read about. But perhaps if you were doing some severe number crunching you would notice a difference. However this test is hardly definitive and should probably be run several more times and had the numbers aggregated. I've run the app a lot more since yesterday but only added one more screenshot. I may just post the screen UI and then keep track of the results in a spreadsheet or modify the app...