SlideShare una empresa de Scribd logo
1 de 25
April 2018
www.asiantech.vn
D E V D A Y
2 0 1 8
STUDIED AT DA NANG UNIVERSITY OF
SCIENCE AND TECHNOLOGY
TECHNICAL LEADER AT ASIAN TECH
ME
2
NAME: UNG VĂN THỊNH
PLATFORM: iOS
April 2018
www.asiantech.vn
R E A C T I V E
P R O G R A M M I N
G
SLIDE
4
PROGRAMMING PARADIGMS
SLIDE
5
A way to classify programming languages based on their features
Concept
SLIDE
6
IMPERATIVE
PROGRAMMING
Uses statements that change a program's state
Telling the “machine” how to do something, and as a result what you want to
happen will happen
Most widely used paradigm
Concept
SLIDE
7
DECLARATIVE
PROGRAMMING
Expresses the logic of a computation without describing
its control flow
Describes what you want to do, and not how you want to do it
THE RISE OF
DECLARATIVE
PROGRAMMING
SLIDE
8
MINIMIZE MUTABILITY
REDUCE STATE SIDE-EFFECTS
LEAD TO MORE UNDERSTANDABLE
AND MORE SCALABLE CODE
REACTIVE PROGRAMMING
SLIDE
9
Reactive
Definition
SLIDE
10
REACTIVE
PROGRAMMING
Reactive programming is programming with asynchronous data streams
Example
SLIDE
11
REACTIVE
PROGRAMMING
STREAM
CENTRAL OF REACTIVE
VARIABLES, USER INPUTS,
PROPERTIES, CACHES, DATA
STRUCTURES, ETC.
OVER TIME
SLIDE
12
AbstractionREACTIVE
PROGRAMMING
Observable/Observer
SLIDE
13
REACTIVE
PROGRAMMING
Observable
Observer
Observer
onNext()
onError()
onCompleted()
Operator
SLIDE
14
REACTIVE
PROGRAMMING
Transform a stream to other stream
map()
reduce()
filter()
etc.
VS Traditional programming
SLIDE
15
REACTIVE
PROGRAMMING
var a = 1
var b = 2
var c = a + b
print(c)
let a: Variable<Int> = Variable(1)
let b: Variable<Int> = Variable(2)
let c = Observable.combineLatest(a, b)
c.subscribe { (value) in
print(value)
}
// c = 3
a = 5
print(c)
// c = 3
// c = 3
a.value = 5
// c = 7
{ $0 + $1 }
ASYNCHRONOUS
SLIDE
16
AdvantageREACTIVE
PROGRAMMING
Thread 1Thread 2Thread 3
Main ThreadobserveOn()
updateView()
ASYNCHRONOUS
SLIDE
17
AdvantageREACTIVE
PROGRAMMING
USER INTERACTION
SLIDE
18
AdvantageREACTIVE
PROGRAMMING
USER INTERACTION
SLIDE
19
AdvantageREACTIVE
PROGRAMMING
EXTENSIBILITY
SLIDE
20
AdvantageREACTIVE
PROGRAMMING
Example:
- Array of Int
- Take 3 first elements
- Less than 10
DATA BINDING
SLIDE
21
AdvantageREACTIVE
PROGRAMMING
SLIDE
22
extensionsREACTIVE
PROGRAMMING
RxJava
RxJS
RxRuby
RxSwift
RxPHP
Etc.
PROGRAMMING TRENDING
SLIDE
23
BENEFIT OF REACTIVE
PROGRAMMING
WHAT IS REACTIVE
PROGRAMMING
EXTENSIONS
ReviewREACTIVE
PROGRAMMING
SLIDE
24
REACTIVE
PROGRAMMING
Are you ready to adopt this programming paradigm?
THANKS!
Any questions?
You can contact me:
Mail: thinh.ung@asiantech.vn
Phone: 097 9476275
25

Más contenido relacionado

Similar a [DevDay2018] Reactive Programming - By Thinh Ung, Technical Leader at Asian Tech

