Posts

Showing posts from December, 2009

codepaste.net

Following on the example of @gblock I decided to tryout codepaste.net. Maybe this will be the answer to pasting snippets instead of pasting them in code here.

sample

Difference Between Adapter and Bridge Design Patterns

As I was preparing for an upcoming presentation on the topic of Design Patterns, I was studying through the different patterns and could not differentiate between the Bridge Pattern and the Adapter Pattern. Right off the bat both of those patterns fall into the category of structural patterns. Both of those patterns allow us to take advantage of the Liskov Substitution principle. Both patterns allow us to swap out implementations.

It seems that I am not alone in getting confused in the disctintion between these two patterns. A simple google search with the phrase "bridge and adapter pattern" returns quite a few results. Here is an article in code project that illustrates the difference to a certain degree.

What came to mind in trying to determine the pattern required is the forces at work. This something that Steve Tockey pointed out when determining what pattern to use. He said basically that an engineer does not wake up one day and say "I think I will build a suspension…

The Boy Scout Principle

Earlier this week I helped out a junior colleague to solve a problem. I really just told him the quick fix. The fix involved overloading a method and accessing a property through reflection. Why reflection you ask? Well the code was written that way. All we had to do was follow suit and use reflection to access the property that we needed. The use of reflection made the code extremelly ugly and difficult to read. I didn't pay much attention to it so I provided the answer on how to access the property and went on my merry way.

When I got home I was going through my tweets and found the following link in a re-tweet by Uncle Bob (@unclebobmartin):

http://www.se-radio.net/podcast/2009-11/episode-150-software-craftsmanship-bob-martin

I listened to this podcast in it's entirety. In it Bob Martin talks about the different disciplines related to software craftsmanship; TDD, CI, etc. In particular one thing caught my attention. That was the concept which he refers to as "the boyscout…