Member-only story
Immediately stop using responsive programming and understand his original sin in one article
I don’t quite understand why more and more projects use reactive programming frameworks under the banner of high performance, and then mess up the code. Is reactive programming really that good? Or is it “ The world has suffered from reactive programming for a long time “, persecuting the flowers of our motherland? In my opinion, reactive programming has committed at least three sins: 1. Easy to cause complexity; 2. Difficult to debug; 3. Performance fog. In view of this, I hope that my colleagues in development can choose a programming paradigm that is really suitable for themselves and their team.
Crime 1: Easy to cause complexity
The code of reactive programming is usually more complex than traditional imperative programming. Essentially, it encapsulates callbacks and needs to convert step-by-step operations into callbacks one by one. Because the bottom layer adopts the observer pattern, we need to register all business operations in Publisher and then receive data flow through notification mode. In order to play the role of asynchronous programming, this chain cannot be broken, which makes it easy for developers to write code with many points, points, points, points…, poor readability and error-prone. As shown below, this is a real project code example.
private Mono<HyperClusterSwitch> ensureSwitchConfigured(String parentJobId, HyperClusterPort port) {
String switchIp =…