Skip to content

Instantly share code, notes, and snippets.

@yaakov123
Created August 3, 2020 10:00
Show Gist options
  • Save yaakov123/efa021d2687e3e1cfb0e807ee3f8571a to your computer and use it in GitHub Desktop.
Save yaakov123/efa021d2687e3e1cfb0e807ee3f8571a to your computer and use it in GitHub Desktop.
class Director {
constructor(builder) {
this.builder = builder;
}
constructFamilyHouse() {
return this.builder
.buildWalls(4)
.buildRoof('sloped')
.buildGarden(['trees', 'grass', 'peacocks'])
.getHouse();
}
constructMansion() {
// Steps for building a mansion
}
}
const director = new Director(new HouseBuilder());
const familyHouse = director.constructFamilyHouse();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment