-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathindex.html
More file actions
executable file
·846 lines (776 loc) · 24.6 KB
/
index.html
File metadata and controls
executable file
·846 lines (776 loc) · 24.6 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
<!doctype html>
<html>
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=no">
<title>AngularJS to Angular: How We Did It</title>
<link rel="stylesheet" href="reveal.js-3.6.0/css/reveal.css">
<link rel="stylesheet" href="reveal.js-3.6.0/css/theme/white.css">
<!-- Theme used for syntax highlighting of code -->
<link rel="stylesheet" href="reveal.js-3.6.0/lib/css/zenburn.css">
<link rel="stylesheet" href="overrides.css">
<!-- Printing and PDF exports -->
<script>
var link = document.createElement( 'link' );
link.rel = 'stylesheet';
link.type = 'text/css';
link.href = window.location.search.match( /print-pdf/gi ) ? 'reveal.js-3.6.0/css/print/pdf.css' : 'reveal.js-3.6.0/css/print/paper.css';
document.getElementsByTagName( 'head' )[0].appendChild( link );
</script>
</head>
<body style="background-image: 'images/angular.svg'">
<div class="reveal">
<div class="slides">
<section class="title-slide">
<h1 style="font-size: 2.0em">AngularJS to Angular:</h1>
<h2>How We Did it</h2>
<img src="images/angular.svg">
<h3>David Stanich</h3>
<h4 style="font-size: 50%"><a href="https://dstanich.github.io/angularjs-to-angular-presentation/" target="url">https://dstanich.github.io/angularjs-to-angular-presentation/</a></h4>
</section>
<section>
<h2>About Me</h2>
<div style="display: flex;">
<div style="flex: 1 1 75%">
<ul>
<li>Advisory Software Engineer</li>
<li>IBM Watson Health (<a href="https://www.ibm.com/watson/health/" target="wh">website</a>)</li>
<li>Frontend development</li>
<li>Co-organizer Rochester FED@IBM</li>
<li>JavaScript, Angular, Java</li>
<li>Twitter: <a href="https://twitter.com/dstanich" target="twitter">@dstanich</a></li>
<li>GitHub: <a href="https://github.com/dstanich" target="gh">dstanich</a></li>
</ul>
</div>
<div style="flex: 1 1 25%">
<img src="images/packers_hat.jpg">
</div>
</div>
</section>
<section>
<h2>Terminology</h2>
<div style="margin-top: 2em; display: flex">
<div style="flex: 1 1 50%">
AngularJS === 1.x
</div>
<div style="flex: 1 1 50%">
Angular === 2+
</div>
</div>
<div style="margin-top: 8em; font-size: .5em">
<a href="http://blog.angularjs.org/2016/12/ok-let-me-explain-its-going-to-be.html" target="terms">http://blog.angularjs.org/2016/12/ok-let-me-explain-its-going-to-be.html</a>
</div>
</section>
<section>
<h2>What we'll cover</h2>
<div>One experience in migration and culture changes</div>
<div>(May 2017 - June 2018)</div>
<br>
<ul>
<li>Justifying the conversion</li>
<li>Education</li>
<li>Development methodology</li>
<li>Culture changes</li>
<li>Tool improvements</li>
<li>Angular pitfalls we encountered</li>
</ul>
</section>
<section>
<h2>Not Covered</h2>
<br>
<ul>
<li>How-to / guide / one size fits all</li>
<li>ngUpgrade</li>
<li>Migrating to React / Vue</li>
<li>Framework comparison</li>
</ul>
</section>
<section>
<section>
<h2>Setting the Stage</h2>
</section>
<section>
<h2>Application State</h2>
<ul>
<li>5-6 UI developers</li>
<li>Medical application</li>
<li>Very dynamic, lots of configuration flags</li>
<li>Deployed in customer environments</li>
<li>Customer support / new features still required</li>
<li>Automated Selenium tests validating logic</li>
<li>Supports: IE11, FF, Chrome, iOS</li>
</ul>
</section>
<section>
<h2>Code History</h2>
<ul>
<li>Originally built in <a href="https://dojotoolkit.org/" target="dojo">Dojo Toolkit</a></li>
<li>Ported to AngularJS (early 1.x)</li>
<li>Minimal usage of 1.5 components</li>
<li>$scope soup</li>
<li>Accessible</li>
<li>Translated into several languages</li>
<li>Right-to-left language support</li>
</ul>
</section>
<section>
<h2>Tech/Tooling Stack</h2>
<ul>
<li>AngularJS 1.5</li>
<li>JSPM dependency management and packaging</li>
<li>Custom Gulp builds</li>
<li>Data provided by REST APIs</li>
<li>Heavy bootstrap usage</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Justifying the Conversion</h2>
</section>
<section>
<h2>Justify to the Business</h2>
<div style="margin-bottom: .5em">Common concerns:</div>
<ul>
<li>What is the value of converting?</li>
<li>What are we sacrificing by converting?</li>
<li>How long is this going to take?</li>
</ul>
</section>
<section>
<h2>Justify to the Business</h2>
<div style="margin-bottom: .5em">Bad answers:</div>
<ul>
<li>Everyone else is using this technology</li>
<li>It will be good on my resume</li>
<li>Want to try out something I just learned</li>
</ul>
</section>
<section>
<h2>Our Value Justification</h2>
<ul>
<li>New UX flow</li>
<li>New branding</li>
<li>Built with application's future in mind</li>
<li>Lower maintenance cost</li>
<li>Pilot tech base for future products</li>
<li>Sacrifices:</li>
<ul>
<li>Some bugs only fixed in new UX</li>
<li>Limit features development in old UX</li>
</ul>
</ul>
</section>
<section>
<h2>Our Plan</h2>
<ul>
<li>Estimate: 5-6 months</li>
<li>Install side-by-side with old UI</li>
<ul>
<li>Won't disrupt other parts of project</li>
<li>UX Research</li>
<li>Compare behaviors</li>
</ul>
<li>Angular 4 (was just released at the time)</li>
</ul>
</section>
<section>
<h2>In Place or Rewrite?</h2>
<table style="font-size: 75%">
<thead>
<th>In place (ngUpgrade)</th>
<th>Rewrite</th>
</thead>
<tbody>
<tr>
<td>+ Less risk in breaking</td>
<td>+ Cleaner code</td>
</tr>
<tr>
<td>+ Incremental</td>
<td>+ Experience in new framework</td>
</tr>
<tr>
<td>- Difficult w/new UX</td>
<td>- More time required</td>
</tr>
<tr>
<td>- Bundle size increases</td>
<td>- Requires more developers</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Over Promising</h2>
<ul>
<li>Realistic expectations</li>
<ul>
<li>Learning</li>
<li>Vacations</li>
<li>Maintain existing product</li>
<li>Mistakes - "learning opportunities"</li>
<li>Unexpected complications</li>
</ul>
</ul>
</section>
</section>
<section>
<section>
<h2>Learn / Education</h2>
</section>
<section>
<h2>Learn</h2>
<ul>
<li>Important to spend time to learn framework</li>
<li>Started with a few team members</li>
<li>Share summary of learning with team</li>
<li>Follow best practices (<a href="https://angular.io/guide/styleguide" target="styleguide">style guide</a>)</li>
<li>Learn potential pitfalls</li>
</ul>
</section>
<section>
<h2>Mob Programming</h2>
<ul>
<li>Work as a team on a single function at same time</li>
<li>Different developer 'drives' each meeting</li>
<li>Learning opportunity for knowledge sharing</li>
<li>Start finding potential issues right away</li>
<li>3+ times each week initially</li>
</ul>
</section>
<section>
<h2>Frontend Masters</h2>
<div>Locally based (Minneapolis) online, and in person, training workshops</div>
<div style="margin-top: 1em; text-align: start">
<div>
<a href="https://frontendmasters.com/courses/building-apps-angular/" target="ngx-fem">Building Awesomer Apps with Angular</a>
<br>11+ hour workshop on Angular essentials
</div>
<div style="margin-top: 1em">
<a href="https://frontendmasters.com/courses/reactive-angular/" target="ngx-fem2">Reactive Angular2</a>
<br>Observables and RxJS with Angular
</div>
</div>
<div style="margin-top:1.5em">
<a href=="https://www.frontendmasters.com" target="fem">https://www.frontendmasters.com</a>
</div>
</section>
<section>
<h2>Safari Books Online</h2>
<div>O'Reilly online learning website</div>
<ul>
<li>Books</li>
<li>Video training</li>
<li>Online workshops</li>
</ul>
<div style="margin-top: 1em">
<a href="https://www.safaribooksonline.com/" target="sbo">https://www.safaribooksonline.com</a>
</div>
</section>
<section>
<h2>Pluralsight / Udemy</h2>
<div style="margin-bottom: 1.5em">Online learning platforms published by various creators; lots of content</div>
<div><a href="https://www.udemy.com/" target="udemy">https://www.udemy.com</a></div>
<div><a href="https://www.pluralsight.com/" target="psight">https://www.pluralsight.com</a></div>
</section>
</section>
<section>
<section>
<h2>Identifying Dependencies</h2>
</section>
<section>
<h2>Process</h2>
<ol>
<li>Define all 1.x dependencies</li>
<li>Are there Angular versions?</li>
<li>Validate in dependency test app</li>
</ol>
</section>
<section>
<table>
<thead>
<th>1.x</th>
<th>Angular</th>
</thead>
<tbody>
<tr>
<td>ng-idle</td>
<td>ng2-idle</td>
</tr>
<tr>
<td>angular-ui/bootstrap</td>
<td>
ng-bootstrap
<br>ngx-bootstrap
</td>
</tr>
<tr>
<td>angular-translate</td>
<td>ngx-translate</td>
</tr>
<tr>
<td>select2</td>
<td>ng2-iq-select2</td>
</tr>
<tr>
<td>ui-router</td>
<td>@angular/router</td>
</tr>
<tr>
<td>d3</td>
<td>Test within Angular</td>
</tr>
</tbody>
</table>
</section>
<section>
<h2>Dependency Test App</h2>
<ul>
<li>No frills app to test libraries</li>
<li>Inject all dependencies at same time</li>
<li>Validate use cases</li>
<li>Test AoT build</li>
</ul>
</section>
<section data-background-image="images/test-page.png" data-background-size="80%">
</section>
<section>
<h2>Package Checklist</h2>
<ul style="list-style-type: circle">
<li>Use case validation</li>
<li>IE11, FF, Chrome, iOS</li>
<li>Accessibility</li>
<li>Right-to-left support</li>
<li>Translation support</li>
<li>Acceptable license</li>
<li>Works in AoT build</li>
<li>Issues, contributors, activity</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Reuse</h2>
</section>
<section>
<h2>Identify Potential 1.x Reuse</h2>
<ul>
<li>Services</li>
<li>Filters</li>
<li>Directives</li>
<li>Some controller functions</li>
<li>Translations</li>
</ul>
</section>
<section>
<h2>Reusing Code</h2>
<ul>
<li>Migrate as needed; get rid of dead code</li>
<li>Update to 2+ syntax</li>
<li>Update injected services</li>
<li>Add types</li>
<li>Decide between Promises / Observables</li>
<li>Fight urge to rewrite logic</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Library Projects</h2>
</section>
<section>
<h2>Library Projects</h2>
<ul>
<li>Two libraries shared for future projects</li>
<li>Publish packages via internal NPM registry</li>
<li>Versioned via <a href="https://semver.org/" target="semver">semver</a> (major.minor.fix)</li>
<li>Custom build for <a href="https://docs.google.com/document/d/1CZC2rcpxffTDfRDs6p1cfbmKNLA6x5O-NtkJglDaBVs/edit" target="package">Angular package format</a></li>
<ul>
<li>Gulp</li>
<li>tsc</li>
<li>Rollup</li>
</ul>
</ul>
</section>
<section>
<h2>Suggestion: Use angular-cli</h2>
<div>angular-cli (v6) now supports library projects</div>
<pre><code data-trim>
ng generate library my-lib
ng build my-lib
</code></pre>
<div style="margin-top: 3em; font-size: .8em">
<a href="https://github.com/angular/angular-cli/wiki/stories-create-library" target="ng-cli-lib">https://github.com/angular/angular-cli/wiki/stories-create-library</a>
</div>
</section>
<section>
<h2>API Package</h2>
<ul>
<li>Common data used across several products</li>
<li>Package contains shared:</li>
<ul>
<li>Services</li>
<li>Interfaces / models</li>
<li>Views (complex components)</li>
</ul>
</ul>
</section>
<section>
<h2>Component Library</h2>
<ul>
<li>New UX/design requiring custom styling</li>
<li>Includes demo application</li>
<li>Generated doc with compodoc (via JSDoc)</li>
<li>Supports: right-to-left, accessibility, translation</li>
<li>Source is mix of:</li>
<ul>
<li>Custom developed source</li>
<li>Wrappers around open source</li>
</ul>
</ul>
</section>
<section data-background-image="images/component-library.png" data-background-size="80%">
</section>
<section>
<h2>Versioning</h2>
<ul>
<li><a href="https://semver.org/" target="semver">semver</a> criteria</li>
<li>Automatic releases via <a href="https://semver.org/" target="semver">semantic-release</a></li>
<li>Every commit/merge triggers release</li>
<li>Application locks major.minor when preparing release</li>
<li>Release branches only when critical issue and version advanced too far</li>
</ul>
</section>
</section>
<section>
<section>
<h2>Tooling/Process Change</h2>
</section>
<section>
<h2>Tooling/Process Change</h2>
<ul>
<li>Source control</li>
<li>Builds</li>
<li>Code reviews</li>
<li>Standups</li>
<li>Technical meetings</li>
<li>Demos</li>
</ul>
</section>
<section>
<h2>Source Control</h2>
<div style="margin-bottom:1em;">
<a href="https://jazz.net/products/rational-team-concert/" target="rtc">Rational Team Concert (RTC)</a>
==>
<a href="https://enterprise.github.com/home" target="ghe">GitHub Enterprise</a>
</div>
<ul>
<li>Better code review tooling</li>
<li>More efficiently able to collaborate</li>
<li>GitHub is company's direction</li>
<li>Act as pilot for other projects</li>
<li>Keep team up to date with industry</li>
</ul>
</section>
<section>
<h2>Builds</h2>
<div style="margin-bottom:1em;">
<a href="https://jazz.net/help-dev/clm/index.jsp?re=1&topic=/com.ibm.team.concert.tutorial.doc/topics/tut_rtc_build.html&scope=null" target="jazzbuild">Jazz Build Engine</a>
==>
<a href="https://enterprise.travis-ci.com/" target="travis">Travis CI Enterprise</a>
</div>
<ul>
<li>Automatic branch builds</li>
<li>Concurrent builds</li>
<li>More developer focused</li>
<li>Integration with GitHub Enterprise</li>
</ul>
</section>
<section>
<h2>Code Reviews</h2>
<ul>
<li>Helps educate each other on Angular</li>
<li>No one can push to master</li>
<li>Approved PRs enforced by GitHub</li>
<li>Slack channel to consolidate open PRs</li>
<li>Daily Slackbot reminders</li>
</ul>
</section>
<section>
<h2>Standups</h2>
<ul>
<li>Critical to success; need communication</li>
<li>Decentralized team (3 locations)</li>
<li>Standups often turned into long discussions</li>
<li>Moved standup to Slack vs. phone</li>
<li>Slackbot reminder at 9am for status</li>
</ul>
<pre><code data-trim>
/remind #channel at 9am every weekday "@here STANDUP! Use this format:
Y:
> - What you did yesterday
T:
> - What you doing today
B: Blockers
"
</code></pre>
</section>
<section>
<h2>Daily Technical Meetings</h2>
<ul>
<li>Communication / sharing important</li>
<li>Daily meeting for:</li>
<ul>
<li>Education topics</li>
<li>Code walkthroughs</li>
<li>Mob programming</li>
<li>Planning</li>
</ul>
</ul>
</section>
<section>
<h2>Demos</h2>
<ul>
<li>Need feedback from stakeholders (new UX)</li>
<li>Weekly Friday demos</li>
<li>Create work items for each action</li>
<li>Schedule followup discussions if needed</li>
</ul>
</section>
</section>
<section>
<section>
<h2>
Pitfall:<br>Differing Developer Styles
</h2>
</section>
<section>
<h2>Problem</h2>
<ul>
<li>Developers have code style preferences</li>
<li>Commit messages are inconsistent</li>
<li>No established styles on team</li>
<li>When fixing defects, often unnecessary changes made due to style</li>
<li>Makes diffs very difficult to parse</li>
</ul>
</section>
<section>
<h2>Solution: Tooling</h2>
<ul>
<li><a href="https://prettier.io/" target="prettier">Prettier</a>: consistent file formatting</li>
<li><a href="https://github.com/marionebl/commitlint" target="commitlint">commitlint</a>: strict format for commit message</li>
<li><a href="https://palantir.github.io/tslint/rules/" target="tslint-rules">Strict TSlint rules</a>: Enforce team establish practices</li>
</ul>
</section>
<section>
<h2>Configuration</h2>
<pre><code data-trim>
// package.json
{
"husky": {
"hooks": {
"pre-commit": "lint-staged",
"commitmsg": "commitlint -e $GIT_PARAMS"
}
},
"lint-staged": {
"*.{ts,js,json,scss}": ["prettier --write", "git add"],
"*.ts": ["tslint"]
}
}
</code></pre>
<pre><code data-trim>
// commitlint.config.js
module.exports = { extends: ['@commitlint/config-conventional'] };
</code></pre>
</section>
<section>
<h2>Example</h2>
<img src="images/tooling_example.gif">
</section>
<section>
<h2>Interesting TSLint Rules</h2>
<table style="font-size: 50%">
<thead>
<tr>
<th>Rule</th>
<th>Purpose</th>
</tr>
</thead>
<tbody>
<tr>
<td><code>"ordered-imports": true</code></td>
<td>Grouping, ordering imports</td>
</tr>
<tr>
<td><code>"no-unused-variable": true</code></td>
<td>Flag unused variables (and imports)</td>
</tr>
<tr>
<td><code>"arrow-parens": true</code></td>
<td>Require parenthesis around params in arrow functions</td>
</tr>
<tr>
<td><code>"array-type": [true, "generic"]</code></td>
<td>Force <code>Array<T></code> syntax</td>
</tr>
<tr>
<td><code>"object-literal-shorthand": true</code></td>
<td>Force ES6 shorthand (ex: no myVar: myVar)</td>
</tr>
<tr>
<td><code>"member-access": true</code></td>
<td>Force devs to be explicit on public/private</td>
</tr>
<tr>
<td><code>member-ordering</code></td>
<td>Ideally, force ordering</td>
</tr>
<tr>
<td>Remove no-inferrable-types rule</td>
<td>Allow redundant type declarations</td>
</tr>
<tr>
<td>Remove quotemark rule</td>
<td>May conflict with Prettier</td>
</tr>
</tbody>
</table>
</section>
</section>
<section>
<section>
<h2>
Pitfall:<br>OnPush Change Detection
</h2>
<div style="margin-top: 2em">
<a href="https://stackblitz.com/github/dstanich/angularjs-to-angular-presentation/tree/master/onpush-example" target="onpushdemo">DEMO</a>
</div>
</section>
<section>
<h2>Problem</h2>
<ul>
<li>Default change detection (CD) strategy doesn't always scale well</li>
<li>Some event listers may trigger a lot of CD</li>
<li>Expensive function impls will slow down CD</li>
<li>Demo:</li>
<ul>
<li>Every mouse event is triggering CD to run</li>
<li>Expensive function being called every time</li>
</ul>
</ul>
</section>
<section>
<h2>Solution</h2>
<ul>
<li>Use <code>ChangeDetectionStrategy.OnPush</code></li>
<li>Inject <code>ChangeDetectorRef</code> and manually execute CD if needed</li>
<li>Treat <code>@Input</code> values as immutable</li>
<li>Demo:</li>
<ul>
<li>OnPush prevents calculated-value from being re-rendered</li>
<li>Ideally, OnPush should be applied everywhere</li>
</ul>
</ul>
</section>
</section>
<section>
<section>
<h2>
Pitfall:<br>Not Unsubscribing
</h2>
<div style="margin-top: 2em">
<a href="https://stackblitz.com/github/dstanich/angularjs-to-angular-presentation/tree/master/missing-unsubscribe-example" target="unsubdemo">DEMO</a>
</div>
</section>
<section>
<h2>Problem</h2>
<ul>
<li>Very easy mistake to make</li>
<li>Not always clear when unsubscribe is required</li>
<li>Causes memory leaks</li>
<li>Possible extra change detection cycles</li>
<li>May trigger unnecessary code to run</li>
<li>Unpredictable state changes</li>
</ul>
</section>
<section>
<h2>Solution</h2>
<ul>
<li>Memory profiling to find leaks</li>
<li>Utilize <code>async</code> pipe more often</li>
<ul>
<li>Auto unsubscribes</li>
<li>Renders again when appropriate</li>
</ul>
<li>Ensure subscription is completed:</li>
<ul>
<li><code>.take(xx)</code> completes observable</li>
<li><code>.unsubscribe()</code></li>
</ul>
</ul>
</section>
</section>
<section>
<section>
<h2>
Pitfall:<br>Trying to do everything the "Angular" way
</h2>
</section>
<section>
<h2>Problem</h2>
<ul>
<li>Angular has a lot of abstraction layers</li>
<li>Often frustrating/annoying to understand abstraction</li>
<li>Harder for non-Angular developers to understand</li>
<li>Several discussions on we should be using Angular</li>
</ul>
</section>
<section>
<h2>Solution</h2>
<ul>
<li>Decided to use abstractions when it makes sense</li>
<ul>
<li><code>@HostListener</code>, some <code>Renderer2</code></li>
<li>Just use <code>window</code> natively</li>
<li>Ignore difficult to use abstractions</li>
</ul>
<li>Team knew we wouldn't be server side rendering</li>
<li>Things became more simple when we didn't need to look it all up</li>
</ul>
</section>
</section>
<section>
<h2>Success!!</h2>
<ul>
<li>Completed in roughly 6-7 months</li>
<li>Well received by customers</li>
<li>Has proven to be less difficult to debug</li>
<li>Team was able to adopt better practices</li>
<li>Library projects usable on other applications</li>
</ul>
</section>
<section>
<h2>Questions??</h2>
</section>
</div>
</div>
<script src="reveal.js-3.6.0/lib/js/head.min.js"></script>
<script src="reveal.js-3.6.0/js/reveal.js"></script>
<script>
// More info about config & dependencies:
// - https://github.com/hakimel/reveal.js#configuration
// - https://github.com/hakimel/reveal.js#dependencies
Reveal.initialize({
history: true,
dependencies: [
{ src: 'reveal.js-3.6.0/plugin/markdown/marked.js' },
{ src: 'reveal.js-3.6.0/plugin/markdown/markdown.js' },
{ src: 'reveal.js-3.6.0/plugin/notes/notes.js', async: true },
{ src: 'reveal.js-3.6.0/plugin/highlight/highlight.js', async: true, callback: function() { hljs.initHighlightingOnLoad(); } }
]
});
</script>
</body>
</html>