NG - suniladhya/Advantage GitHub Wiki
Functional Programming
Asynchronous programming lead to the Unpredictability of order in which the data passes through application.
Hence having a more functional paradigm would help to resolve the situation
You want your application to be more predictable, but the scaling up of applications that run client side means less predictability.
Hence comes the Rise of the promises
Promise came to existence to solve the problems we have with XHRS.
XHRs came to save us from call back hell.
PROMISE Increase => CALLBACK Increase
Arrival of Observables
RXJS unifies the "Promise", Callback, data flow
HTTP.get method returns a Promise.
AND... http.get('api/json') returns a promise
promise:
having one pipeline usually only use with async data return not easy to cancel observable:
are cancellable are retriable by nature such as retry and retryWhen stream data in multiple pipelines having array-like operations like map, filter etc can be created from other sources like events they are functions, which could be subscribed later on Also, I've created the graphical image for you below to show the differences visually:
Promises and Observables image
AOT
Angular compiles the Dom Templates and sends the compiled versions to the Browser.
Again the Compiler is not sent to the browser, only the
No time is lost in the client compiling the Dom function.
Pure vs. Impure Piepes
Pure: Only evaluated when input changes. Impure: evaluated on every change detection cycle
Pure are simple, and Impure are complex