/strategy

Simple project demonstrating the Strategy design pattern. For this one I've made a representation of a text converter.

Primary LanguageJavaGNU General Public License v3.0GPL-3.0

Strategy

Code

Simple project representing the Strategy design pattern. For this one I've made a representation of a text converter.

Definition

Strategy is a behavioral design pattern that lets you define a family of algorithms, put each of them into a separate class, and make their objects interchangeable

image

For instance, a class that performs validation on incoming data may use the strategy pattern to select a validation algorithm depending on the type of data, the source of the data, user choice, or other discriminating factors. These factors are not known until run-time and may require radically different validation to be performed. The validation algorithms (strategies), encapsulated separately from the validating object, may be used by other validating objects in different areas of the system (or even different systems) without code duplication.

Source: Wikipedia | Refactoring Guru