Click here to Skip to main content
15,896,915 members
Articles / Programming Languages / Visual Basic

Design Your Soccer Engine, and Learn How To Apply Design Patterns (Observer, Decorator, Strategy, and Builder Patterns) - Part III and IV

Rate me:
Please Sign up or sign in to vote.
4.87/5 (70 votes)
21 Oct 2009CPOL9 min read 126.4K   607   144  
This article is a continuation of the previous article, and in this article, we will discuss (1) Applying the Strategy pattern to solve design problems related with 'Team' and 'TeamStrategy', and (2) Applying the Decorator pattern to solve design problems related with the 'Player'.
��'ConcreteDecorator: Defender class is a Concrete implementation
'of the  PlayerRole (Decorator) class

Public Class Defender
    Inherits PlayerRole

    'Added Behavior: This is a responsibility exclusively for the Defender
    Public Sub Defend()
        System.Console.WriteLine("   Defender ({0}) -  defended the ball", _
                                         MyBase.player.Name)
    End Sub

End Class ' END CLASS DEFINITION Defender

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Architect
India India
Architect, Developer, Speaker | Wannabe GUT inventor & Data Scientist | Microsoft MVP in C#

Comments and Discussions