<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:dc="http://purl.org/dc/elements/1.1/" version="2.0">
  <channel>
    <title>DigitalDilettante.com - Patterns</title>
    <link>http://digitaldilettante.com/blog/</link>
    <description>Technology ramblings from a dilettante of all things digital</description>
    <language>en-us</language>
    <copyright>Dan Collier</copyright>
    <lastBuildDate>Wed, 01 Aug 2007 18:08:40 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.9.7174.0</generator>
    <managingEditor>csharpster+nospam@gmail.com</managingEditor>
    <webMaster>csharpster+nospam@gmail.com</webMaster>
    <item>
      <trackback:ping>http://digitaldilettante.com/blog/Trackback.aspx?guid=0353bd55-186e-473b-8c0f-7a84dfaf0939</trackback:ping>
      <pingback:server>http://digitaldilettante.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://digitaldilettante.com/blog/PermaLink,guid,0353bd55-186e-473b-8c0f-7a84dfaf0939.aspx</pingback:target>
      <dc:creator>Dan's Site</dc:creator>
      <wfw:comment>http://digitaldilettante.com/blog/CommentView,guid,0353bd55-186e-473b-8c0f-7a84dfaf0939.aspx</wfw:comment>
      <wfw:commentRss>http://digitaldilettante.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=0353bd55-186e-473b-8c0f-7a84dfaf0939</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
Strategy
</p>
        <p>
Notes:<br />
shove dynamic behavior into interfaces.  have the main base compose the behavior
interfaces.  Then you can dynamically assign the behavior interface instances
in the child classes of the main base class.
</p>
        <p>
Decorator:
</p>
        <p>
Basically think of an abstract class like a vehicle.  Then you have a couple
of classes inherited directly off of it: truck, bike broken down Chevy, etc. 
Then u have a base decoration class, which inherits off of vehicle and also contains
a member instance of vehicle, so it both "has a" and "is a" vehicle, and has a constructor
that takes a vehicle type.  Next, you've got a bunch of decorations, each of
which inherits off of the root decoration class, such as pimped out, racing striped,
washed, waxed, painted pink, etc.  
</p>
        <p>
So in code, you can create any of these decorations and pass them in a vehicle or
a decorated vehicle.  This way you can have pink truck just as easily as you
can have a pimped out-washed-waxed-racing striped broken down Chevy, without having
to create a complicated inheritance tree for each possible combination.
</p>
        <ul>
          <li>
Some Notes:<br />
sort of define your own inheritance tree on the fly</li>
          <li>
defines an "is a"/"has a" relationship between the decorations and the object
they're decorating</li>
          <li>
one possible use:  to dynamically aggregate functionality of semi-heterogenous
items</li>
          <li>
composition + inheritance</li>
        </ul>
        <img width="0" height="0" src="http://digitaldilettante.com/blog/aggbug.ashx?id=0353bd55-186e-473b-8c0f-7a84dfaf0939" />
      </body>
      <title>Patterns Day 1: Strategy and Decorator</title>
      <guid isPermaLink="false">http://digitaldilettante.com/blog/PermaLink,guid,0353bd55-186e-473b-8c0f-7a84dfaf0939.aspx</guid>
      <link>http://digitaldilettante.com/blog/2007/08/01/PatternsDay1StrategyAndDecorator.aspx</link>
      <pubDate>Wed, 01 Aug 2007 18:08:40 GMT</pubDate>
      <description>&lt;p&gt;
Strategy
&lt;/p&gt;
&lt;p&gt;
Notes:&lt;br&gt;
shove dynamic behavior into interfaces.&amp;nbsp; have the main base compose the behavior
interfaces.&amp;nbsp; Then you can dynamically assign the behavior interface instances
in the child classes of the main base class.
&lt;/p&gt;
&lt;p&gt;
Decorator:
&lt;/p&gt;
&lt;p&gt;
Basically think of an abstract class like a vehicle.&amp;nbsp; Then you have a couple
of classes inherited directly off of it: truck, bike broken down Chevy, etc.&amp;nbsp;
Then u have a base decoration class, which inherits off of vehicle and also contains
a member instance of vehicle, so it both "has a" and "is a" vehicle, and has a constructor
that takes a vehicle type.&amp;nbsp; Next, you've got a bunch of decorations, each of
which inherits off of the root decoration class, such as pimped out, racing striped,
washed, waxed, painted pink, etc.&amp;nbsp; 
&lt;/p&gt;
&lt;p&gt;
So in code, you can create any of these decorations and pass them in a vehicle or
a decorated vehicle.&amp;nbsp; This way you can have pink truck just as easily as you
can have a pimped out-washed-waxed-racing striped broken down Chevy, without having
to create a complicated inheritance tree for each possible combination.
&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;
Some Notes:&lt;br&gt;
sort of define your own inheritance tree on the fly&lt;/li&gt;
&lt;li&gt;
defines an&amp;nbsp;"is a"/"has a" relationship between the decorations and the object
they're decorating&lt;/li&gt;
&lt;li&gt;
one possible use:&amp;nbsp; to dynamically aggregate functionality of semi-heterogenous
items&lt;/li&gt;
&lt;li&gt;
composition + inheritance&lt;/li&gt;
&lt;/ul&gt;
&lt;img width="0" height="0" src="http://digitaldilettante.com/blog/aggbug.ashx?id=0353bd55-186e-473b-8c0f-7a84dfaf0939" /&gt;</description>
      <comments>http://digitaldilettante.com/blog/CommentView,guid,0353bd55-186e-473b-8c0f-7a84dfaf0939.aspx</comments>
      <category>Patterns</category>
    </item>
    <item>
      <trackback:ping>http://digitaldilettante.com/blog/Trackback.aspx?guid=42bd8254-b990-4d21-93f7-989a7c2cb291</trackback:ping>
      <pingback:server>http://digitaldilettante.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://digitaldilettante.com/blog/PermaLink,guid,42bd8254-b990-4d21-93f7-989a7c2cb291.aspx</pingback:target>
      <dc:creator>Dan's Site</dc:creator>
      <wfw:comment>http://digitaldilettante.com/blog/CommentView,guid,42bd8254-b990-4d21-93f7-989a7c2cb291.aspx</wfw:comment>
      <wfw:commentRss>http://digitaldilettante.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=42bd8254-b990-4d21-93f7-989a7c2cb291</wfw:commentRss>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
As good of a computer science education that I think I received, when I was an IROC
(Idiot Right out of College) I was definitely lacking huge in certain areas. 
Chief among these were software engineering (which I think I'm a lot better at now)
and beyond basic OO, the fine art of Design Patterns.  I've managed to read about
half of <a href="http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/ref=pd_bbs_sr_1/002-1007865-8628859?ie=UTF8&amp;s=books&amp;qid=1184785927&amp;sr=8-1">Head
First Design Patterns</a> and actually implement a few at work.  However,
I still feel way behind on them overall, so I started a study group with some coworkers. 
We'll attack 2 patterns a week.  I'll post notes about them and links to examples
in my svn repository.
</p>
        <p>
Enjoy!
</p>
        <img width="0" height="0" src="http://digitaldilettante.com/blog/aggbug.ashx?id=42bd8254-b990-4d21-93f7-989a7c2cb291" />
      </body>
      <title>Design Patterns Pow Wow</title>
      <guid isPermaLink="false">http://digitaldilettante.com/blog/PermaLink,guid,42bd8254-b990-4d21-93f7-989a7c2cb291.aspx</guid>
      <link>http://digitaldilettante.com/blog/2007/07/18/DesignPatternsPowWow.aspx</link>
      <pubDate>Wed, 18 Jul 2007 19:14:34 GMT</pubDate>
      <description>&lt;p&gt;
As good of a computer science education that I think I received, when I was an IROC
(Idiot Right out of College) I was definitely lacking huge in certain areas.&amp;nbsp;
Chief among these were software engineering (which I think I'm a lot better at now)
and beyond basic OO, the fine art of Design Patterns.&amp;nbsp; I've managed to read about
half of &lt;a href="http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/ref=pd_bbs_sr_1/002-1007865-8628859?ie=UTF8&amp;amp;s=books&amp;amp;qid=1184785927&amp;amp;sr=8-1"&gt;Head
First Design Patterns&lt;/a&gt;&amp;nbsp;and actually implement a few at work.&amp;nbsp; However,
I still feel way behind on them overall, so I started a study group with some coworkers.&amp;nbsp;
We'll attack 2 patterns a week.&amp;nbsp; I'll post notes about them and links to examples
in my svn repository.
&lt;/p&gt;
&lt;p&gt;
Enjoy!
&lt;/p&gt;
&lt;img width="0" height="0" src="http://digitaldilettante.com/blog/aggbug.ashx?id=42bd8254-b990-4d21-93f7-989a7c2cb291" /&gt;</description>
      <comments>http://digitaldilettante.com/blog/CommentView,guid,42bd8254-b990-4d21-93f7-989a7c2cb291.aspx</comments>
      <category>Patterns</category>
    </item>
  </channel>
</rss>