Successfully reported this slideshow.
We use your LinkedIn profile and activity data to personalize ads and to show you more relevant ads. You can change your ad preferences anytime.
1
MVVM and
RxJava –
the perfect
mix
Florina Muntenescu
Droidcon Zagreb 2016
2
What and who upday is
3
When did we
decide to go
the RxJava &
MVVM way?
4
The old app
When did we decide to go the RxJava & MVVM way?
5
The old app
When did we decide to go the RxJava & MVVM way?
99 little bugs in the code.
99 little bugs in the code.
Take...
6
From the old to the new
When did we decide to go the RxJava & MVVM way?
7
Crash course
in RxJava
8
Sum it up!
Crash course in RxJava
A1 0
A2 2
C1 3
combineLatest( (A1,A2) => A1+A2)
0
0
1
1
9
What is MVVM
and how do
you apply it?
10
Model-View-Presenter
What is MVVM and how do you apply it?
ModelView Presenter
IView IPresenter
1 … 1
11
Model-View-ViewModel
What is MVVM and how do you apply it?
DataModelView ViewModel
1 … *
12
What is MVVM and how do you apply it?
13
Model-View-ViewModel
What is MVVM and how do you apply it?
DataModelView ViewModel
1 … *
14
Testing
What is MVVM and how do you apply it?
15
Model-View-ViewModel
What is MVVM and how do you apply it?
DataModel
1 … *
View ViewModel
1 … *
View ViewModel
1 … *
Vi...
16
What is MVVM and how do you apply it?
1 … *
Function
View
Function
ViewModel1 … *Spreadsheet
View
Spreadsheet
ViewModel...
17
What is MVVM and how do you apply it?
1 … 1
Function
View
implements
IFunctionView
Function
Presenter1 … 1Spreadsheet
V...
18
19
We made
mistakes but
we recovered!
20
We made mistakes but we recovered!
21
View
We made mistakes but we recovered!
22
ViewModel
We made mistakes but we recovered!
23
View
We made mistakes but we recovered!
24
We made mistakes but we recovered!
What about Views that don’t have have lifecycle
events?
25
We made mistakes but we recovered!
Views and subscriptions
26
We made mistakes but we recovered!
Views and subscriptions
27
28
RxJava – the
good and the
bad
29
RxJava – the good and the bad
RxJava vs Threads/AsyncTask/Event bus frameworks
30
Stream
composability FTW!
RxJava – the good and the bad
31
Split a string using a regular expression and append a
new line to each item in the resulting list
RxJava – the good an...
32
RxJava – the good and the bad
map(line -> line.trim() + NEW_LINE)
toList()
“RxJava“
…
“the“ “good“
“RxJavan “
…
“then“ ...
33
Split a string using a regular expression and append a
new line to each item in the resulting list
RxJava – the good an...
34
3535
Simple MVVM example: https://github.com/florina-muntenescu/DroidconMVVM
MVP vs MVVM example: https://github.com/flori...
Upcoming SlideShare
Loading in …5
×

MVVM and RxJava – the perfect mix

18,615 views

Published on

Slides for Droidcon Zagreb 2016 "MVVM and RxJava – the perfect mix" talk

Published in: Technology
  • To get professional research papers you must go for experts like ⇒ www.WritePaper.info ⇐
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Hi there! I just wanted to share a list of sites that helped me a lot during my studies: .................................................................................................................................... www.EssayWrite.best - Write an essay .................................................................................................................................... www.LitReview.xyz - Summary of books .................................................................................................................................... www.Coursework.best - Online coursework .................................................................................................................................... www.Dissertations.me - proquest dissertations .................................................................................................................................... www.ReMovie.club - Movies reviews .................................................................................................................................... www.WebSlides.vip - Best powerpoint presentations .................................................................................................................................... www.WritePaper.info - Write a research paper .................................................................................................................................... www.EddyHelp.com - Homework help online .................................................................................................................................... www.MyResumeHelp.net - Professional resume writing service .................................................................................................................................. www.HelpWriting.net - Help with writing any papers ......................................................................................................................................... Save so as not to lose
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Sex in your area is here: ❶❶❶ http://bit.ly/2Q98JRS ❶❶❶
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • Follow the link, new dating source: ♥♥♥ http://bit.ly/2Q98JRS ♥♥♥
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here
  • I was always one of those students who were top of the class for maths during my KS3 years. However, we didn't have maths lessons for around 6 months in year 10, so I fell behind rapidly, and I was getting below average for my GCSE mocks. This package has really boosted my knowledge in a matter of only two weeks! I am vastly improving in maths and I am confident, given that I follow Jeevan's principles, I will achieve an A* in GCSE maths... In the end I achieved an 'A' grade in GCSE maths (summer 2014). I was a little disappointed in myself. However, considering the circumstances, I think I did pretty well. I am now taking A-Level maths at a grammar school and wanted to thank you for helping me along the way. You have inspired me to do well in this subject and I'm sure my 'A' grade will definitely help me to study Veterinary Medicine at a top University. Once again, thank you so much! ★★★ http://ishbv.com/jeevan91/pdf
       Reply 
    Are you sure you want to  Yes  No
    Your message goes here

