20 000 Leagues Under The Angular 4

Oleksandr Tryshchenko
Oleksandr TryshchenkoSenior JavaScript Developer – DataArt
20 000 Leagues Under The Angular 4
TWENTY THOUSAND
LEAGUES UNDER THE
ANGULAR 4
Oleksandr Tryshchenko
Senior Front-end Developer, DataArt
tryshchenko.com
WALT DISNEY'S 20,000
LEAGUES UNDER THE
SEA (1954)
Agenda
1. Why?
2. How?
4
Why?
1. Make an app faster
2. Make a code better
5
DATA BINDING
20 000 Leagues Under The Angular 4
CHANGE DETECTION STRATEGIES
What Is a Data Binding?
1. The automated way to link template and viewModel values between each other.
2. The automated way to link two and more viewModels between each other.
9
Template to Component Binding
View is updated
User changed
view
View triggers
event with
changes
viewModel
subscribed to the
events gets values
viewModel
modifies view in
some way
10
Template to Component Binding
View is updated
User changed
view
View triggers
event with
changes
viewModel
subscribed to the
events gets values
viewModel
modifies view in
some way
11
Almost all frameworks are
tracking changes and
doesn’t refresh HTML if
there’s no changes.
The Most Common Ways:
VirtualDOM Abstract Syntax Tree
12
Component to Template Binding
Angular saves copy
of all values
Variable changes
Angular compares
new and old values
If there are
differences – it
updates the view.
Otherwise skips it
13
Component to Component Binding
14
app
sidebar widgets
Component
with changes
header
Component to Component Binding
15
App
let a = 1;
Sidebar,
displays a
widgets
Component
which changes
the variable
header
Component to Component Binding
16
App
let a = 1;
Sidebar, displays
a
widgets
Component
which a changed
variable
header
“I Wanna Update Parent’s Value
After The Children’s One”
17
Bindings Problem Example
⌨️
Passing @Input() as an Object or Array
19
Component Bindings Example
⌨️
…
⌨️
THAT’S A BULLSHIT!
What Are Change Detection Strategies?
23
https://goo.gl/PrMCoS
Change Detection Strategy Example
⌨️
What Can Help Us?
25
Functional Programming
and Immutable Data
Structures
Attention:
My explanations are simplified. I’m
going to talk about general points
not about the details now:
What Is a Functional Programming
• Usage of “Pure functions”
• Usage of Immutable Data Structures
28
OnPush
1. It’s faster for big data structures
2. It won’t fix your code instead of you
3. You’ll probably won’t need it
29
OnPush Schema
30
Data Structures
1. Mutable
2. Immutable
31
Data Structures
1. Mutable
2. Immutable
32
Data Mutations?
33
Immutable Data Structures We Can Use
1. We can use classic ones J
2. Immutble.js Map and Set
3. Monads
34
Classic Ones?
1. Object.assign()
2. […oldArray, newValue]
35
Immutable
What Are Monads?
1. Monads are containers
37
Idea (Let’s Dream a Little)
Idea (Let’s Dream a Little)
Solution! Monet.js
Avoid Null Pointer Exceptions
Simple Example
Monet
Deeper
1. MarkForCheck
2. Detach
3. Reattach
44
Was That Effective?
1. MarkForCheck
2. Detach
3. Reattach
45
When It Makes a Real Difference?
46
47
REACTIVE FORMS
???
49
Reactive Forms Example
⌨️
Reactive Forms – Filling Manually
1. patchValue vs setValue
2. Reseting form
51
Reactive Forms – Touched
52
Reactive Forms – Valid
53
Reactive Forms – Validators
54
Reactive Forms – Custom Validators
55
Custom Validators Example
⌨️
Reactive Forms – Async Validators
Let’s imagine an email validator. We have to check does it exist in our database.
57
Async Validators Example
⌨️
Reactive Forms – Submitting A Form
59
Reactive Forms – Form Statuses
Adding groups dynamically with FormArray.
60
Reactive Forms – Form Arrays
61
Reactive Forms – Form Arrays
Adding groups dynamically with FormArray.
62
Reactive Forms – Field Observers
Adding groups dynamically with FormArray.
63
ANGULAR ANIMATIONS
Web Animations Api
65
Support
66
What is the Web Animation API?
67
Why Do We Need This?
68
1. We wanna be faster! J
Ok. Performance?
69
1. It triggers CSS animations under the hood.
Angular 2
1. import { trigger, style, transition, animate, group } from '@angular/core';
70
Angular 4
1. import { trigger, style, transition, animate, group } from '@angular/animations’;
71
WAT?
Angular 2
'@angular/core’
Angular 4
'@angular/animations’
72
Examples!
⌨️
ENCAPSULATE!
20 000 Leagues Under The Angular 4
Stay In Touch!
1.http://tryshchenko.com/
2.https://www.facebook.com/tryshchenko
76
20 000 Leagues Under The Angular 4
1 of 77

Recommended

