Design patterns in a real application
One of the problems many people encounter when trying to learn design patterns are that the examples are so over-simplified that it can become very difficult to see where these patterns can be beneficial in a real application.
Breman Sinaga has a wonderful article over on codeproject.com that gets around this issue. His sample application demonstrates the following patterns:
- Strategy – “Define a family of algorithms, encapsulate each one, and make them interchangeable.” (GoF)
- Observer – “Define a one-to-many dependency between object so that when one object changes state, all its dependants are notified and updated automatically.” (GoF)
- Template method – “Define the skeleton of an algorithm in an operation, deferring some steps to subclasses. Template method lets subclasses redefine certain steps of an algorithm, without changing the algorithm structure.” (GoF)
- Adapter – “Convert the interface of a class into another interface a client expects. Adapter lets classes work together that couldnt otherwise because of incompatible interfaces.” (GoF)
- Singleton – “Ensure a class only has one instance, and provide a global point of access to it.” (GoF)
Thanks Breman for an excellent article and a great starting point for beginning study of design patterns.
Mountain Biking
Last weekend, Lindsay and I went camping at Stanley, a great little town in Central Idaho at the base of the Sawtooth mountain range. While there, we borrowed some mountain bikes and tooled around the trails up there.
Both of us had an absolutely wonderful time. So much, in fact, that I ended up buying my first mountain bike this afternoon. The idea is that I would start riding around some of the Boise Foothills and Greenbelt to get myself familiar with how the bike handles and so on. This would have to be a much better way to get in shape than to run on a treadmill.
I bought a Specialized Rockhopper, along with a Yakima Kingpin 4 hitch mount bike carrier for my Explorer. I had it narrowed down to three bikes which were all very equally priced and equipped. For me, the Rockhopper is the one that just felt the best.
As far as the hitch mount goes, I was wrestling with whether or not to get the swing-away carrier or not. Ultimately, I decided that it was not that big of a deal, and definately not worth the extra $200. I did find that this was a good decision, as when the carrier is installed, I have about 1/4 inch clearance for the window to open, so I didnt really need the swing-away anyway.
I also got a great trail guide to the Boise Foothills, which includes a lot of great beginner trails. I’m looking forward to trying my first one tomorrow at lunch.
FireFox IEView extension
Daniel Cazzulino blogs about “the best browser ever“, even teasing us with “an absolutely must-have extension that allows me to open those everytime-less-often pages that can only be browsed with IE”. What he failed to do was provide the link for it.
Clearing your VS.NET start page
Earlier today, I was looking for a way to remove items from my VS.NET start page, yet still retain the projects on disk.
The solution I found was to delete the registry key HKCU\Software\Microsoft\VisualStudio\7.1\ProjectMRUList.
This will remove *all* the items from the MRU list in the start page and the file menu. It will not remove the projects themselves.
Bloglines.Com
Congratulations to Mark Fletcher and Bloglines.Com, for making Time magazine’s list of 50 best websites.
I think its quite an accomplishment to be ranked up there with BBC and news.google.com.
NewsGator gets funded
NewsGator Technologies, Inc., a leading developer of content aggregation tools and services, announced today that it has closed a round of funding with Mobius Venture Capital.
Read the entire press release at newsgator.com.
Congratulations to Greg and the entire NewsGator staff on some wonderful news. This couldnt have happened to a better company. They’ve released some top-notch products already and this should insure more wonderful releases.
The 5 pitfalls of estimating a software project
Christopher Hawkins has a great piece about the 5 pitfalls of estimating a software project. I wonder how many of his issues would be mitigated by implementing an XP methodology.
Estimates would be a consensus between all parties involved (sales, marketing, development, *and* the customer), thereby getting rid of point one, which was allowing non-technical staffers to give development estimates. I agree with Christopher that it is very easy for a salesperson to think, “well, that is only one button or one screen; it shouldnt take that long”. This is, of course, done without any working knowledge of the system and any of its underlying systems which may need to be modified to make this work. By having consensus estimates, everyone (including the customer) buys off on the estimate.
Refusing to look in the mirror is not something that is covered by any programming methodology, and I dont believe is something that can be easily enforced by process. The concept of doing a post-mortem is good, but what makes a post-mortem is great is to correctly identify and learn from your mistakes. This requires a lot of inward looking, which I think people are not accustomed to doing. It is quite difficult to find fault with ones self. Unless you have a strong desire to learn and improve, any sort of post-mortem will be of no benefit. Making a mistake is okay, not learning from it is not. This reminds me of an old quote, “It’s not that fact that we shot ourselves in the foot that bothers me, but the fact that we reloaded and fired again.”
Additionally, Mr. Hawkins discusses three other items; underestimating design and debugging time, inadequate/unclear requirements/ and taking too large a bite from the apple. I believe that these three items would all be covered by one principle of XP, which is do the simplest thing that can possibly work.
It’s not necessary to have a complete functional specification prior to starting development of an application. Using XP, there is a consensus on a small set of functionality that will be delivered (the simplest thing that could possibly work) and those requirements are generated. If these requirements are inadequate or unclear, then immediate clarification is obtained from the customer, so that work can continue.
It’s not necessary to have a fully designed object model in place prior to starting development. By doing the simplest thing that could possibly work and constantly refactoring your code, you will end up with a much more elegant solution than you would by attempting to think of everything at the very beginning.
Now, I understand that prior to a project commencing you will still need to give some sort of ballpark estimate for completion so that it can be determined whether the project’s timeline will be congruent with everyone’s needs.
Like Christopher said, if you can break the project down into the simplest thing that could possibly work, the more accurate your estimates will be.
NTime
A while back, I stumbled across a tool called NTime, which is essentially a performance testing tool for .NET.
It has a very similar feel to NUnit and csUnit, in that all performance tests are decorated with attributes, such as TimerFixture, TimerFixtureSetUp/TearDown.
It could even be argued that csUnit could be a compelling replacement for NTime, since csUnit also does performance metrics. However, I would tend to strongly disagree with that argument. These two applications are working on two totally different paradigms.
csUnit is a tool that facilitates pass/fail logic unit testing, and while performance metrics is a nice side effect of this, there is a slight smell that comes from using csUnit strictly to measure performance metrics.
If you are looking for a great little performance unit testing tool, give this one a spin. I’m anxious to hear what you think…
Jay Bazuzi
One of my favorite bloggers as of late is Jay Bazuzi (rss), who works on the Visual C# IDE team at Microsoft.
Give him a read; he’s got some posts that are sure to melt your brain, such as “no private methods” and “the most extreme thing that could possibly work“.
Along with that, he’s got some great thoughts on exactly what TDD is all about and properties as objects.
Give him a read; you wont be disappointed.


