interface process PackageStrategy has method processPackage(package); //These strategies implement the algorithm by implementing the interface above. class SendByRail implements process PackageStrategy has method processPackage(package) { //process the package that will be sent by Rail and return something } class SendByBike implements process PackageStrategy has method processPackage(package) { // process and return something } //strategies used by the context class class Context { private strategy: processPackageStrategy method setStrategy(processPackageStrategy Strategy) does this.strategy= strategy; method executeStrategy(Package package) does return strategy.processPackage(); } // read that strategy from user (UI or Api) class App { create a new context instance; get package info; read the desired user choice if (choice is rail) then context.setStrategy(new SendByRail()) if (choice is bike) then context.setStrategy(new SendByBike()) response = context.executeStrategy(package) //do something with response.