Slide 1

Slide 1 text

Ifeora Okechukwu, Oparand @isocroft Abuja Application State Design for Complex Web Applications

Slide 2

Slide 2 text

Front End Developer, Internet Addict Currently working on Fashion / E-learning Technologies © 2018 Google inc.

Slide 3

Slide 3 text

Agenda 1. Introduction 2. What is State ? 3. Sources Of State 4. An Analogy of Resilience 5. State Generation Flow 6. Let’s Talk About the “History” 7. Transient (UI State) & Non-Transient (Data State) 8. State Machines/Graphs 9. Benefits of State Machines/Graphs 10.Impact of Poor State Design on Apps 11.Libraries that concur 12.Q/A

Slide 4

Slide 4 text

Yey! We Found Flux… UI development became cumbersome/difficult in the last couple of years. That is because we pushed the state management to the browser. And managing state is what makes our job a challenge. Redux/Atika/MobX/Vuex/Radixx makes things easy only if we do it properly, Then, we will see that our application scales easily with no bugs. In this talk, we will see how to use the state machine concepts and decoupling concepts for redesigning state and hence it’s management short-comings. And we still need to rethink state design ?

Slide 5

Slide 5 text

What is State ? In any given point in time, there is a different information stored in the memory of your web application that you can access via your variables, classes, data structures, etc. All the stored information, at a given instant in time, is called the application state. - Nikolay Stoitsev (Quora)

Slide 6

Slide 6 text

Sources Of State 1. Cookie 2. Session Data 3. Persistence Data 4. UI updates 5. HTTP Headers 6. Local Storage

Slide 7

Slide 7 text

An anology of resilience The Cassette Player We try to build web applications that are very strong and resilient to whatever the user throws at it. The goal is to eliminate bugs totally and handle exceptions well in a scalable way Location

Slide 8

Slide 8 text

Event Computation Transition Chart Data Source Info The State Generation Flow View Updates

Slide 9

Slide 9 text

Let’s Talk About “History”

Slide 10

Slide 10 text

•jQuery (Pre-historic) •Backbone/Ember (Medieval) •React/Vue/Angular (New Age) •Svelte (Future Proof)

Slide 11

Slide 11 text

“UI’s are graphs while the data that drives them are trees. UI’s need to have their behavior managed as state on it’s own” - David Khourshid @DavidKpiano

Slide 12

Slide 12 text

Transient UI State & Non-Transient Data State Abuja

Slide 13

Slide 13 text

No content

Slide 14

Slide 14 text

No content

Slide 15

Slide 15 text

{ isLoading: false, items: [ ] }

Slide 16

Slide 16 text

{ items: [ ] } – Redux/Vuex { isLoading: false } – Component

Slide 17

Slide 17 text

State Machines/ Graphs Abuja

Slide 18

Slide 18 text

No content

Slide 19

Slide 19 text

State Transition Graph The idea of using state graphs is beneficial to setting up the big picture of thw web app we are developing Events. Guards & Transitions

Slide 20

Slide 20 text

3 basic reasons for bugs 1. Missing State Transition (Omitted Logic) 2. Unhandled Action / Event (Dead Transition) 3. Wrong State Transition (No Guards)

Slide 21

Slide 21 text

No content

Slide 22

Slide 22 text

Benefits of State Machines/Graphs 1. They help to enforce declarative/state-driven rendering 2. They help you avoid RACE CONDTIONS 3. help to harmonize the flow of behavior instead of having them scattered everywhere

Slide 23

Slide 23 text

Impact of Poor Web Application State Design

Slide 24

Slide 24 text

1. Global Data State is Sometime Unorganized 2. UI Components are 100% reliant on the (Redux/MobX/Veux/Radixx) store hence not reusable 3. Edge Cases are rarely handled 4. Poor Speed Performance of the Web App 5. Unpredictable/Unaccounted State Changes

Slide 25

Slide 25 text

Libraries that concur Abuja 1. Atika - https://github.com/datorama/akita 2. Stent – https://github.com/davharvey/stent

Slide 26

Slide 26 text

Ifeora Okechukwu, Oparand @isocroft Abuja Thank you!

Slide 27

Slide 27 text

Q&A I’ll take your questions now... Abuja