Skip to content

Instantly share code, notes, and snippets.

@mcsee
Last active August 21, 2023 17:33
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save mcsee/b4f9f8e80f19c89e99e10c999871ea2d to your computer and use it in GitHub Desktop.
Save mcsee/b4f9f8e80f19c89e99e10c999871ea2d to your computer and use it in GitHub Desktop.
class VerySpecificAndSmallObjectDealingWithPersistency {
constructor(retrieveStrategy) {
this.retrieveStrategy = retrieveStrategy;
}
retrieveData() {
this.retrieveStrategy.retrieveData();
}
}
// You get rid of the if condition by using a polymorphic strategy
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment