Snow Day…

December 8, 2005

Technically, it’s an “ice” day but regardless the metroplex has slowed to a crawl. It’s currently 17 degrees out and there’s about an inch of ice on the ground. While the main roads seem to be getting better, our neighborhood is a complete mess still and probably will remain so until sometime this afternoon. Due to the weather, the office plans on having a “late opening” but I’ve decided that my family and life are more important than missing a day at the office, a sentiment I’m sure most share with me, so I’m going to be staying home today. Now to figure out what to do to entertain Makena for the next 8 hours…


Leave It Alone or Make It Worse…

December 5, 2005

To steal a tagline from a comedian. It looks like in an effort to combat phishers, browsers makers are looking for some pretty draconian measures. While I do agree that phishers need to be fought and measures should be implemented to foil their efforts at every turn, I don’t want to give up my abilities as a developers to produce applications of a certain type. That is NOT a fair trade off in my book. Granted, we still have to wait to see what will actually be implemented and in what way but the whole things makes me nervous. Actually, it makes me wonder how much of a resurgence WinApps are going to have – let alone Smart Clients & HTC…

(Link by way of Randy)


TDD Experiences and Thoughts…

December 5, 2005

While still only a relative novice to TDD, I’ve found it to be amazingly helpful in building better classes and thus writing better code. With no one to guide me, I stumbled thru several articles and numerous examples before I finally started to “get it�. There has been quite a bit of trial and error that has caused me to alter the way that I code and I wanted to write about a couple of things that I’ve started doing that have been a tremendous help.

Throw out the debugger. Ok, not really, but that’s sort of how I’ve started to feel now. Actually, this has been the biggest shift in my paradigm and thus my actions (aside from the general need to refactor my classes as a whole). I used to write a small console or windows app that would instantiate the class(es), do some sort of setup, and then respond to my input so that I could see how my code was evolving/reacting. Well, this is EXACTLY what unit testing does. It’s simple, I know, but it still took me some time to get used to and to wrap my mind around the fact that I didn’t have to press F5 to see how things were coming, I just ran my tests. As I wrote more tests, I wrote more code to use those tests and vice versa. It was a wonderfully vicious cycle that led to some pretty enormous tests with a ton of pre-condition and post-condition checking.

Refactor your tests and fixtures as much and often as needed. While I had some extensive unit testing being done, it certain didn’t follow DRY and was sort of a mess to maintain. Enter SetUp/TearDown… While there are still some who debate their use, others seem to agree with me that using them will not only make your life easier but makes your code cleaner. Whenever I have a test that needs some setup done, I usually refactor that setup into its own private method first. Once several of the methods use that single private method, I move them all to a separate fixture and make the private method a “SetUp� method. As a side note, good naming convention is VITAL for good tests. I avoid using the suffix “Test� for them and try to make them as descriptive of what they’re testing as possible. This reduces the number of messages that I have to output with my Asserts – oh, and always try to adhere to OAPT for better testing.

Finally, for those of us who use log4net (if you’re not using it, start NOW) I’ve put together a quick little way to leverage it in unit tests (see example below). By setting up and adding a ConsoleAppender in my TestFixtureSetUp, I get all of my messaging within my testing GUI. I’m even able to control the levels and formatting on a per fixture basis. Notice the use of preprocessor directives to keep the logging out of my automated build scripts as well.

[TestFixtureSetUp]
public void FixtureSetUp()
{
#if !AUTOMATED && DEBUG
AttachConsoleAppender();
#endif
}

private void AttachConsoleAppender()
{
LevelRangeFilter rangeFilter = new LevelRangeFilter();
rangeFilter.LevelMin = Level.Debug;
rangeFilter.LevelMax = Level.Info;
ConsoleAppender appender = new ConsoleAppender();
PatternLayout layout = new PatternLayout( “%date %-5level %logger – %message%newline” );
appender.Layout = layout;
appender.AddFilter( rangeFilter );
BasicConfigurator.Configure( appender );
}

Which finally brings us to the testing GUI itself – learn it, live it, love it. While the NUnit GUI is passable, I’ve found Zanebug to be everything it is not. Plus it’s FREE – can’t beat that…


Icon (Not Jimmy) Buffet…

December 5, 2005

While I’m certainly able to hold my own using Photoshop, I’m no icon guru. I’ve been working to create some new icons for my webchat program but I’ve recently run across a new program from IconBuffet – (free)My Deliveries. Basically, you get a set of icons that you can use as well as the ability to share the set with up to 5 friends. Everyone that signs up gets a set and then you can swap them. Icon trading at it’s best and it’s great PR for the company. Gotta make you smile…
 


File Storage Solution – Part Deux…

December 3, 2005

I’ve decided to try out SaveFile for my personal development projects – currently I’m only going to put up SourceControlSwitcher and iTunesCommander. It has the requisite pop-under and banner ads that come from using a free service and I haven’t found a way to automate the uploading so that my build scripts can handle it for me so I may not stick with them but I want to give it a try before I continue the search.