Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between Object Oriented Programming and Reactive Programming

I have a fair amount of knowledge about Object Oriented Programming and have very little understanding of Reactive Programming.

Can anyone explain the difference between Object Oriented Programming and Reactive Programming?

like image 897
bilibili Avatar asked Mar 09 '16 03:03

bilibili


1 Answers

In shorts, Object Oriented Programming(OOPs) is a type programming language(design) and reactive programming is a programming paradigm which deals with Asynchronous data flows.

Reactive programming is independent of language types(oops/function-based). Lets take an example:-

If you are calculating a sum of two numbers on remote server(rpc), then you have to send numbers to the server and call the sum method(procedure) and then server replies sum to you. Now you are happy and server is also happy. But wait, if you call another procedure which is summing a big file which is already on server, which might take few seconds(or may be minutes), so after calling that procedure your program will wait for response. Now you are impatient to execute other things also, so you will think I will better execute this part in other thread which will provide the sum whenever it arrive. This is what a reactive programming, you are handling data asynchronously.

like image 186
Devavrata Avatar answered Oct 19 '22 04:10

Devavrata