Friday, June 29, 2007

Software Learning, College and Post-college

Scott Hanselman has a post on the three things he learned about software after college and has asked for others to chip in. Here are my thoughts...

1. Boolean logic can help prove a statement.
2. Comments should be added to code for clarity.
3. Projects should be completed on your own.

Out of College:
1. A test, or set of tests, is much clearer at proving that code is correct.
2. Good code needs well-named, decoupled, highly cohesive parts, NOT comments.
3. Asking for help does not mean that you are weak, it means you have the strength to admit that you cannot accomplish something on your own.

Disclaimer: I have not actually completed college (YET) but have taken many college courses.

Saturday, June 02, 2007

Background Compilation and TDD

Jeff Atwood has been blogging about the lack of background compilation in C# within Visual Studio (here and here); a feature that is built into the VB.NET editor of Visual Studio. I'll have to agree, for the most part, that background compilation can be useful at preventing common mistakes, especially in an environment where case sensitivity is important. And one of his readers pointed out that ReSharper includes background compilation for those of us who are lucky enough to have this tool. But background compilation, and even intellisense in general, annoy me during TDD sessions.

It is often the case, when writing code test first, that a class you are using does not exist yet and the method you are testing does not either. In each of these scenarios, background compilation becomes a little distracting as I immediately switch gears to eliminate the squiggles and the types that are now colored red. I find myself being pulled away from the task at hand: thinking about my design. This is certainly a personal issue and has me thinking that I should look into creating (and I don't even know if this is possible) shortcuts for disabling and enabling intellisense and background compilation. This may even solve the issue for those of us that think background compilation is annoying because "I haven't finished typing yet."

Sunday, April 15, 2007

NoVa Code Camp

A special thanks to the organizers and sponsors of the Northern Virginia (NoVa) Code Camp this weekend. It was my very first code camp and I enjoyed it thoroughly. Kudos go out to the speakers of the sessions that I attended - Bryce Covert, Blair Hall, Jonathan Cogley, and Paolo del Mundo (with assistance from Jay Flowers).

Monday, April 09, 2007

Prototype, JSON, and DHTML

I am playing around with the Prototype JavaScript library and in an ASP.NET application, as I have heard great things about these two libraries. I know, I should be using AJAX.NET, but I am not sure that it is mature enough to accomplish exactly what I need. So I downloaded's (man that's hard to type) scripts and added them to my solution - simple enough.

In an effort to see if I have a grasp of the JSON syntax, I included the Protoype.js file in the header of a simple HTML page and created a simple object. You'll note the use of "simple" in my description of the web page and the class that created. So I fired up trusty, ole IE to execute the page and nothing happened. Man was I irritated. How could I mess that up?

So I went to the Prototype website to ensure that I had the class creation syntax correct. Okay, I was missing a semi-colon at the end of my prototype definition (not the library - this can't possibly be confusing?), but I know you don't need that semi-colon as they are not required by JavaScript. I added it anway.

Now I Execute the page again. Nothing! Not even one of those helpful error dialogs that IE provides when there is a scripting problem. This story continues for about 6 hours of my Friday while I attempt to find the problem. Long story short, and a weekend's worth of rest I fixed the issue in 30 minutes of playing around this morning.

The problem: my "script" tags were self-terminating in the "head" of my XHTML (I forgot to mention that earlier). As far as I know, a self-terminating tag is legal XHTML, but apparently not where "script" tags are concerned. I could spend hours sifting through the XHTML schema, or searching online, but I am just going to document this here. "<script />" is not the same as "<script></script>. The latter works for script includes, the former breaks the HTML document in both IE and Firefox (FF). Now I am well on my way to JSON and AJAXian goodness.

Except that my boss just told me to stop spending so much time on research and "just get things done". Which is a whole other post.