Strategy pattern.
Factory method pattern.