11/06/2007

Pattern Madness, Anyone?

Here is an interesting newsgroup post that illustrates a common problem of programmers (usually new ones, but - not always!):

"I have just started to rewrite my application using the Presenter First Design Pattern to make sure my business logic is not in the Gui itself. I've got the general idea but I'm a bit unsure as to how I should be launching a dialogue window from my main application window.

What i have done is this in a nutshell. My main application window comprises of a Model, Presenter and a View. The Popup window also has a Model,
Presenter and View. This is the process of what happens when the button is clicked is as follows.

1. Button clicked, delegate function in presenter called from main View.
2. Method in main presenter calls a method in main model to open the window.
3. Method in main model instanciates popup view, popup model and binds with
popup presenter.
4. Method in main model calls method in popup model to open the window.
5. Method in popup model uses delegate function to call method in popup
presenter.
6. Method in popup presenter calls function in popup view to display the
window.

Can anybody tell me if what I am doing sounds right?"

-------------------------------------------------------------------------------

Not to be a downer on the MVP, but that sure sounds like having to go through a lot just to call ShowDialog! Patterns are useful, patterns are cool. But -- the question becomes "Do I really need to implement "all" of this pattern here? What's "best practices" anyway?

It's relative-- if you run FxCop against the Microsoft Enterprise Library, you'll get a list of errors that will keep you busy for hours.

I say, "it depends". Usually, if it ain't broke, then you don't need to fix it. In many cases a legitimate answer would be, "No, you don't - so don't sweat it - and you're still a Patterns Guy/Gal".

Music Education Department

I am always amazed at how many software developers are also musicians, especially in the jazz category. I myself am an ex flute and bass player, having done a stint with the Robert Hunt Trio in New York in my younger days. My flute teacher once made me transcribe Miles Davis' solo from Freddie the Freeloader (Kind of Blue) -- note for note, and be able to play it on the flute. Amazon now pays 20% on their MP3 downloads, they are DRM - free mp3s and they have a huge selection of classical and jazz. Here's an example:



Nordal is one of the most technically brilliant pianists you will ever hear. If you like top-flight piano jazz with hints of Keith Jarrett, Bill Evans, Oscar Peterson and others, yet totally unique, check out Marius Nordal.

Link of the Day: Sharepoint Blogs