Actually, this wouldn't be the right solution, because the doSomething action is specific to a particular algorithm, and there will be tens of such algorithms, and I don't want to clutter the main class with parts of algorithms adapted to each class...