Skip to main content

Posts

Showing posts with the label concrete

VBA versus .NET

Bridge Pattern

A bare-bones, generic implementation of the bridge pattern, using inheritance, polymorphism, and abstraction.  Salient Characteristic(s) Decouple classes, allowing them to vary independently Useful when frequent changes are made to classes Code namespace DesignPatterns {     /// <summary>     /// The implementor: the abstract class, and concrete implementation of one side of the relation     /// </summary>      public interface IBridgeAbstraction     {         void Build();     }          abstract class BridgeAbstraction : IBridgeAbstraction     {         public abstract void Build();     }     class ConcreteBridge1 : BridgeAbstraction     {         public override void Build()         {         }   ...

Abstract Cat Factory (Amusement)

A friend amusingly posted on Facebook a retro photograph of four (4) 'designers' around a cat, with the caption alluding to designing hats for cats, and so I decided to make, somewhat incongruously, an abstract cat factory, which varies by the location of the cat..   Salient Characteristic(s) Classes derived from abstract types Class creates derived (concrete) classes based on type required Code namespace DesignPatterns {     public enum Location     {         Kitchen,         Bedroom,         LivingRoom     }     public enum Amusements     {         String,         Mouse,         Food,         Sleep     }          public abstract class Feline     {         public abstract Feline HereKittyKitty...