Reactive declarative
UI as code
mobile trend and healthy competition
TruongSinh Tran-Nguyen, Inspectorio
@truongsinhtn
Before we begin
Before we begin
Before we begin
● Flutter
○ alpha May 2017
○ 1.0 Dec 2018
● Jetpack Compose
○ technical preview May 2019
● SwiftUI
○ beta Jun 2019
Before we begin
Before we begin
This slide is available online,
don’t need to take pictures of
my cool slides 😆
http://bit.ly/2GbL39T
Before we begin
About Speaker
● “Sinh”
● 10y+ working w/ European and VN
startups
● People's Choice CTO of the Year
2016 – Nordic Startup Award
Finland
About Speaker
● Engineering Director,
● Flutter advocate
● @truongsinhtn
About
● Startup, 13 quarters-old
● Quality and compliance platform, powered by AI
● B2B, serving Fortune 100 factories, brands, retailers
● Always looking for new talents 😉
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
About
Source: Lorem ipsum dolor sit amet, consectetur adipiscing elit. Duis non erat sem
About
Agenda
● Concept reviews: reactive, declarative, as code
● Why trendy
● How this trend is a healthy competition
Concepts review
Concepts review
Declarative
● Declarative vs Imperative
● Declarative can be NON-reactive
● Declarative can be NON-as-code
Declarative
● Declarative vs Imperative
● Declarative but NOT reactive
● Declarative but NOT as code
Imperative vs Declarative
Imperative: tell compiler
what you want to happen,
step by step
Declarative: describes what
you want, but not
necessarily how to get it
Imperative vs Declarative
Imperative:
● Open the rice cooker
● Put rice and water concurrently
● Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Imperative vs Declarative
Imperative:
● Open the rice cooker
● Put rice and water concurrently
● Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Imperative vs Declarative
Imperative:
● java.util.concurrent.ExecutionException:
● java.util.concurrent.RejectedExecutionException
● java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233)
● java.util.concurrent.FutureTask.get(FutureTask.java:94)
Imperative vs Declarative
Imperative:
➢ Open the rice cooker
● Put rice and water concurrently
● Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Imperative vs Declarative
Imperative:
● Open the rice cooker
➢ Put rice and water concurrently
● Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Imperative vs Declarative
Imperative:
● Open the rice cooker
● Put rice and water concurrently
➢ Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Imperative vs Declarative
Imperative:
● Open the rice cooker
● Put rice and water concurrently
➢ Press “cook” button
● Return a future when the “cook” button turns to “warm”
● Put water, veggie and tofu into the pot concurrently
● Return a future when the pot is boiling
● Waiting for both futures to be resolved
● Present both on the tables
Cooker:
● connectedToPower: false
Imperative vs Declarative
Declarative:
● A table with
○ Meal with
■ Cooked rice
■ Soup with veggie and tofu
XML is declarative but not reactive nor as code
<LinearLayout
xmlns:android="http://schemas.android.com/apk/res/android"
android:orientation="vertical"
android:layout_width="match_parent"
android:layout_height="match_parent">
<Button
android:id="@+id/addBtn"
android:layout_width="wrap_content"
android:layout_height="wrap_content"
android:text="Add" />
</LinearLayout>
Reactive
Reactive
Reactive
● Spreadsheet is reactive
● Not reactive: 2-way binding
○ MVC, MVP, MVVM
Reactive
● Spreadsheet is reactive
● Not reactive: 2-way binding
○ MVC, MVP, MVVM
● Unidirectional data flow is reactive
○ on Android: MVI
● Reactive Extension family (Rx): RxJava, RxDart, RxSwift
Reactive stream with imperative UI
const konamiCode = const <keyCode>[
⬆️,⬆️,⬇️,⬇️,⬅️,➡️,⬅️,➡️,🅰 ,🅱
];
final keyUp = Observable<KeyboardEvent>(document.onKeyUp);
keyUp
.map((event) => event.keyCode)
.bufferCount(10, 1)
.where((last10KeyCodes) => last10KeyCodes == konamiCode))
.listen((_) async {
// Create a <marquee> element
final marquee = document.createElement("marquee");
// Insert text
marquee.innerHTML = "KONAMI";
// Append <button> to <body>
body.appendChild(btn);
// sleep for 5 seconds
await Future.delayed(Duration(seconds: 2));
// remove marquee
body.removeChild(marquee);
});
Reactive stream with imperative UI
const konamiCode = const <keyCode>[
⬆️,⬆️,⬇️,⬇️,⬅️,➡️,⬅️,➡️,🅰 ,🅱
];
final keyUp = Observable<KeyboardEvent>(document.onKeyUp);
keyUp
.map((event) => event.keyCode)
.bufferCount(10, 1)
.where((last10KeyCodes) => last10KeyCodes == konamiCode))
.listen((_) async {
// UI manipulation here
});
Reactive stream with imperative UI
.listen((_) async {
// Create a <marquee> element
final marquee = document.createElement("marquee");
// Insert text
marquee.innerHTML = "KONAMI";
// Append <button> to <body>
body.appendChild(btn);
// sleep for 5 seconds
await Future.delayed(Duration(seconds: 2));
// remove marquee
body.removeChild(marquee);
});
As Code
● UI as code is “Programmatic UI
on steroid”
● access to the full features of a
single language
3 languages in a snippet
<h1
style="color:blue; margin-left:30px;"
onclick="alert(' ♀')"
>
This is a heading
</h1>
As Code
● React/React Native: DSL (JSX)
● Jetpack Compose: DSL (@annotation)
● SwiftUI: DSL (@annotation)
● Flutter: vanilla Dart
Why trendy?
Reactive declarative UI as code
Achieving the same result with less code
● Less code to test, have bug, maintain, extend
● Optimization is (mostly) done by abstraction layer
● Faster development cycle
● Cleaner, more testable code if done right
Less code?
● A lot of abstract layers so common we don’t care
1st generation programming language
Literally binary, 0000 0110 0010 1010
2nd generation programming language
● Assembly language
● 1-1 mapping mnemonic instruction to binary
● CPU- and OS-dependent
load_a 42 // 0000 0110 0010 1010
Later generations
● CPU-independent
● Blurred distinction between 3rd-, 4th- and 5th- gen
● Concrete/Procedural ←→ Abstract/Expressive
● malloc vs GC
● Threading vs Coroutine
Really? Prove it!
● Jetpack compose is still in technical preview
● Flutter vs Android is not fair
● Let’s see SwiftUI vs UIKit
● https://www.youtube.com/watch?v=qk2y-TiLDZo by Paul
Hudson
UIKit vs SwiftUI
UIKit vs SwiftUI
UIKit
Time: 16:46
LOCs: 98
SwiftU
Time: 9:25
LOCs: 52
Optimization?
● Declarative: describes what you want, but not
necessarily how to get it
● Each update the to the framework / toolkit may result in
better performance with mostly no code change
○ E.g: React 17 “time slicing”
Faster development cycle?
● As a result of less code / higher abstraction
● Preview / Hot reload, especially for animation
● Debugger point vs Inspector
Tools
Cleaner, more testable code if done right?
● MVC, MVP, MVVM, MVI, etc. patterns emerge for cleaner
code
● MV* are (mostly) bidirectional
○ MVI is unidirectional
Cleaner, more testable code if done right?
● Functional reactive is unidirectional
○ Half things to test, less “data
traffic jam”
○ Easier to separate (business
logic) “domain” from platform
Cleaner, more testable code if done right?
● What can go wrong?
○ Too many internal states
○ Too many logic entangled in the UI code
Cleaner, more testable code if done right?
● What can go wrong?
○ Too many internal states
○ Too many logic entangled in the UI code
So yes, it’s trendy!
● Less code to test, have bug, maintain, extend
● Optimization is (mostly) done by abstraction layers
● Faster development cycle
● Cleaner, more testable code if done right
So yes, it’s trendy!
● Less code to test, have bug, maintain, extend
● Optimization is (mostly) done by abstraction layers
● Faster development cycle
● Cleaner, more testable code if done right
Healthy competition
Healthy competition
In conclusion
Moral of the Story
● Reactive declarative UI as code has already been the
trend, deservedly so
● Learn it, Embrace it, Utilize it
Moral of the Story
● Flutter is in the sweet pot in this trend for mobile
○ ReactNative suffers performance problem
○ SwiftUI is in beta, requires iOS13+
○ Jetpack compose is in technical preview
○ Flutter uses vanilla language
● Ask the right question, “Should I use Flutter with MVP or
MVVM” is the wrong one
Moral of the Story
● Flutter is in the sweet pot in this trend for mobile
○ ReactNative suffers performance problem
○ SwiftUI requires iOS13+
○ Jetpack compose is in technical preview
● Ask the right question, “Should I use Flutter with MVP or
MVVM” is the wrong one
Thank You
Oh, one more thing
We can still do imperative programming in Flutter.
Remember the legendary Flappy game?
Try it yourself
https://github.com
/truongsinh
/fluttery_dash
/releases/tag/v0.0.1
Questions?

