DEV Community

Discussion on: Self healing code

zyabxwcd profile image

Simply amazing. This is food for thought. Self-healing code is an underrated topic I guess and whenever people do talk about it, it gets complicated cause they talk about the AI angle of it but this is something new and interesting. Also, I was thinking if what you said in this article is limited to certain very specific kinds of errors. For eg:

  1. writing a local custom built library as a fallback to an external API catering to some business logic.
  2. registering the API in the skip list cause you know beforehand that when will and against what input that error will occur and you also know that running it against your primary db will solve it. both these example show that you know precisely when and what will cause an error, and then we write a fallback designed just for that particular error. i think this version of self-healing code cannot be generalised very effectively as the errors are generally very diverse and the fallbacks we would have write will be too specific to each error and then think about the combinations and compatibility among these fallbacks. wouldn't this approach get limited to certain big hiccups you know will cause certain very specific errors beforehand? I was thinking maybe then the approach you described has to be applied to key areas only that the developers have to carefully pick out and identify. The compatibility and inter-connectivity among fallbacks would also be a little complicated to handle. An abstract interface that wraps both the fallback and original approach has to be built and I guess it probably would be beneficial to emit an event across the app that the system has to switch to a fallback so that other dependent parts can adjust themselves if needed.
naarok profile image
John Zittlau Author

Agreed, generalizing this could be tough. I do like your idea of an abstract interface that emits an event. But yes, I believe the developer needs to have a solid understanding of the cause of the error and the implications of re-running (in this case) or more generally, recovering. So this likely needs to be implemented on a case by case basis