OK, I have GoF. I have EAS2. I have J2EE Core Patterns, I have several others. I’ve downloaded, printed out and read more pattern tutorials than I care to think about. Sure, I kind of got it. But I didn’t really GET it. I don’t USE patterns when I’m creating a new project, though some might end up in there as if by accident. Mostly I sit down to read this stuff and wake up with design patterns pasted to my cheek with my own spit.
This weekend I noticed this book in the store: Head First Design Patterns. All I can say is, I am getting it! This book rocks. It’s as easy to read as a “Dummies” book, but not so…. dumb. It’s humorous, fun to read and most of all, you come away really understanding the patterns. You’ll probably find yourself cringing at the example projects they start out with (the bad-code, “before” examples), because you’ve probably done the exact same things. Then they walk you through it as you clean up the mess and transform it into something really elegant.
It’s written for Java, but you should have no problem whatever porting it over to AS2. Most of the conversion is just moving the types to the other side of the variable names. The rest of the code you can almost copy and paste.
In 24 hours I made it through Stragegy and Observer, and while I kind of had an idea of what they were before, they are now part of my thinking process. No doubt I’ll be using them. If you’ve been struggling with patterns, this book will save your life. (Buy it from the above link and I’ll get a nice fat gift certificate at the end of the quarter! Then I can buy some more books to sell you on.)
Sure, it’s a great book. In fact, all the “Head first” books are a must have IMHO
I read that book in 24 hours.. couldn’t get myself to let it go ;-). I agree totally that this book rocks. I had the same experience like a week ago where I found that book online… I had to have it immediately as well.
Same experience at my shop last month with the book. Before that, the big book that I recommended to people was Design Patterns Explained. However, they just published a second edition that is twice as thick that I have yet to check out…
Hope the snow in Boston isn’t too bad… 🙂
I just bought this book because of your recommendation and am loving it, but I do have one question for you about converting to as2 …
In the first chapter talking about favoring composition over inheritance … the duck examples, I’m having a little trouble with a type mismatch error in flash.
In the Duck class I have:
var quackBehavior:QuackBehavior;
var flyBehavior:FlyBehavior;
In the MallardDuck class that extends Duck I have under the constructor:
quackBehavior = new Quack();
flyBehavior = new FlyWithWings();
This is where my type mismatch error comes into play. “found Quack where QuackBehavior is required.” … “found FlyWithWings where FlyBehavior is required.”
Since Quack implements QuackBehavior and FlyWithWings implements FlyBehavior, should there be a type mismatch? Isn’t Quack a QuackBehavior and isn’t FlyWithWings a FlyBehavior? … or maybe my syntax is wrong … I would appreciate any light you might be able to spread on the subject. Thanks in advance and thanks again for the great book recommendation.
I have all the same code you described and it works fine for me. Must be a syntax error somewhere.
Alright. I give in. I’ve been skimming your blogs for a little while and recently you seemed to be all hopped-up on design patterns. Please forgive me for my ignorance, but what are design patterns and should I be getting excited about them, too?
I am a web designer/developer who designs using in Flash and your run-of-the-mill HTML pages, as well as doing small applications in ASP and am learning PHP. I haven’t dabbled in JSP at all but have been threatening to for a little while now. I use XML files quite a bit recently for my ASP apps.
You seem to be quite excited about design patterns…so excited that even I’m getting excited about them and haven’t much more of a clue as to what they are other than tried-and-true methods of developing things, whether it’s software design or civil engineering, that can be used over and over. That’s what I could gather anyway. Is that correct? Given the limited knowledge of me, is this something you think I should persue? If so, is this Head First book the correct path? Or is there a web site someone could direct me towards to answer all of my questions so I don’t have to bug you about it.
Thanks for your time.
I think design patterns are more useful the larger the project. Although you could apply them to very small programs or scripts, you’re not going to see much of a benefit, and possibly you would be trying to cram too much organization into something that doesn’t need it, which might end up complicating matters. If you have one shelf worth of books, you don’t really need to implement a card catalogue system to keep track of them.
But the bigger your programs get, the more complex they get. At some point, the complexity becomes chaos and you need to put some higher level organization into it. That’s all patterns are. Lately I’ve been doing larger and larger, more complex projects, and patterns are a life saver.
Ahhhhh…that makes sense. I guess that’s good. One less thing for me to worry about learning.
Thanks and keep up the good work!