Starting to come out of my funk..

I'm sick today, so I spent sometime looking at some OOP patterns (isn't that what you do when you're sick?)

I found this website a while back.  I had looked at the factory patterns before, and had been trying to think through the when angle of these.  Some of these patterns it is suggested that you should use these frequently, and since I have never built a factory pattern, this has added to my already lower self-esteem as a programmer (I know I'm good, but I want to be "733t" like Brendan and Darrell and Sahil and Geoff and Eric and John and uhh, you get the idea... 

What spawned all this is that I've recently been put on a different team at work... I won't totally explain here, but this has left me feeling a little less appreciated at work (read "disrespected") and have felt that maybe I'm just a Mort pretender. 

So today I got past the Abstract Factory, Builder, and Factory patterns... When I got to the Singleton pattern I realized that I could probably very easily refactor some existing code into this pattern (and it actually makes sense to do so).

When I got to the structural patterns, I discovered that just last week I built some code using the composite pattern.  I didn't even know it.  It was just the most logical choice for what I was doing (WebDAV with Exchange)...

Cool! Either I'm not a total Mort or there's hope for me yet!

I'm still reading (DonXML caused me to take a side step and research Domain Driven Design... thanks Don... I don't totally get it, but I think I need to bite the bullet and read both Martin's book, and Eric's DDD book).

Print | posted on Tuesday, May 31, 2005 2:21 PM

Feedback

# re: Starting to come out of my funk..

left by at 5/31/2005 3:02 PM Gravatar

Hopefully things start lookin' up for you at work! :)

Design Patterns are one of the things that really advanced my skills as a developer I think. It's like having the smartest developer around show you all his/her best secrets. Sure I may not understand them all right off the bat, or appreciate the context they're best suited for, but eventually, after a bit of trial and error, it clicks.

At first I was applying patterns in ways that didn't really make sense. It wasn't that I was trying to force pattern usage I think, so much as that I recognized a problem, and knew there was a pattern based solution, but couldn't confidentally say "this is the one". So you'd see Factories where Decorators would've been more appropriate. Stuff like that. I recently re-wrote something I wrote a year ago for example. The line-count is now half what it was, and it's a lot more flexible than it was before, with much more of it being meta-data driven. For that application, it finally clicked into place for me.

A lot of people would probably say my code still has a long way to go, but just imagine how bad it was before! :)

Anyways, keep it up, and don't let politics get ya down!

# re: Starting to come out of my funk..

left by at 5/31/2005 3:13 PM Gravatar

I'm in the same boat, I don't know jack about patterns. Although, I have started using the singleton pattern to store make certain items accessible accross an app (db connection string, etc) but I only picked it up do to diving into some of Paul Wilson's code. I guess I need to buy some more books. Sigh.

# re: Starting to come out of my funk..

left by at 5/31/2005 3:49 PM Gravatar

This patterns bullsh*t hype is really getting tiring... just code the stuff. Chances are, you won't care whether you used patterns or not because by the time you need to maintain your code, MS will have either obsoleted it with the flavor of the year, or the app will need to be re-written due to business pressure or not even needed anymore.

It's really amazing... this patterns hype didn't exist 4-5 years ago when we were churning out VB6/ASP apps that provided real value to business.

And please don't start the self-pity with TDD. Oy vey! Please, don't bring Java to .NET along with all the XP crap.

# re: Starting to come out of my funk..

left by at 5/31/2005 4:46 PM Gravatar

A while ago I found myself using the singleton patterna fair bit...until I discovered the ReaderWriterLock, this makes a nice replacement in a lot of circumstances. For a Singleton though, the best site I've seen is this: www.yoda.arachsys.com/.../singleton.html

# re: Starting to come out of my funk..

left by at 5/31/2005 5:53 PM Gravatar

Ahhh UniqueDesign....

I agree that in the past we did things on the fly.  I was a VB6/ASP Mort... I was a god back then you know...

Problem is that as I have looked at much of the code I have developed in my professional life it quickly became unmaintainable.  Learn OO should helpus build better apps and patterns reallyare about just figuring out different things you can do with the whole OO paradigm.

<old_tired_argument>As far as MS making thing obsolete... I have an old 486 you could use if you want... we have no problems with technology getting faster... for that matter why use VB6/ASP... back in the day Cobol rocked! and why stop there?  How about punch cards?  The issue is that technology evolves and those that don't evolve get left behind... whining doesn't solve it... being bitter won't help you either</old_tired_argument>

Uh wait... I used xml tags... do you guys think he'll understand them?

