hannah howard #aboutme › system › files › presentation-slides › presentation.pdf1. lresult...

81
@techgirlwonder she/her hannah@carbon ve.com Personal Anecdote: I have a dog HANNAH HOWARD #ABOUTME

Upload: others

Post on 07-Jul-2020

1 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

@techgirlwonder she/her

[email protected]

PersonalAnecdote: I have

a dog

HANNAH HOWARD #ABOUTME

Page 2: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

REACTIVEPROGRAMMING:A Better Way to Write Frontend Applications

Page 3: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1. PROBLEM STATEMENT

Page 4: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

WHAT IS ACOMPUTERPROGRAM?

Page 5: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

A computer program is asequence of instructions

for performing a taskdesigned to solve

specic problems.- Wikipedia

Page 6: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Program = Todo List?

'SEQUENCE OF INSTRUCTIONS'

Page 7: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

LESSON PLAN

Page 8: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

HOW COMPUTER PROGRAMS ACTUALLY RUN

Page 9: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

the heart of frontend programming

INTERRUPTIONS:

Page 10: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

2. A BRIEF HISTORY OF INTERRUPTIONS

Page 11: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Technique 1:

GLOBAL EVENT BUS

Page 12: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

In The Beginning... C!

1. #define BYTE unsigned char 2. #define NUM_SCAN_QUE 256 // this MUST be 256, using BYTE roll­over for \ 3. // q code 4. BYTE gb_scan; 5. BYTE gb_scan_q[NUM_SCAN_QUE]; 6. BYTE gb_scan_head; 7. BYTE gb_scan_tail; 8. 9. static void interrupt(far *oldkb)(void); /* BIOS keyboard handler */ 10. 11. /* ­­­­­­­­­­­­­­­­­­­­­­ get_scan() ­­­­­­­­­­­­­­­­­­­­­ April 17,1993 */ 12. void interrupt get_scan(void) 13. 14. /* read the scan code from the keyboard */

Page 13: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Windows event loop

1. int WINAPI WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance, LPSTR lpCmdLine, int nCmdShow) 2. 3. MSG msg; 4. BOOL bRet; 5. 6. while (1) 7. 8. bRet = GetMessage(&msg, NULL, 0, 0); 9. 10. if (bRet > 0) // (bRet > 0 indicates a message that must be processed.) 11. 12. TranslateMessage(&msg); 13. DispatchMessage(&msg);

Page 14: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second message parameter 2. 3. switch (uMsg) 4. 5. case WM_CREATE: 6. // Initialize the window. 7. return 0; 8. 9. case WM_PAINT: 10. // Paint the window's client area. 11. return 0; 12. 13. case WM_SIZE: 14. // Set the size and position of the window. 15. return 0; 16. 17. case WM_DESTROY: 18. // Clean up window­specific data objects. 19. return 0; 20. //

Window procedure = read message, update state

Page 15: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1999?

Page 16: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second message parameter 2. 3. switch (uMsg) 4. 5. case WM_CREATE: 6. // Initialize the window. 7. return 0; 8. 9. case WM_PAINT: 10. // Paint the window's client area. 11. return 0; 12. 13. case WM_SIZE: 14. // Set the size and position of the window. 15. return 0; 16. 17. case WM_DESTROY: 18. // Clean up window­specific data objects. 19. return 0; 20. // 21. // Process other messages. 22. //23. default:

Or did we?