Reactive declarative UI as code - DroidCon Vietnam 2019

  • 1.
    Reactive declarative UI ascode mobile trend and healthy competition TruongSinh Tran-Nguyen, Inspectorio @truongsinhtn
  • 2.
  • 3.
  • 4.
    Before we begin ●Flutter ○ alpha May 2017 ○ 1.0 Dec 2018 ● Jetpack Compose ○ technical preview May 2019 ● SwiftUI ○ beta Jun 2019
  • 5.
  • 6.
    Before we begin Thisslide is available online, don’t need to take pictures of my cool slides 😆 http://bit.ly/2GbL39T
  • 7.
  • 8.
    About Speaker ● “Sinh” ●10y+ working w/ European and VN startups ● People's Choice CTO of the Year 2016 – Nordic Startup Award Finland
  • 9.
    About Speaker ● EngineeringDirector, ● Flutter advocate ● @truongsinhtn
  • 10.
    About ● Startup, 13quarters-old ● Quality and compliance platform, powered by AI ● B2B, serving Fortune 100 factories, brands, retailers ● Always looking for new talents 😉
  • 11.
    Source: Lorem ipsumdolor sit amet, consectetur adipiscing elit. Duis non erat sem About
  • 12.
    Source: Lorem ipsumdolor sit amet, consectetur adipiscing elit. Duis non erat sem About
  • 13.
    Agenda ● Concept reviews:reactive, declarative, as code ● Why trendy ● How this trend is a healthy competition
  • 14.
  • 15.
  • 16.
    Declarative ● Declarative vsImperative ● Declarative can be NON-reactive ● Declarative can be NON-as-code
  • 17.
    Declarative ● Declarative vsImperative ● Declarative but NOT reactive ● Declarative but NOT as code
  • 18.
    Imperative vs Declarative Imperative:tell compiler what you want to happen, step by step Declarative: describes what you want, but not necessarily how to get it
  • 19.
    Imperative vs Declarative Imperative: ●Open the rice cooker ● Put rice and water concurrently ● Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables
  • 20.
    Imperative vs Declarative Imperative: ●Open the rice cooker ● Put rice and water concurrently ● Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables
  • 21.
    Imperative vs Declarative Imperative: ●java.util.concurrent.ExecutionException: ● java.util.concurrent.RejectedExecutionException ● java.util.concurrent.FutureTask$Sync.innerGet(FutureTask.java:233) ● java.util.concurrent.FutureTask.get(FutureTask.java:94)
  • 22.
    Imperative vs Declarative Imperative: ➢Open the rice cooker ● Put rice and water concurrently ● Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables
  • 23.
    Imperative vs Declarative Imperative: ●Open the rice cooker ➢ Put rice and water concurrently ● Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables
  • 24.
    Imperative vs Declarative Imperative: ●Open the rice cooker ● Put rice and water concurrently ➢ Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables
  • 25.
    Imperative vs Declarative Imperative: ●Open the rice cooker ● Put rice and water concurrently ➢ Press “cook” button ● Return a future when the “cook” button turns to “warm” ● Put water, veggie and tofu into the pot concurrently ● Return a future when the pot is boiling ● Waiting for both futures to be resolved ● Present both on the tables Cooker: ● connectedToPower: false
  • 26.
    Imperative vs Declarative Declarative: ●A table with ○ Meal with ■ Cooked rice ■ Soup with veggie and tofu
  • 27.
    XML is declarativebut not reactive nor as code <LinearLayout xmlns:android="http://schemas.android.com/apk/res/android" android:orientation="vertical" android:layout_width="match_parent" android:layout_height="match_parent"> <Button android:id="@+id/addBtn" android:layout_width="wrap_content" android:layout_height="wrap_content" android:text="Add" /> </LinearLayout>
  • 28.
  • 29.
  • 30.
    Reactive ● Spreadsheet isreactive ● Not reactive: 2-way binding ○ MVC, MVP, MVVM
  • 31.
    Reactive ● Spreadsheet isreactive ● Not reactive: 2-way binding ○ MVC, MVP, MVVM ● Unidirectional data flow is reactive ○ on Android: MVI ● Reactive Extension family (Rx): RxJava, RxDart, RxSwift
  • 32.
    Reactive stream withimperative UI const konamiCode = const <keyCode>[ ⬆️,⬆️,⬇️,⬇️,⬅️,➡️,⬅️,➡️,🅰 ,🅱 ]; final keyUp = Observable<KeyboardEvent>(document.onKeyUp); keyUp .map((event) => event.keyCode) .bufferCount(10, 1) .where((last10KeyCodes) => last10KeyCodes == konamiCode)) .listen((_) async { // Create a <marquee> element final marquee = document.createElement("marquee"); // Insert text marquee.innerHTML = "KONAMI"; // Append <button> to <body> body.appendChild(btn); // sleep for 5 seconds await Future.delayed(Duration(seconds: 2)); // remove marquee body.removeChild(marquee); });
  • 33.
    Reactive stream withimperative UI const konamiCode = const <keyCode>[ ⬆️,⬆️,⬇️,⬇️,⬅️,➡️,⬅️,➡️,🅰 ,🅱 ]; final keyUp = Observable<KeyboardEvent>(document.onKeyUp); keyUp .map((event) => event.keyCode) .bufferCount(10, 1) .where((last10KeyCodes) => last10KeyCodes == konamiCode)) .listen((_) async { // UI manipulation here });
  • 34.
    Reactive stream withimperative UI .listen((_) async { // Create a <marquee> element final marquee = document.createElement("marquee"); // Insert text marquee.innerHTML = "KONAMI"; // Append <button> to <body> body.appendChild(btn); // sleep for 5 seconds await Future.delayed(Duration(seconds: 2)); // remove marquee body.removeChild(marquee); });
  • 35.
    As Code ● UIas code is “Programmatic UI on steroid” ● access to the full features of a single language
  • 36.
    3 languages ina snippet <h1 style="color:blue; margin-left:30px;" onclick="alert(' ♀')" > This is a heading </h1>
  • 37.
    As Code ● React/ReactNative: DSL (JSX) ● Jetpack Compose: DSL (@annotation) ● SwiftUI: DSL (@annotation) ● Flutter: vanilla Dart
  • 38.
  • 39.
    Achieving the sameresult with less code ● Less code to test, have bug, maintain, extend ● Optimization is (mostly) done by abstraction layer ● Faster development cycle ● Cleaner, more testable code if done right
  • 40.
    Less code? ● Alot of abstract layers so common we don’t care
  • 41.
    1st generation programminglanguage Literally binary, 0000 0110 0010 1010
  • 42.
    2nd generation programminglanguage ● Assembly language ● 1-1 mapping mnemonic instruction to binary ● CPU- and OS-dependent load_a 42 // 0000 0110 0010 1010
  • 43.
    Later generations ● CPU-independent ●Blurred distinction between 3rd-, 4th- and 5th- gen ● Concrete/Procedural ←→ Abstract/Expressive ● malloc vs GC ● Threading vs Coroutine
  • 44.
    Really? Prove it! ●Jetpack compose is still in technical preview ● Flutter vs Android is not fair ● Let’s see SwiftUI vs UIKit ● https://www.youtube.com/watch?v=qk2y-TiLDZo by Paul Hudson
  • 45.
  • 46.
    UIKit vs SwiftUI UIKit Time:16:46 LOCs: 98 SwiftU Time: 9:25 LOCs: 52
  • 47.
    Optimization? ● Declarative: describeswhat you want, but not necessarily how to get it ● Each update the to the framework / toolkit may result in better performance with mostly no code change ○ E.g: React 17 “time slicing”
  • 48.
    Faster development cycle? ●As a result of less code / higher abstraction ● Preview / Hot reload, especially for animation ● Debugger point vs Inspector
  • 49.
  • 50.
    Cleaner, more testablecode if done right? ● MVC, MVP, MVVM, MVI, etc. patterns emerge for cleaner code ● MV* are (mostly) bidirectional ○ MVI is unidirectional
  • 51.
    Cleaner, more testablecode if done right? ● Functional reactive is unidirectional ○ Half things to test, less “data traffic jam” ○ Easier to separate (business logic) “domain” from platform
  • 52.
    Cleaner, more testablecode if done right? ● What can go wrong? ○ Too many internal states ○ Too many logic entangled in the UI code
  • 53.
    Cleaner, more testablecode if done right? ● What can go wrong? ○ Too many internal states ○ Too many logic entangled in the UI code
  • 54.
    So yes, it’strendy! ● Less code to test, have bug, maintain, extend ● Optimization is (mostly) done by abstraction layers ● Faster development cycle ● Cleaner, more testable code if done right
  • 55.
    So yes, it’strendy! ● Less code to test, have bug, maintain, extend ● Optimization is (mostly) done by abstraction layers ● Faster development cycle ● Cleaner, more testable code if done right
  • 56.
  • 57.
  • 62.
  • 63.
    Moral of theStory ● Reactive declarative UI as code has already been the trend, deservedly so ● Learn it, Embrace it, Utilize it
  • 64.
    Moral of theStory ● Flutter is in the sweet pot in this trend for mobile ○ ReactNative suffers performance problem ○ SwiftUI is in beta, requires iOS13+ ○ Jetpack compose is in technical preview ○ Flutter uses vanilla language ● Ask the right question, “Should I use Flutter with MVP or MVVM” is the wrong one
  • 65.
    Moral of theStory ● Flutter is in the sweet pot in this trend for mobile ○ ReactNative suffers performance problem ○ SwiftUI requires iOS13+ ○ Jetpack compose is in technical preview ● Ask the right question, “Should I use Flutter with MVP or MVVM” is the wrong one
  • 66.
  • 67.
    Oh, one morething We can still do imperative programming in Flutter. Remember the legendary Flappy game?
  • 68.
  • 69.

Editor's Notes

  • #2 https://medium.com/dartlang/making-dart-a-better-language-for-ui-f1ccaf9f546c https://www.quora.com/Why-should-I-learn-a-functional-programming-specific-language-e-g-Haskell-when-I-already-know-a-language-that-has-support-for-functional-programming → reactive know how to optimize https://www.quora.com/Why-dont-the-programming-languages-support-GUI-itself https://www.quora.com/How-are-GUIs-made-1 http://cvberry.com/tech_writings/essays/declarative_vs_programmatic_ui.html https://www.informatik.uni-kiel.de/~mh/papers/WLP08.pdf https://www.google.com/amp/s/hub.packtpub.com/declarative-ui-programming-faceoff-apples-swiftui-vs-googles-flutter/amp/ https://faculty.washington.edu/ajko/books/uist/declarative.html https://youtu.be/ANtSWq-zI0s?t=1443 https://youtu.be/Dk8cR1Kxj0Y?t=161 https://android.jlelse.eu/how-to-wrap-your-imperative-brain-around-functional-reactive-programming-in-rxjava-91ac89a4eccf https://codepen.io/HunorMarton/post/imperative-vs-reactive https://www.youtube.com/watch?v=qk2y-TiLDZo https://www.youtube.com/watch?v=DYEbUF4xs1Q https://www.youtube.com/watch?v=OD_yHH_R7qo https://androidcafein.slack.com/archives/DL6MPLMNY/p1562569638008700 https://github.com/dart-lang/sdk/blob/master/CHANGELOG.md#230---2019-05-08 https://medium.com/flutter-nyc/what-swiftui-means-for-flutter-6d5898f7adf7 https://techcrunch.com/2019/05/07/google-launches-jetpack-compose-an-open-source-kotlin-based-ui-development-toolkit/ https://www.c-sharpcorner.com/article/create-user-interface-programmatically-in-android-application/
  • #5 If you are baffled by the title, it’s about Flutter, Jetpack and SwiftUI. Flutter...
  • #6 Also, this talk is sandwiched by other 2 sessions, all of which are from Googlers, so I really appriciate your interest in this topic
  • #9 10 years technical leaders in several startups in Finland has been working on backend, web frontend and mobile For mobile, he has experience with native iOS/Android, NativeScript, ReacNative, Xamarin and RoboVM.
  • #10 10 years technical leaders in several startups in Finland has been working on backend, web frontend and mobile For mobile, he has experience with native iOS/Android, NativeScript, ReacNative, Xamarin and RoboVM.
  • #12 Offices all around the world
  • #13 Offices all around the world
  • #14 How this trend is a healthy competition within mobile dev, considering I’m a Flutter advocate
  • #16 Reactive, declarative, as Code
  • #19 Let me give an example, every Monday, Wednesday and Friday, my spouse she told me to follow these instructions
  • #20 These instructions went well, until one day the Future got rejected
  • #22 Here’s the stack trace
  • #23 So we put the breakpoint to debug these procedure
  • #26 Cooker object has internal state that affect the procedure
  • #27 This would have been the way to describe
  • #28 You might have been using declarative without knowing it :D But so far we have to choose either declarative with XML layout, but not reactive nor as code, nor programmatic UI with imperative approach
  • #29 Ok, what’s the best example of a “reactive system, anyone”?
  • #30 It’s a spreadshdeet Three cells, A, B, and C. C is defined as the sum of A and B. Whenever A or B changes, C reacts to update itself. That's reactive programming: changes propagate throughout a system automatically
  • #31 We have the declarative but not reactive view in Android, usually an XML, we have to do the binding, if the value of this text field change, then change the model value, and vice versa, bidirectional manner.
  • #36 gives you access to the full features of the language. All the tools gives you for abstraction, code reuse, and maintainability now apply to your UI layout too.
  • #37 Counter example
  • #38 UI as code it’s more than programmatic UI, because UI is a little bit different than logic. Thus, we either need support from language, or some DSL and transpilers or compilers
  • #39 ** check time, should be 14:10
  • #40 I don’t know about you, but i’m lazy and greedy if I am paid the same but work less, I like it. If I am paid but sb else does the job I love it! If I have to go to walk for hours, but some one give me a lift, i’ll take it If something makes me smarter, i’ll use it
  • #42 Lowest is machine code, directly executed by CPU, but it’s built for machine, not human, you have to memorize the number for every instruction, or have to look up yourself and convert to binary. Let’s say I’m building a “Hello world” app in Android in debug mode 10MB, that is more than 10 million bytes, and assuming that I can code 1 bytes per 10 seconds, i would take me more than 3 years no sleep no eat 24/7 working on that “hello word app”, and then the release mode 2 MB, another 8 months.
  • #43 Up 1 abstraction layer, Assembly language, it provides some syntactic sugar so you don’t have to memorize or look up instruction basically it’s find and replace but CPU- and OS-dependent. This august, Play store requires both 32-bit and 64-bit version of the app, if I were to code my hello word app in assembly, I would have to do this twice.
  • #44 The higher the abstraction, the less we have to thing about the technical, and more about the business logic
  • #45 Let's have some proof
  • #47 1: extra work not needed: preview optimization 2: already saved by storyboard
  • #50 When I was a inexperienced developer being put in charged of a startup tech team, I did not pay enough attention to toolings of tech ecosystem, and it was a bloody and costly lesson. When I was young, I’m so drawn into the fancy hello world. debugger, inspector, profiling, stack tracing, FPS performance overlay, testing framework
  • #51 Source: https://vaibhavgupta.me/2018/01/07/bidirectional-vs-unidirectional-data-flow-architecture/
  • #57 And this trend creates a healthy competition
  • #58 Once upon a time, any developer want to use this cool declarative reactive UI as code had to use React Native, even though they might not need cross platform, even if they have to suffer significant shortcomings of performance and the ecosystem / plugins. We did not have a choice, we, the developer did not have the bargaining power to say “please improve or I’ll use something else”, we had to choose between developer experience and performance. Do we want hot reload, declarative reactive UI as code, or do we want fast smooth production app?
  • #59 It’s different now! We get the fabulous developer experience, and no matter which mobile and wearable device we target, developers has more than solutions (but not too many) to choose. Too many is not good either, ask Web developers around 4 years ago.
  • #60 As Mr.Bean said, where there’s competition, there’s market
  • #61 And also, don’t f* believe...
  • #62 Anyway, with the emerging competition in this reactive declarative UI as code area, it proves that there’s a real mark, real use case. It will also force the competitors to continuously innovate and improve, otherwise they will be abandoned by us, the developers. Also, the cost of switching the tools is smaller, because they follow more or less the same pattern, e.g. if switching from Flutter to Jetpack compose would be much easier then switching from Flutter to traditional MVP or MVVM with XML Android
  • #65 For those who are using, trying, or considering Flutter, good news, Flutter is in the sweet spot. When trying for Flutter, ask the right question
  • #66 Missing XML layout is not a bug, it’s a feature