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

Comments

  1. Anonymous3:34 PM

    But of course, like me, you were a VB programmer to whom such ideas as MVC or MVP were unnecessary conceptual abstractions. We would just put a control on a form, click the required event in the designer and add the code. Simple really, and yet there were C++ programmers who thought this was a brave new world when they moved to C# in .NET 1.0.

    Now of course there are legions of people who specialise in knowing a lot about patterns without actually doing coding any more...I think they're called architects.

    ReplyDelete
  2. Anonymous9:11 PM

    As with anything else it is a matter of scale. Of course for a single dialog you don't need any pattern. Patterns assume repetiton (otherwise how do you know it is a pattern?) So if your system is complex, it certainly make sense to use patters as guide to how best avoiding repeating yourself, which is the most dangerous thing in programming.

    ReplyDelete
  3. Anonymous4:25 PM

    Dear Peter, like you, i once played a few different instruments - 2 brass and the drums - and also along your flow, I started my DP career programming - my loves were Fortran and Assembler. It seems that the correlation of Programmer / Musician stems from love of and more precisely aptitude of math - and there is quite a bit of evidence that musicians are all fairly gifted in math ... well most of them, except my son who in grade school learned Basic and today has his Masters in Music Composition and Performance - having mostly polished self taught skills ... his math always pricked holes in all those math findings we've all read.
    Be good for our name is fragile, Sincerely, Peter Bromberg

    ReplyDelete
  4. Fragile as in there are only so many of us around? Thanks for the nice comment, Peter!

    ReplyDelete
  5. Anonymous3:57 PM

    Pete, McCoy Tyner is one of my favorite jazz keyboard players. Just curious if you are familiar with his work.

    ReplyDelete
  6. Tyner helped catapult 'Trane into the spotlight in the 60's. Anybody who knows who John Coltrane was knows who McCoy Tyner is.

    ReplyDelete

Post a Comment

Popular posts from this blog

Some observations on Script Callbacks, "AJAX", "ATLAS" "AHAB" and where it's all going.

IE7 - Vista: "Internet Explorer has stopped Working"

FIREFOX / IE Word-Wrap, Word-Break, TABLES FIX

System.Web.Caching.Cache, HttpRuntime.Cache, and IIS Recycles

FIX: Requested Registry Access is not allowed (Visual Studio 2008)