develwoutacause’s avatardevelwoutacause’s Twitter Archive—№ 1,327

  1. …in reply to @cramforce
    @cramforce To some extent yes, if you have thousands of flags it means you have thousands of if (flag) which sounds pretty spaghetti. But if each flag is only ever used in one if-statement, then I would argue that's pretty well managed complexity.
    1. …in reply to @develwoutacause
      @cramforce I think the real spaghetti would be: if (flag1) { if (flag2) doSomething(); else if (flag3) doSomethingElse(); else doSomethingElser(); } And *that* is avoidable with keystones when used correctly.
      1. …in reply to @develwoutacause
        @cramforce Actually a better example would be: // foo.js if (flag) doSomething(); bar.doSomethingRelated(); // bar.js function doSomethingRelated() { if (flag) doSomethingElse(); } The keystone pattern helps avoid flag usage like this to avoid that kind of spaghetti.