# re: Starting to come out of my funk..

left by at 6/1/2005 12:49 AM Gravatar

Design {atterns are more then just how to write code.  They are a great way to explain your problem space to a 3rd party that doesn't know the know your app.  I think the line in Fowler's book was that he just wanted to come up with a common language to express the different ways he was implementing some OO stuff.  Since a lot of what we do as coders is pretty repeatative, having a common name and description for solving a problem space sure makes it easier to communicate with others.

# re: Starting to come out of my funk..

left by at 6/1/2005 12:50 AM Gravatar

Design {atterns are more then just how to write code.  They are a great way to explain your problem space to a 3rd party that doesn't know the know your app.  I think the line in Fowler's book was that he just wanted to come up with a common language to express the different ways he was implementing some OO stuff.  Since a lot of what we do as coders is pretty repeatative, having a common name and description for solving a problem space sure makes it easier to communicate with others.

# re: Starting to come out of my funk..

left by at 6/1/2005 8:14 AM Gravatar

Don, that explains so much... I've wondered why others feel a need to document their own patterns... now it makes sense.

# re: Starting to come out of my funk..

left by at 6/1/2005 9:54 AM Gravatar

Careful about the DoFactory web site. They just repeated the Java patterns in C# form.  For example, the Observer pattern still uses an internal ArrayList and registration methods instead of delegates.

Maybe I'll have to write an interesting Design Patterns in .NET book.  :)

# re: Starting to come out of my funk..

left by at 6/1/2005 12:18 PM Gravatar

Ahh.. Mr. Kimble. Yes, I DO understand xml tags, unfortunately. ;-) Don't get me wrong, I'm not against patterns, I'm just against anyone feeling that their code is sh*t because they're not using an "official" design pattern. And being made to feel like a sh*t programmer by those who worship the almight pattern coming down from on high. Sorry, but a little too 133t <irony intentional> for my taste. Pulleez....

And no, I'm not the type to be dragged kicking and screaming into the "future" with new technologies; I do embrace change as I know it's part of our field. I just don't digest all the hype without reading the ingredients, that's all. Even though you have to use stuff you may not agree with. After-all, if business wants, business gets and I'm smart enough to follow the money.

# re: Starting to come out of my funk..

left by at 6/1/2005 1:42 PM Gravatar

UP: The only reason that design patterns are getting any hype is because the Softies discovered that there are many ways to shoot yourself in the foot with the .NET framework. They made C# too much like C++ and made it possible to write horrendously bad code. ;)

Rather than try to teach people to use common sense when coding and teach them to really understand what's going on under the covers, they started preaching design patterns. Heck, Rob Howard even went as far as to re-name the object factory the "provider factory" so it would have a Softie stamp on it. Yeah, yeah "it's more like a strategy/factory/singleton combination man, that makes it unique". Whatever floats your boat I guess. I've got the GoF book beside me here, copyright 1995. I've got "Patterns in Java" here too, copyight 1998.  The general Microsoft programming public are johnny-come-latelys to design patterns. Mainly because VB didn't really support them. I've worked on code where a C++ guy "implemented" an object factory in VB using interfaces. It was an abomination. Now that mainstream Microsoft "Mort" languages support patterns, more people are interested in them and acting like they are the end all be all. Argh, maybe I should take this rant over to my site. ;)

If you're a smart programmer, you're probably using them without even knowing.

# re: Starting to come out of my funk..

left by at 6/1/2005 4:19 PM Gravatar

Thanks Scott...

Inadvertantly (or maybe on purpose) you've made me feel even better... maybe I don't need to read the GoF book...

# re: Starting to come out of my funk..

left by at 6/1/2005 9:42 PM Gravatar

There I go again trusting someone I don't all know... <sigh>

Actually Scott is a regular commenter around here

# re: Starting to come out of my funk..

left by at 6/2/2005 12:21 AM Gravatar

Actually, I'm not a big fan of the GoF book.  Seems way to abstract for my tastes, but I understand why some people like it.  Me, I'd rather have Fowler's Patterns of Enterprise Arch and/or the DDD book on my desk while I'm designing code.

# re: Starting to come out of my funk..

left by at 6/6/2005 5:47 AM Gravatar

>  I think the line in Fowler's book was that he just wanted to come up with a common language to express the different ways he was implementing some OO stuff

We have that, it's called "a programming language". They're just not good enough yet:

www.codinghorror.com/.../000308.html

Title  
Name
Email (never displayed)
Url
Comments   
Please add 8 and 5 and type the answer here: