Upgrade to Pro — share decks privately, control downloads, hide ads and more …

What is Reactive Programming

What is Reactive Programming

In my experience, most of the developers despite junior or senior are struggling to move with reactive programming. even they succeed they have no idea why they doing it and why that concept invented... what problem it solves.. this video is beginning to explain that.
In reactive programming, data streams are going to be the base of your application. Events, messages, calls, and even failures are going to be conveyed by a data stream. With reactive programming, you observe these streams and react when a value is emitted.

Krishantha Dinesh

April 18, 2021
Tweet

More Decks by Krishantha Dinesh

Other Decks in Programming

Transcript

  1. Reactive programming (with video explanation) Krishantha Dinesh Msc, MIEEE, MBCS

    Software Architect www.krishantha.com www.youtube.com/krish @krishantha
  2. Find the explaining video • This slides explain (prasentation) training

    can find below URL • https://youtu.be/iTv62Dq5Z 1w
  3. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What is it ?

    • Reactive programing is nothing but programming paradigm which is allow us to manupulate steams of data using functions. • Everything happens (mean to) asynchronusly. • Which mean we do some operation of streams of data which start from one place and being consumed at other place
  4. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ keys Inorder to make

    reactive programming in reallity we need 3 things • Data as streams • Functional programing. (different from imperative programming) • Asynchronous observers. (part of the program execute in different timeline than others. Not a one line after other blocking execution)
  5. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What can do with

    it ? • Can be use anywhere where it take time to process the request. • As example calling rest API over http to fetch some data and fileter out result and populate on UI • Log notification / sensor data • Read data from datastore and do some processing on that before produce
  6. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Descend to 35000 to

    10000 ft 1 2 3 4 6 0 8 9 10 16 12 13 Filter (x => (x%2)==0 || (x%3)==0 ) 2 3 4 6 8 9 10 16 12 2 3 4 6 8 9 10 16 12 If function take time results can be shifted
  7. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Who's who 1 2

    3 4 6 0 8 9 10 16 12 13 2 3 4 6 8 9 10 16 12 Function use to manipulate the stream and process output Source (stream) who emit the data is call subject Entity who subscribed to the subject to consume the data call observer this can be 1 or multiple This use pub sub and call observer pattern. (https://en.wikipedia.org/wiki/Design_Patterns)
  8. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What is functional programming

    • Most of developers starts with imperative programming. So moving in to functional programming from that paradigm is not easy. • Other way also same and it would be more harder. • So understanding difference is importsant.
  9. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Imperative programming Functional programming

    Focus on how program works Focus on What is the objective (what to solve) Easy learning curve Can be long learning curve on migrations Functions, conditions, loops, and OOP concepts available Ideally to be stateless Statement can change state of the program Use functions to create expressions rather statements. We can use chains of functions Eg: Java , C Eg: scala If ( x%2==0 || x%3==0){ list.add(x); } var filetered=x=>{ return x%2==0 || x%3==0 }
  10. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ What languages do support

    this ? Reactive programming is a concept / theory of problem solveing. Most of languages specially early languages like C, C++, Java do not have this feature in build with the language. Need to use external libraries to achive this over.
  11. * http://www.krishantha.com * https://www.youtube.com/krish * https://www.linkedin.com/in/krish-din/ Is functional programming new?

    • First functional programming language was LIPS by IBM in 1950s • But 1980 – 2000 nish Java and OOP was dominated the industry so function programing wasn’t taking off • But when Node and other java script based languages getting popular again functional programing is taking off its journey.