HowTo: Composite Design Pattern in Java

A video tutorial in implementing composite design pattern in java

In this tutorial, we will imitate the Unity's GetComponent() generic method in which you input the class name to get the instance of that component. The video provides a tutorial of building a simple composite design pattern with an easy to follow example of how to use it. The example shown in the video will be a BaseObject class with a Weapon and Health component. Below is a simple diagram.

  • BaseObject contains:
    • WeaponComponent extends BaseComponent
    • HealthComponent extends BaseComponent


Popular Posts