2011B1A7689G-TrishuDey-Report
 2011B1A7689G-TrishuDey-Report 2011B1A7689G-TrishuDey-Report
2011B1A7689G-TrishuDey-Report
Trishu Dey
 
04-Android Platform for Acedamics
04-Android Platform for Acedamics04-Android Platform for Acedamics
04-Android Platform for Acedamics
Sivaram P
 
51477813 45498199-sonia-f-sap-fico-project
51477813 45498199-sonia-f-sap-fico-project51477813 45498199-sonia-f-sap-fico-project
51477813 45498199-sonia-f-sap-fico-project
Arup Bose, PMP
 

Similar a [DevDay2018] Reactive Programming - By Thinh Ung, Technical Leader at Asian Tech (20)

Introduction to computer science
Introduction to computer scienceIntroduction to computer science
Introduction to computer science
 
2011B1A7689G-TrishuDey-Report
 2011B1A7689G-TrishuDey-Report 2011B1A7689G-TrishuDey-Report
2011B1A7689G-TrishuDey-Report
 
Cracking the Code: A Holistic Look at the Developer Industry
Cracking the Code: A Holistic Look at the Developer IndustryCracking the Code: A Holistic Look at the Developer Industry
Cracking the Code: A Holistic Look at the Developer Industry
 
Ws002 use cases
Ws002 use casesWs002 use cases
Ws002 use cases
 
CSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android ApplicationCSE Final Year Project Presentation on Android Application
CSE Final Year Project Presentation on Android Application
 
EasyJPJ : Mobile Application Slide
EasyJPJ : Mobile Application SlideEasyJPJ : Mobile Application Slide
EasyJPJ : Mobile Application Slide
 
ICT, Importance of programming and programming languages
ICT, Importance of programming and programming languagesICT, Importance of programming and programming languages
ICT, Importance of programming and programming languages
 
Appear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile appsAppear IQ The Business Case for hybrid html5 mobile apps
Appear IQ The Business Case for hybrid html5 mobile apps
 
Android best training-in-mumbai
Android best training-in-mumbaiAndroid best training-in-mumbai
Android best training-in-mumbai
 
Android N 7 Prominent Features
Android N 7 Prominent FeaturesAndroid N 7 Prominent Features
Android N 7 Prominent Features
 
MADMiniProjectppt.pptx
MADMiniProjectppt.pptxMADMiniProjectppt.pptx
MADMiniProjectppt.pptx
 
MADMiniProjectppt.pptx
MADMiniProjectppt.pptxMADMiniProjectppt.pptx
MADMiniProjectppt.pptx
 
UML1
UML1UML1
UML1
 
Google Assistant Revolution
Google Assistant RevolutionGoogle Assistant Revolution
Google Assistant Revolution
 
Project report
Project reportProject report
Project report
 
04-Android Platform for Acedamics
04-Android Platform for Acedamics04-Android Platform for Acedamics
04-Android Platform for Acedamics
 
51477813 45498199-sonia-f-sap-fico-project
51477813 45498199-sonia-f-sap-fico-project51477813 45498199-sonia-f-sap-fico-project
51477813 45498199-sonia-f-sap-fico-project
 
Rich Windows 8 apps
Rich Windows 8 appsRich Windows 8 apps
Rich Windows 8 apps
 
Android Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docxAndroid Lab Mannual 18SUITSP5.docx
Android Lab Mannual 18SUITSP5.docx
 
IRJET- Toll Plaza Payment using QR Code
IRJET- Toll Plaza Payment using QR CodeIRJET- Toll Plaza Payment using QR Code
IRJET- Toll Plaza Payment using QR Code
 

Más de DevDay.org

Más de DevDay.org (20)

[DevDay2019] Lean UX - By Bryant Castro, Bryant Castro at Wizeline
[DevDay2019] Lean UX - By  Bryant Castro,  Bryant Castro at Wizeline[DevDay2019] Lean UX - By  Bryant Castro,  Bryant Castro at Wizeline
[DevDay2019] Lean UX - By Bryant Castro, Bryant Castro at Wizeline
 