Data based user segmentation - a practical guide for data analysts by
Data based user segmentation - a practical guide for data analystsData based user segmentation - a practical guide for data analysts
Data based user segmentation - a practical guide for data analystsRuben Kogel
611 views13 slides
Data based segmentation @ vsco by
Data based segmentation @ vscoData based segmentation @ vsco
Data based segmentation @ vscoRuben Kogel
2.1K views18 slides
Wakoopa Recommendations Engine on AWS by
Wakoopa Recommendations Engine on AWSWakoopa Recommendations Engine on AWS
Wakoopa Recommendations Engine on AWSAmazon Web Services
4.5K views23 slides
Software Architecture in Microservices by
Software Architecture in MicroservicesSoftware Architecture in Microservices
Software Architecture in MicroservicesPassapong Thaithatgoon
80 views20 slides
Angularjs architecture by
Angularjs architectureAngularjs architecture
Angularjs architectureMichael He
999 views22 slides
Angular 2 Architecture by
Angular 2 ArchitectureAngular 2 Architecture
Angular 2 ArchitectureEyal Vardi
6.3K views45 slides

More Related Content

Similar to 20 000 Leagues Under The Angular 4

Design patterns by
Design patternsDesign patterns
Design patternsmudabbirwarsi
1.8K views22 slides
Unit3 Software engineering UPTU by
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTUMohammad Faizan
1.9K views56 slides
Design pattern in android by
Design pattern in androidDesign pattern in android
Design pattern in androidJay Kumarr
21K views29 slides
Object Oriented Analysis and Design by
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and DesignDr. C.V. Suresh Babu
1.1K views271 slides
Aggregates, Entities and Value objects - Devnology 2010 community day by
Aggregates, Entities and Value objects - Devnology 2010 community dayAggregates, Entities and Value objects - Devnology 2010 community day
Aggregates, Entities and Value objects - Devnology 2010 community dayRick van der Arend
1.5K views43 slides
UML by
UMLUML
UMLRachelle Lewis
3 views21 slides

Similar to 20 000 Leagues Under The Angular 4(20)

Unit3 Software engineering UPTU by Mohammad Faizan
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTU
Mohammad Faizan1.9K views
Design pattern in android by Jay Kumarr
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr21K views
Aggregates, Entities and Value objects - Devnology 2010 community day by Rick van der Arend
Aggregates, Entities and Value objects - Devnology 2010 community dayAggregates, Entities and Value objects - Devnology 2010 community day
Aggregates, Entities and Value objects - Devnology 2010 community day
Rick van der Arend1.5K views
Enriching Tool Support for Model-Driven Software Development by David Méndez-Acuña
Enriching Tool Support for Model-Driven Software DevelopmentEnriching Tool Support for Model-Driven Software Development
Enriching Tool Support for Model-Driven Software Development
An illustrated guide to microservices (ploneconf 10 21-2016) by Ambassador Labs
An illustrated guide to microservices (ploneconf 10 21-2016)An illustrated guide to microservices (ploneconf 10 21-2016)
An illustrated guide to microservices (ploneconf 10 21-2016)
Ambassador Labs914 views
Code Refactoring by kim.mens
Code RefactoringCode Refactoring
Code Refactoring
kim.mens4.3K views
Solid principles, Design Patterns, and Domain Driven Design by Irwansyah Irwansyah
Solid principles, Design Patterns, and Domain Driven DesignSolid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven Design
Irwansyah Irwansyah2.6K views
Sofwear deasign and need of design pattern by chetankane
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
chetankane1.8K views
I gotta dependency on dependency injection by mhenroid
I gotta dependency on dependency injectionI gotta dependency on dependency injection
I gotta dependency on dependency injection
mhenroid1.9K views
MAD Model Aggregator eDitor (EMF) by Sysord
MAD Model Aggregator eDitor (EMF)MAD Model Aggregator eDitor (EMF)
MAD Model Aggregator eDitor (EMF)
Sysord379 views
Novel_Value_Stream_Analysis_for_SAFe_-_ver_8.pdf by Maarit Laanti
Novel_Value_Stream_Analysis_for_SAFe_-_ver_8.pdfNovel_Value_Stream_Analysis_for_SAFe_-_ver_8.pdf
Novel_Value_Stream_Analysis_for_SAFe_-_ver_8.pdf
Maarit Laanti31 views
Introduction to design patterns by Amit Kabra
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
Amit Kabra1.7K views
PhD Maintainability of transformations in evolving MDE ecosystems by Jokin García Pérez
PhD Maintainability of transformations in evolving MDE ecosystemsPhD Maintainability of transformations in evolving MDE ecosystems
PhD Maintainability of transformations in evolving MDE ecosystems

More from Oleksandr Tryshchenko

