4 ms·
Take a look at rules engines and Expert Systems technology. Its a more declarative way to handle complex logic that allows you to state facts and let a inferenc
by bluejay2387 7y ago
Take a look at rules engines and Expert Systems technology. Its a more declarative way to handle complex logic that allows you to state facts and let a inference engine handle the nested nature of dependent logical conditions. It will decrease the amount of work needed to code this part of your game. With your current approach you end up in the logic programming version of Node's call back hell before we had tools like async await. As an aside, I run into developers taking the same approach with business logic in enterprise apps all the time -- with the same consequences.
- erikpukinskis 7y agoCallback hell is easily avoided by naming callbacks. Async/await has its own footguns, except they’re so difficult to debug that you need static analysis tools (Typescript or ESLint) to use them safely. It’s one of that most special class of APIs that let you add a bug in one part of the system (e.g. forgetting an await) that causes a totally different part of the system to fail inscrutably. (Although really it’s Promises that unlock this ability, but potato/potahto.) Callbacks are easily debugged with just a normal JavaScript interpreter.