[DevDay2019] Why you'll lose without UX Design - By Szilard Toth, CTO at e·pi...
[DevDay2019] Why you'll lose without UX Design - By Szilard Toth, CTO at e·pi...[DevDay2019] Why you'll lose without UX Design - By Szilard Toth, CTO at e·pi...
[DevDay2019] Why you'll lose without UX Design - By Szilard Toth, CTO at e·pi...
 
[DevDay2019] Things i wish I knew when I was a 23-year-old Developer - By Chr...
[DevDay2019] Things i wish I knew when I was a 23-year-old Developer - By Chr...[DevDay2019] Things i wish I knew when I was a 23-year-old Developer - By Chr...
[DevDay2019] Things i wish I knew when I was a 23-year-old Developer - By Chr...
 
[DevDay2019] Designing design teams - Christopher Nguyen, UX Manager at Wizeline
[DevDay2019] Designing design teams - Christopher Nguyen, UX Manager at Wizeline[DevDay2019] Designing design teams - Christopher Nguyen, UX Manager at Wizeline
[DevDay2019] Designing design teams - Christopher Nguyen, UX Manager at Wizeline
 
[DevDay2019] Growth Hacking - How to double the benefits of your startup with...
[DevDay2019] Growth Hacking - How to double the benefits of your startup with...[DevDay2019] Growth Hacking - How to double the benefits of your startup with...
[DevDay2019] Growth Hacking - How to double the benefits of your startup with...
 
[DevDay2019] Collaborate or die: The designers’ guide to working with develop...
[DevDay2019] Collaborate or die: The designers’ guide to working with develop...[DevDay2019] Collaborate or die: The designers’ guide to working with develop...
[DevDay2019] Collaborate or die: The designers’ guide to working with develop...
 
[DevDay2019] How AI is changing the future of Software Testing? - By Vui Nguy...
[DevDay2019] How AI is changing the future of Software Testing? - By Vui Nguy...[DevDay2019] How AI is changing the future of Software Testing? - By Vui Nguy...
[DevDay2019] How AI is changing the future of Software Testing? - By Vui Nguy...
 
[DevDay2019] Hands-on Machine Learning on Google Cloud Platform - By Thanh Le...
[DevDay2019] Hands-on Machine Learning on Google Cloud Platform - By Thanh Le...[DevDay2019] Hands-on Machine Learning on Google Cloud Platform - By Thanh Le...
[DevDay2019] Hands-on Machine Learning on Google Cloud Platform - By Thanh Le...
 