PWA to React Native migration by
PWA to React Native migrationPWA to React Native migration
PWA to React Native migrationOleksandr Tryshchenko
394 views43 slides
Web Scraping by
Web ScrapingWeb Scraping
Web ScrapingOleksandr Tryshchenko
120 views43 slides
2018 grai by
2018 grai2018 grai
2018 graiOleksandr Tryshchenko
66 views13 slides
Front end architecture patterns by
Front end architecture patternsFront end architecture patterns
Front end architecture patternsOleksandr Tryshchenko
13.2K views84 slides
How To Tweak Angular 2 Performance (JavaScript Frameworks Day 2017 Kiev) by
How To Tweak Angular 2 Performance (JavaScript Frameworks Day 2017 Kiev)How To Tweak Angular 2 Performance (JavaScript Frameworks Day 2017 Kiev)
How To Tweak Angular 2 Performance (JavaScript Frameworks Day 2017 Kiev)Oleksandr Tryshchenko
228 views57 slides
Angular 2 On Production (IT Talk in Dnipro) by
Angular 2 On Production (IT Talk in Dnipro)Angular 2 On Production (IT Talk in Dnipro)
Angular 2 On Production (IT Talk in Dnipro)Oleksandr Tryshchenko
172 views58 slides

Recently uploaded

What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueShapeBlue
265 views23 slides
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...ShapeBlue
162 views25 slides
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOsPriyanka Aash
162 views59 slides
Optimizing Communication to Optimize Human Behavior - LCBM by
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBMYaman Kumar
38 views49 slides
"Package management in monorepos", Zoltan Kochan by
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan KochanFwdays
34 views18 slides
MVP and prioritization.pdf by
MVP and prioritization.pdfMVP and prioritization.pdf
MVP and prioritization.pdfrahuldharwal141
39 views8 slides

Recently uploaded(20)

What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue by ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlueWhat’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
What’s New in CloudStack 4.19 - Abhishek Kumar - ShapeBlue
ShapeBlue265 views
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit... by ShapeBlue
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
Transitioning from VMware vCloud to Apache CloudStack: A Path to Profitabilit...
ShapeBlue162 views
Digital Personal Data Protection (DPDP) Practical Approach For CISOs by Priyanka Aash
Digital Personal Data Protection (DPDP) Practical Approach For CISOsDigital Personal Data Protection (DPDP) Practical Approach For CISOs
Digital Personal Data Protection (DPDP) Practical Approach For CISOs
Priyanka Aash162 views
Optimizing Communication to Optimize Human Behavior - LCBM by Yaman Kumar
Optimizing Communication to Optimize Human Behavior - LCBMOptimizing Communication to Optimize Human Behavior - LCBM
Optimizing Communication to Optimize Human Behavior - LCBM
Yaman Kumar38 views
"Package management in monorepos", Zoltan Kochan by Fwdays
"Package management in monorepos", Zoltan Kochan"Package management in monorepos", Zoltan Kochan
"Package management in monorepos", Zoltan Kochan
Fwdays34 views
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ... by ShapeBlue
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
Live Demo Showcase: Unveiling Dell PowerFlex’s IaaS Capabilities with Apache ...
ShapeBlue129 views
State of the Union - Rohit Yadav - Apache CloudStack by ShapeBlue
State of the Union - Rohit Yadav - Apache CloudStackState of the Union - Rohit Yadav - Apache CloudStack
State of the Union - Rohit Yadav - Apache CloudStack
ShapeBlue303 views
Business Analyst Series 2023 - Week 4 Session 7 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 7Business Analyst Series 2023 -  Week 4 Session 7
Business Analyst Series 2023 - Week 4 Session 7
DianaGray10146 views
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ... by Jasper Oosterveld
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
ESPC 2023 - Protect and Govern your Sensitive Data with Microsoft Purview in ...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or... by ShapeBlue
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
Zero to Cloud Hero: Crafting a Private Cloud from Scratch with XCP-ng, Xen Or...
ShapeBlue199 views
"Surviving highload with Node.js", Andrii Shumada by Fwdays
"Surviving highload with Node.js", Andrii Shumada "Surviving highload with Node.js", Andrii Shumada
"Surviving highload with Node.js", Andrii Shumada
Fwdays58 views
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R... by ShapeBlue
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
Setting Up Your First CloudStack Environment with Beginners Challenges - MD R...
ShapeBlue178 views
Business Analyst Series 2023 - Week 4 Session 8 by DianaGray10
Business Analyst Series 2023 -  Week 4 Session 8Business Analyst Series 2023 -  Week 4 Session 8
Business Analyst Series 2023 - Week 4 Session 8
DianaGray10145 views
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue by ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
2FA and OAuth2 in CloudStack - Andrija Panić - ShapeBlue
ShapeBlue152 views
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ... by ShapeBlue
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
Import Export Virtual Machine for KVM Hypervisor - Ayush Pandey - University ...
ShapeBlue120 views
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And... by ShapeBlue
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
Enabling DPU Hardware Accelerators in XCP-ng Cloud Platform Environment - And...
ShapeBlue108 views

20 000 Leagues Under The Angular 4