RSS Feed for StructuralCategory: Structural

Design Pattern in .NET 101 - Facade Pattern (Structural Pattern) »

Download Sample Code
Facade Pattern provides a unified interface to a set of interfaces in a subsystem. It defines a higher-level interface that makes the subsystem easier to use.
E.g.
I have a Call Details Record (CDR) to be processed by different systems. It is defined in the CDR class

using System;
using System.Collections.Generic;
using System.Text;

namespace FacadePattern
{
class […]

Design Pattern in .NET 101 - Decorator Pattern (Structural Pattern) »

Download Sample Code
Decorator Pattern attaches additional responsibilities to an object dynamically and provides a flexible alternative to subclassing for extending functionality.
E.g.
BaseMessage is defined

using System;
using System.Collections.Generic;
using System.Text;

namespace DecoratorPattern
{
abstract class BaseMessage
{
private string sender;
[…]

Design Pattern in .NET 101 - Proxy Pattern (Structural Pattern) »

Download Sample Code
Proxy Pattern provides a surrogate or placeholder for another object to control access to it.
E.g.
I defined a IGreeting interface

using System;
using System.Collections.Generic;
using System.Text;

namespace ProxyPattern
{
interface IGreeting
{
void SayHello();
}
}

Greeting implements IGreeting

using System;
using System.Collections.Generic;
using System.Text;

namespace ProxyPattern
{

[…]