Monday, April 18, 2005

What to do with complexity

I was pursuing the Creating Passionate Users blog and noted a link to a new, interesting product that the Head First folks are coming out with called Head First Design Meditations. This looks to be a deck of cards that is, Designed to be used as a brainstorming and inspiration tool, the card deck will contain small bits of software design wisdom, insights, idioms, inspiring quotes and perhaps even a chuckle or two.

What I quickly noted on the page was the following quote by Alan J. Perlis: Fools ignore complexity. Pragmatists suffer it. Some can avoid it. Geniuses remove it.

Wow! I must admit that when I have encountered complexity, in both code and in life in general, I have ignored it, suffered it, and avoided it. Rarely, if ever, have I removed it. What comes immediately to my mind concerning the removing of complexity is Refactoring. This I try to do regularly with code. What is Refactoring? According to the Wikipedia Refactoring is the process of rewriting written material to improve its readability or structure, with the explicit purpose of keeping its meaning or behavior. Wikipedia defines readability as, Readability is a measure of the comprehensibility or understandability of written text.

The main reason I refactor is indeed pragmatic. I find that further updates to the code is easier to do if the current code is as clear in its intent and as simplistic in its structure as possible.

Perhaps those who really are geniuses remove complexity out of altruistic reasons, for myself as a mere mortal, I remove it so I can better understand how and why.

For more quotes by Alan J. Perlis, click here.

Saturday, April 09, 2005

XHTML and CSS: a union made in....

Because I sit all day hammering out code, I have to make a real effort to get enough exercise. What I often like to do is download and listen to a great weekly podcast, that is offered in both MP3 and WMA format, that is a recording of a show called .Net Rocks while I am taking my daily jog. This week’s show featured Rory Blyth and Scott Hanselman who discussed at length a great site, csszengarden.com that demonstrates the use of XHTML and CSS for website design. To date, I have used CSS primarily for font formatting, but not much else. However, a combination of both the show and the csszengarden web site have caused me to take another look at CSS (Cascading Style Sheets) and a new look at XHTML (Extensible HyperText Markup Language).

Check out my latest learning spike about using XHTML and CSS to form a great web design toolset.

Monday, April 04, 2005

NMock 101

Recently a new member of the development team questioned me on how various dependent objects, that are part of an implementation of an app we are building, could be tested using NUnit and NUnitASP, a set of unit testing tools. I stated that the simplest way I understand would be to "mock" the objects that the view (or the UI) and controller tiers under test are dependent upon. The tool that I am most familiar with is NMock. Since it had been a while since I had utilized NMock for testing purposes, I thought it would be good to review the documentation for the tool.

Click here to see the step-by-step process I used to create a demo of NMock using a TDD methodology with NUnit.

CopySourceAsHtml

Loaded the great addin for VS.Net 2003, CopySourceAsHtml , version 1.2.3, last night. However, when I went to select some code to Copy As HTML I would get an interop exception. Unfortunately, I did not copy the exception message in the dialog box that was displayed.

Anyway, the solution was to take the source code and do a local build, creating the install file and installing from that .msi file. Then all worked swimmingly.

Saturday, April 02, 2005