Category Archives: Design patterns

Strategy pattern: Transcoder example (JavaScript flavour)

This example is based on the declaration “Strategy pattern: Transcoder example“ Sources JS Bin About the code Based on as commented with generic example: TrancoderStrategy Declaration by prototype property The default behavior throw an exception in order to force subclasses to implement thesse methods

Concretes Strategies Declaration by prototype property  and Object.create()

Strategy pattern: Transcoder example (Java flavour)

This example is based on the declaration “Strategy pattern: Transcoder example”  Source: Sources: GIST About the code TranscondigTextService: class with “context” role. This class is interested of change its behavior in order to produce diferents kind of output codes TranscondigTextService(strategy: Strategy): constructor with initial strategy injection. transcoder: state that store the the reference to the… Read More »