[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...
[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...
[DevDay2019] Micro Frontends Architecture - By Thang Pham, Senior Software En...
 
[DevDay2019] Power of Test Automation and DevOps combination - One click savi...
[DevDay2019] Power of Test Automation and DevOps combination - One click savi...[DevDay2019] Power of Test Automation and DevOps combination - One click savi...
[DevDay2019] Power of Test Automation and DevOps combination - One click savi...
 
[DevDay2019] How do I test AI models? - By Minh Hoang, Senior QA Engineer at KMS
[DevDay2019] How do I test AI models? - By Minh Hoang, Senior QA Engineer at KMS[DevDay2019] How do I test AI models? - By Minh Hoang, Senior QA Engineer at KMS
[DevDay2019] How do I test AI models? - By Minh Hoang, Senior QA Engineer at KMS
 
[DevDay2019] How to quickly become a Senior Engineer - By Tran Anh Minh, CEO ...
[DevDay2019] How to quickly become a Senior Engineer - By Tran Anh Minh, CEO ...[DevDay2019] How to quickly become a Senior Engineer - By Tran Anh Minh, CEO ...
[DevDay2019] How to quickly become a Senior Engineer - By Tran Anh Minh, CEO ...
 
[Devday2019] Dev start-up - By Le Trung, Founder & CEO at Hifiveplus and Edu...
[Devday2019]  Dev start-up - By Le Trung, Founder & CEO at Hifiveplus and Edu...[Devday2019]  Dev start-up - By Le Trung, Founder & CEO at Hifiveplus and Edu...
[Devday2019] Dev start-up - By Le Trung, Founder & CEO at Hifiveplus and Edu...
 
[DevDay2019] Web Development In 2019 - A Practical Guide - By Hoang Nhu Vinh,...
[DevDay2019] Web Development In 2019 - A Practical Guide - By Hoang Nhu Vinh,...[DevDay2019] Web Development In 2019 - A Practical Guide - By Hoang Nhu Vinh,...
[DevDay2019] Web Development In 2019 - A Practical Guide - By Hoang Nhu Vinh,...
 
[DevDay2019] Opportunities and challenges for human resources during the digi...
[DevDay2019] Opportunities and challenges for human resources during the digi...[DevDay2019] Opportunities and challenges for human resources during the digi...
[DevDay2019] Opportunities and challenges for human resources during the digi...
 
[DevDay2019] Python Machine Learning with Jupyter Notebook - By Nguyen Huu Th...
[DevDay2019] Python Machine Learning with Jupyter Notebook - By Nguyen Huu Th...[DevDay2019] Python Machine Learning with Jupyter Notebook - By Nguyen Huu Th...
[DevDay2019] Python Machine Learning with Jupyter Notebook - By Nguyen Huu Th...
 
[DevDay2019] Do you dockerize? Are your containers safe? - By Pham Hong Khanh...
[DevDay2019] Do you dockerize? Are your containers safe? - By Pham Hong Khanh...[DevDay2019] Do you dockerize? Are your containers safe? - By Pham Hong Khanh...
[DevDay2019] Do you dockerize? Are your containers safe? - By Pham Hong Khanh...
 
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
[DevDay2019] Develop a web application with Kubernetes - By Nguyen Xuan Phong...
 
[DevDay2019] Paradigm shift towards effective Scrum - By Tam Doan, Agile Coac...
[DevDay2019] Paradigm shift towards effective Scrum - By Tam Doan, Agile Coac...[DevDay2019] Paradigm shift towards effective Scrum - By Tam Doan, Agile Coac...
[DevDay2019] Paradigm shift towards effective Scrum - By Tam Doan, Agile Coac...
 
[DevDay2019] JAM Stack - By Ngo Thi Ni, Web Developer at Agility IO
[DevDay2019] JAM Stack - By Ngo Thi Ni, Web Developer at Agility IO[DevDay2019] JAM Stack - By Ngo Thi Ni, Web Developer at Agility IO
[DevDay2019] JAM Stack - By Ngo Thi Ni, Web Developer at Agility IO
 

Último

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Último (20)

A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdfUnderstanding Discord NSFW Servers A Guide for Responsible Users.pdf
Understanding Discord NSFW Servers A Guide for Responsible Users.pdf
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 

[DevDay2018] Reactive Programming - By Thinh Ung, Technical Leader at Asian Tech

Notas del editor

  1. Trong thời đại công nghệ hiện nay, để đáp ứng được đòi hỏi cao của người dùng về các dịch vụ và ứng dụng, chúng ta phải luôn thay đổi và nâng cao chất lượng sản phẩm hướng tới trải nghiệm tốt nhất cho người dùng, đảm bảo tính liên tục và khả năng phản hồi cao đối với sự tương tác của người dùng. Để xây dựng được những hệ thống như vậy, hiện nay những công ty công nghệ đang áp dụng một phong cách lập trình mới và rất mạnh mẽ, giải quyết được nhiều vấn dề phức tạp, và đó là Reactive Programming
  2. Hiện nay các công ty công nghệ lớn trên thế giới đã apply reactive programming, ví dụ: Github sử dụng RP để viết ứng dụng Github for Mac OS Microsoft cho ra đời bộ công cụ RxExtension cho .NET, và ngôn ngữ F# Facebook thì cho ra đời ngôn ngữ lập trình Reflex Đặc biệt là Netflix, thành lập một nhóm phát triển các sản phẩm live stream, video, movie hoàn toàn dựa vào phong cách lập trình RP Vậy RP là gì mà tại sao các công ty công nghê lớn lại chú ý và áp dụng mạnh mẽ như vậy
  3. Là phong cách lập trình, là cách để phân loại các ngôn ngữ lập trình dựa vào các đặc tính của chúng Hiện nay có nhiều phong cách lập trình nhưng có thể chia thành 2 loại là imperative(mệnh lệnh) và declarative(khai báo), với imeprative chúng ta có 2 phong cách phổ biến nhất là procedure(thủ tục) và lập trình OO(hướng đối tượng), với Procedure chúng ta có các ngôn ngữ như Pascal và C, OO chúng ta có rất nhiều ngôn ngữ hỗ trợ như Java, C++ … Với Declarative chúng ta có 2 phong cách phổ biến nhất là functional và logical với các ngôn ngữ Haskell, Scalar và Prolog Trong bài present này mình sẽ dùng một vài đoạn code Swift để minh họa cho một số ví dụ
  4. Vậy imperative là gì? -> Là lập trình mệnh lệnh, dùng các tập lệnh để thay đổi trạng thái của chương trình Phong cách này tập trung vào câu hỏi “How” tức là nói cho máy làm gì đó bằng cách nào và kết quả mong đợi sẽ xảy ra là gì
  5. Thể hiện logic tính toán mà không mô tả control flow của nó Phong cách lập trình này tập trung vào câu hỏi “What”, tức là mô tả bạn muốn làm cái gì chứ không phải là phải làm nó như thế nào Và một đặc điểm quan trọng của nó là không phụ thuộc vào ngữ cảnh Bạn có thể hình dung là với Imperative Programming thì bạn quan tâm tới việc làm thế nào để giải quyết bài toán còn Declarative Programming quan tâm tới đầu vào và đầu ra của bài toán.
  6. Nó không phải mới được đề xướng trong những năm gần đây, mà nó đã có từ rất lâu rồi, từ những năm 50 –  thời sơ khai của máy tính hiện đại, đầu tiên với ngôn ngữ lập trình Lisp. Bao lâu nay nó vẫn tồn tại song song với Imperative mà chúng ta không hề hay biết.  Sự chậm chạp của máy tính thời đó không đủ điều kiện để Lisp phát triển và thế là Imperative lên ngôi, đặc biệt với sự ra đời của C. Đến thập niên 90, có thể coi là thời kỳ thịnh vượng của lập trình hướng đối tượng (OOP) với sự kết hợp mô hình Imperative Programming. Chúng ta trừu tượng hóa các vấn đề thành các đối tượng, đưa ra các phương thức mà đối tượng đó có rồi kết nối chúng lại để tạo ra một chuỗi các bước để đối tượng thực hiện giải quyết vấn đề (how). Hàng loạt các ngôn ngữ mới ra đời đi theo con đường multi-paradigm (OOP + Imperative): Java, C#, C++, Smalltalk, Python, Ruby, PHP…
  7. RP là lập trình với dòng dữ liệu bất đồng bộ và sự lan truyền của sự thay đổi Ở khái niệm trên, có hai điểm quan trọng chúng ta cần xem xét là Stream và Asynchronous Stream:  Khi thực hiện một tác vụ bất kỳ, chúng ta chỉ quan tâm tới 3 yếu tố: giá trị trả về từ tác vụ đó (data), lỗi (error – nếu có) và thời điểm tác vụ đó kết thúc (completed signed). Như vậy, ta thấy cần có một cơ chế giúp xác định các yếu tố này,RP giải quyết vấn đề này bằng cách sử dụng stream để truyền tải: dữ liệu trả về, lỗi và tín hiệu kết thúc của một tác vụ  theo trình tự thời gian từ nơi phát ra tín hiệu (Producer) tới nơi lắng nghe (Subscriber). Ví dụ như trong mô hình MVC, với bất kì sự thay đổi nào trong model(database) thì sẽ tự động reflect với View và ngược lại Asynchronous: mục tiêu chính của RP là cung cấp cho chúng ta một phương tiện hữu hiệu để tương tác giữa các tác vụ bất đồng bộ, giúp các bên trong phần mềm có thể giao tiếp mà không cần quan tâm các vấn đề như: concurrence, thread-safety, error handling, …
  8. Reactive Programming mang đến một phong cách lập trình mới khi làm việc với những app đòi hỏi tính tương tác cao. Ví dụ, mobile app hiện đại ngày nay đã phát triển vượt bậc: khi người dùng gõ vào khung search, hay kéo xuống để refresh, không có màn hình mới nào được chuyển đến cả, tất cả mọi UI event đều gọi đến data ở phía sau và phản ánh lại màn hình ngay lập tức.
  9. Mọi thứ trong RP đều có thể là stream, chẳng hạn như biến, đầu vào của người dùng(ví như khi touch vào một button, hay là gõ text vào search bar…) Một điểm đặc biệt khi tiếp cận với RP là overtime, tức là sự kiện được phát ra trong mỗi stream là bất đồng bộ và theo thời gian Hãy mườn tượng với sự kiện gõ text vào search bar, liệu hệ thống có đoán biết được khi nào chung ta sẽ gõ kí tự tiếp theo, chung ta mô hình hóa tác vụ đó bằng một stream, các sự kiện gõ ký tự đó được phát ra một cách bất đồng bộ và phụ thuộc vào thời gian, có thể phát ra sự kiện gõ ký tự trong 1 hoặc 2 giây, hoặc là 10s …
  10. Khi tiếp cận với RP, 2 khái niệm mà chúng ta sẽ bắt gặp đó là Observer và Observable Observable, đơn giản nó là nguồn phát sự kiện Observer là thực thể nhận sự kiện và xử lý các tác vụ khác khi nhận sự kiện Observer đăng ký lắng nghe Observable Nhiều Observer có thể đăng ký lắng nghe tới cùng một Observable Sự tương tác giữa 2 thực thể này cũng là nguyên lý cơ bản và quan trọng nhất trong RP 2 khái niệm này xuất phát từ mô hình lập trình Observer pattern
  11. Với lập trình truyền thống muốn cập nhất biến c chúng ta phải thực hiện lại phép toàn c = a + b, giả sử với trường hợp biến a được thay đổi ở rất nhiều nơi và nhiều lần thì chuyện gì xảy ra, thật là bất lợi Nhưng với RP thì việc đó được xử lý rất gọn gàng và tiện lợi
  12. Với lập trình truyền thống muốn cập nhất biến c chúng ta phải thực hiện lại phép toàn c = a + b, giả sử với trường hợp biến a được thay đổi ở rất nhiều nơi và nhiều lần thì chuyện gì xảy ra, thật là bất lợi Nhưng với RP thì việc đó được xử lý rất gọn gàng và tiện lợi
  13. Lợi ích đầu tiên là giúp cho việc lập trình bất đồng độ trở nên dễ dàng, nhanh chóng, lập trình viên không quan tâm tới thread safety, concurrency, …
  14. Lợi ích đầu tiên là giúp cho việc lập trình bất đồng độ trở nên dễ dàng, nhanh chóng, lập trình viên không quan tâm tới thread safety, concurrency, …
  15. Hiện nay RP xuất hiện trong hầu hết các ngôn ngữ, có một vài tổ chức và cá nhân đứng ra viết một số thư viện theo phong cách RP Những thư viện này tạo các bộ công cụ tiện ích, một tập các phép toán giúp cho lập trình viên thuận tiện cho việc xử lý các bài toán theo phong cách RP một cách dễ dàng
  16. Đến đây có thể nói rằng RP là một lựa chọn rất tốt cho các lập trình viên nhờ vào những ưu điểm của nó, cùng với sự hỗ trợ tốt từ các thư viện thì không có lý do gì chúng ta không adopt nó vào các dự án