Skip to content

Instantly share code, notes, and snippets.

@zapkub
Last active September 28, 2018 01:47
Show Gist options
  • Save zapkub/f65d1d46fbe9e184cd9f48f7fdcbe396 to your computer and use it in GitHub Desktop.
Save zapkub/f65d1d46fbe9e184cd9f48f7fdcbe396 to your computer and use it in GitHub Desktop.
// OOP ?
class TheProblemSolver {
solve(problem: Problem){ }
}
const problemSolver = new TheProblemSolver()
problemSolver.solve(p)
// OR just pure functional if it pure
function solveProblem(problem: Problem) { }
solveProblem(p)
// OR if it pure? use static property ! stick to the class
class TheProblemSolver {
public static solve(problem: Problem){ }
}
TheProblemSolver.solve(p)
// OR more complicate paradigm
const ioc = new Container()
ioc.bind(TheProblemSolver).toSelf()
ioc.get(TheProblemSolver).solve(p)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment