Domanda di colloquio di Google

What is the strategy pattern in Java?

Risposta di colloquio

Anonimo

11 ott 2010

Strategy pattern allows encapsulates algorithms into objects and selects one at runtime depending on some filter like data type. ie:) When you're parsing a set of data; if the data set usually has smaller size you can use the strategy that parses all. If the data set is usually large you can choose a strategy that breaks it up into chunks Wikipedia has good examples: http://en.wikipedia.org/wiki/Strategy_pattern#Java

1