MVVM and RxJava – the perfect mix

  1. 1. 1 MVVM and RxJava – the perfect mix Florina Muntenescu Droidcon Zagreb 2016
  2. 2. 2 What and who upday is
  3. 3. 3 When did we decide to go the RxJava & MVVM way?
  4. 4. 4 The old app When did we decide to go the RxJava & MVVM way?
  5. 5. 5 The old app When did we decide to go the RxJava & MVVM way? 99 little bugs in the code. 99 little bugs in the code. Take one down, patch it around. 127 little bugs in the code…
  6. 6. 6 From the old to the new When did we decide to go the RxJava & MVVM way?
  7. 7. 7 Crash course in RxJava
  8. 8. 8 Sum it up! Crash course in RxJava A1 0 A2 2 C1 3 combineLatest( (A1,A2) => A1+A2) 0 0 1 1
  9. 9. 9 What is MVVM and how do you apply it?
  10. 10. 10 Model-View-Presenter What is MVVM and how do you apply it? ModelView Presenter IView IPresenter 1 … 1
  11. 11. 11 Model-View-ViewModel What is MVVM and how do you apply it? DataModelView ViewModel 1 … *
  12. 12. 12 What is MVVM and how do you apply it?
  13. 13. 13 Model-View-ViewModel What is MVVM and how do you apply it? DataModelView ViewModel 1 … *
  14. 14. 14 Testing What is MVVM and how do you apply it?
  15. 15. 15 Model-View-ViewModel What is MVVM and how do you apply it? DataModel 1 … * View ViewModel 1 … * View ViewModel 1 … * View ViewModel 1 … * View ViewModel
  16. 16. 16 What is MVVM and how do you apply it? 1 … * Function View Function ViewModel1 … *Spreadsheet View Spreadsheet ViewModelObservable<String> getFunctionText()
  17. 17. 17 What is MVVM and how do you apply it? 1 … 1 Function View implements IFunctionView Function Presenter1 … 1Spreadsheet View Spreadsheet Presenter implements IFunctionView void textUpdated(String)
  18. 18. 18
  19. 19. 19 We made mistakes but we recovered!
  20. 20. 20 We made mistakes but we recovered!
  21. 21. 21 View We made mistakes but we recovered!
  22. 22. 22 ViewModel We made mistakes but we recovered!
  23. 23. 23 View We made mistakes but we recovered!
  24. 24. 24 We made mistakes but we recovered! What about Views that don’t have have lifecycle events?
  25. 25. 25 We made mistakes but we recovered! Views and subscriptions
  26. 26. 26 We made mistakes but we recovered! Views and subscriptions
  27. 27. 27
  28. 28. 28 RxJava – the good and the bad
  29. 29. 29 RxJava – the good and the bad RxJava vs Threads/AsyncTask/Event bus frameworks
  30. 30. 30 Stream composability FTW! RxJava – the good and the bad
  31. 31. 31 Split a string using a regular expression and append a new line to each item in the resulting list RxJava – the good and the bad “RxJava – the good and the bad” [“RxJavan”, “then”, “goodn”, ”andn”, “then”, ”badn”]
  32. 32. 32 RxJava – the good and the bad map(line -> line.trim() + NEW_LINE) toList() “RxJava“ … “the“ “good“ “RxJavan “ … “then“ “goodn“ ["RxJavan“, “then“, “goodn“ ...]
  33. 33. 33 Split a string using a regular expression and append a new line to each item in the resulting list RxJava – the good and the bad
  34. 34. 34
  35. 35. 3535 Simple MVVM example: https://github.com/florina-muntenescu/DroidconMVVM MVP vs MVVM example: https://github.com/florina-muntenescu/MVPvsMVVM Exclusive to Samsung

×