Page 17: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1. function todoApp(state = initialState, action) 2. switch (action.type) 3. case SET_VISIBILITY_FILTER: 4. return ...state, 5. visibilityFilter: action.filter 6. ; 7. case ADD_TODO: 8. return ...state, 9. todos: [

Page 18: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

NO SHADE TO REDUX

Page 19: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Technique 2:

OBSERVER PATTERN

Page 20: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

A SHORT DIGRESSION...

Page 21: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

VERY IMPORTANT CONTENT CREATOR

Page 22: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

HOW WILL PEOPLE SEE MY CONTENT?

Page 23: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

OLD SCHOOL WAY

Page 24: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

I will make content- inuencer

I will subscribe to yourcontent

- adoring fan

I made new content- inuencer

I am notied about yourcontent, and can watch

it- adoring fan

Page 25: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

I will emit events- Subject

I will subscribe to yourevents

- Observer

An event happened- Subject

I am notied about theevent, and can handle it

- Observer

Page 26: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Real World Example

1. // Function to change the content of t2 2. const modifyText = () => 3. const toggle = document.getElementById("toggle"); 4. toggle.firstChild.nodeValue = t2.firstChild.nodeValue == "on" ? "off" : "on"; 5. 6. 7. // add event listener to table 8. const el = document.getElementById("toggle­switch"); 9. el.addEventListener("click", modifyText, false);

Page 27: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

OBSERVER PATTERN VS GLOBALEVENT BUS

(+) Way simpler than global event bus(+) Localized scope(-) Have To Setup Subscriptions

Page 28: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Take home quiz:

TRY DRAG AND DROP

Page 29: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

MIXING CONCERNS1. Handling events2. Subscribing observers

Page 30: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Is this what happened?

REDUX ORIGIN STORY

Page 31: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

IS THERE A BETTER WAY?

Page 32: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

3. FUNCTIONAL REACTIVE PROGRAMMING

Page 33: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

I taught middle school

ONCE UPON A TIME...

Page 34: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

GOOD TEACHERS = JEDI

Page 35: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

DON'T START WITH A PLAN...

Page 36: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

AND GET INTERRUPTED.

Page 37: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

PLAN FORINTERRUPTIONS

AND REACT!

Page 38: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

PSA:

PAY TEACHERS

Page 39: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

HOW COULD WEWRITE PROGRAMS

REACTIVELY?

Page 40: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Consider this statement

Y = X + 3

Page 41: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Assign once the value for y by adding 3 to x

IMPERATIVE MEANING:

Page 42: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

An equation

MATH MEANING

5 10 15 20­5­10­15­20

5101520

­5­10­15­20

y

x

Page 43: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

X is a value that can change over time. Y is always thevalue 3 greater than X

REACTIVE MEANING:

Page 44: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

a data stream of numbers over time

X VALUES OVER TIME

0 9 3 10 4

Page 45: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

a data stream of numbers derived from another stream

Y VALUES OVER TIME

0 9 3 10 4

3 12 6 13 7

Page 46: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Stream of user input events

MOUSE CLICKS OVER TIME

MC MC MCMCMCMC MC MCMCMCMC MC

Page 47: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

REACTIVEPROGRAMMING INTHE REAL WORLD?

Page 48: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Only better...

OBSERVER PATTERN!

Page 49: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

A value that changes over time, that we can listen tochanges on

OBSERVABLE:

Page 50: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Value as 'Observable'

1. x.subscribe(nextX => console.log(nextX)) 2. 3. x.subscribe(nextX => console.log(nextX + 3)) 4. 5. y = "?"; 6. 7. x = [0, 9, 3, 10, 4] 8. 9. y = x.map(nextX => nextX + 3) 10. 11. x = Observable.of(0, 9, 3, 10, 4); 12. 13. y = x.map(nextX => nextX + 3)

Page 51: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Go Left Go Right

Left ButtonClicks

Right ButtonClicks

Left ClickPosition

Right ClickPosition

Position

Page 52: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

How This Works

1. import 2. fromEvent, 3. merge 4. from "rxjs";

Page 53: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

4. HOW DO I ACTUALLY USE THIS?

Page 54: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

IMPORTANT DATA POINT

Page 55: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

YOU'RE ALREADY USING IT.

Page 56: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

TWO QUESTIONS FOR USING RXJSHow to architect applications with RxJS?How do I integrate this in my application, today?

Page 57: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

User name:

Password:

Submit

User name Password Submit Button

Login Attempts

Login Responses

Login In ProgressLogin FailuresLogin Successes

Failure Message

User Token Get Protected

Protected Resourc

Page 58: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

But how tho?

1. const api = 2. login: (username, password) => Promise, 3. protectedResource: 4. get: (userToken) => Promise 5. 6. ; 7. 8. const username$ = new Subject(); 9. const password$ = new Subject(); 10. const submitButton$ = new Subject(); 11. 12. const loginAttempts$ = submitButton$.pipe(withLatestFrom(username$, password$)); 13. 14. const loginResponses$ = loginAttempts$.pipe( 15. mergeMap(([_, username, password]) => api.login( 16. username,17. password

Page 59: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

How data propogates through your program

SIGNAL GRAPH

Page 60: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

ACTUAL SIGNAL GRAPH FROM REAL APP

email passwordauthorizationRequested

selectedAccountIndex portfolioSelectedauthorization

user failedLogins portfolios

activePortfolio

portfolioSecurities

accounts

activeAccount

activeAccountPerformances activeAccountPortfolios

Page 61: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

PRODUCTION CONCERNS1. How do I test?2. How do I make sure my graph is sound?3. Ack RxJs idiosyncracies!4. One big graph or lots of smaller ones?5. Diagramming is hard

Page 62: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

I liked Signal Graphs so much I bought thecompany!

- me, 2018

Page 63: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

A library for frontend state management using signalgraphs

SIGNAL:

Page 64: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Signal!

1. const signalGraph = new SignalGraphBuilder() 2. .define( 3. addPrimary('username$'), 4. addPrimary('password$'), 5. addPrimary('submitButton$'), 6. addDerived( 7. 'loginAttempts$', 8. makeLoginAttempts, 9. 'submitButton$', 10. 'username$', 11. 'password$' 12. ), 13. addDerived('loginResponses$', makeLoginResponses, 'loginAttempts$', 'api'), 14. addDerived( 15. 'loginInProgress$', 16. makeLoginInProgress,17. 'loginAttempts$',

Page 65: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Available Now(ish):

@RXREACT/SIGNAL

Page 66: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Coming Soon:

AUTOMATICGRAPH

VISUALIZATION

Page 67: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

INTEGRATION

Page 68: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

FRAMEWORK = ANGULAR1. You're done2. Check out NgRx

Page 69: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

BUT WHAT ABOUT REACT?

Page 70: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

GOOD NEWS!

Page 71: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Tools for integrating react with RxJs!

RXREACT:

Page 72: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

Signal-connect

1. import withViewModel from '@rxreact/signal­connect' 2. 3. const PositionedBox = ( position ) => <RedBox pose=position /> 4. 5. const ballSignalGraph = new SignalGraphBuilder().define(/*...*/).build() 6. 7. // connect(graph, mapGraphOutputsToProps, mapGraphInputsToProps = ) 8. const BoundBox = connect( 9. ballSignalGraph, 10. 11. position: 'position$' 12. 13. )(PositionedBox) 14. 15. const LeftButton = connect(

Page 73: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

5. USED CAR SALES PORTION

Page 74: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

RxJs+React on it's own

@RXREACT/CORE:

Page 75: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

RxReact Demo

1. import withViewModel from '@rxreact/core' 2. 3. const PositionedBox = ( position ) => <RedBox pose=position /> 4. 5. const boxVm = 6. inputs: 7. position: position$ 8. 9. 10. 11. const BoundBox = withViewModel(boxVm)(PositionedBox) 12. 13. const LeftButton = withViewModel( 14. outputs: 15. onClick: leftClick$ 16.

Page 76: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

WHAT ABOUT TYPESCRIPT?

Page 77: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

RXREACT TYPESCRIPT

Page 78: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

VIEW MODEL AS REDUCER?

Page 79: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

1. let viewModel = viewModelFromReducer( 2. initialState: 3. count: 2, 4. fruit: 'bananas', 5. extra: 'applesauce' 6. , 7. reducer(state, action) 8. switch (action.type) 9. case ActionType.SET_COUNT: 10. return ReducerResult.Update( ...state, 11. count: action.payload

Page 80: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

@RXREACT/PROCESS

Page 81: HANNAH HOWARD #ABOUTME › system › files › presentation-slides › presentation.pdf1. LRESULT CALLBACK MainWndProc(HWND hwnd, UINT uMsg, WPARAM wParam, LPARAM lParam) // second

reactivex-talk.techgirlwonder.com github.com/hannahhoward/reactivex-talk

THAT'S ALL FOLKS!