The Builder Pattern in .NET: Listing 5

Listing 5: BrewMaster.cs

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
 
namespace VSMBuilderPatternDemo.Builder
{
    public class BrewMaster 
    {
        IBeerBuilder _beerBuilder;
 
        public void SetBeerBuilder(IBeerBuilder beerBuilder)
        {
            _beerBuilder = beerBuilder;
        }
 
        public Beer GetBeer()
        {
            return _beerBuilder.GetBeer();
        }
 
        public void BrewBeer()
        {
            _beerBuilder.Brew();
            _beerBuilder.Ferment();
            _beerBuilder.Bottle();
            _beerBuilder.Age();
        }
    }
}

About the Author

Eric Vogel is a Senior Software Developer for Red Cedar Solutions Group in Okemos, Michigan. He is the president of the Greater Lansing User Group for .NET. Eric enjoys learning about software architecture and craftsmanship, and is always looking for ways to create more robust and testable applications. Contact him at [email protected].

comments powered by Disqus

Featured

Subscribe on YouTube