I’ve read deep in NodeJS today. Although I haven’t written nodeJS for a long time, but I learn a lot for the book.
Recommanded for you.
Promise/Defered
Promise pattern is wilderly used in JQuery framework, it solved Pyramid of Doom issue. And it quit useful in Android development.
In our company project, we always wrapped a asynchronously framework for network request. some complex requirement will be implemented by request server several times, and the code will be ugly.
Promise pattern will help us to solve this proplem.I found a java framework to implement promise pattern.
1 | Deferred deferred = new DeferredObject(); |
1 | DeferredManager dm = new DefaultDeferredManager(); |
It makes you source code more readable.