SlideShare ist ein Scribd-Unternehmen logo
1 von 77
Downloaden Sie, um offline zu lesen
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
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!
Stay In Touch!
1.http://tryshchenko.com/
2.https://www.facebook.com/tryshchenko
76
20 000 Leagues Under The Angular 4

Weitere ähnliche Inhalte

Ähnlich wie 20 000 Leagues Under The Angular 4

Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
Jay Kumarr
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
chetankane
 

Ähnlich wie 20 000 Leagues Under The Angular 4 (20)

Software Engineering Unit 3 PPT Software Design
Software Engineering Unit 3 PPT Software DesignSoftware Engineering Unit 3 PPT Software Design
Software Engineering Unit 3 PPT Software Design
 
Design patterns
Design patternsDesign patterns
Design patterns
 
Unit3 Software engineering UPTU
Unit3 Software engineering UPTUUnit3 Software engineering UPTU
Unit3 Software engineering UPTU
 
Design pattern in android
Design pattern in androidDesign pattern in android
Design pattern in android
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Aggregates, Entities and Value objects - Devnology 2010 community day
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
 
Best interview questions
Best interview questionsBest interview questions
Best interview questions
 
Enriching Tool Support for Model-Driven Software Development
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)
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)
 
Code Refactoring
Code RefactoringCode Refactoring
Code Refactoring
 
Quick answers to Angular2+ Interview Questions
Quick answers to Angular2+ Interview QuestionsQuick answers to Angular2+ Interview Questions
Quick answers to Angular2+ Interview Questions
 
Design Patterns
Design PatternsDesign Patterns
Design Patterns
 
Solid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven DesignSolid principles, Design Patterns, and Domain Driven Design
Solid principles, Design Patterns, and Domain Driven Design
 
Sofwear deasign and need of design pattern
Sofwear deasign and need of design patternSofwear deasign and need of design pattern
Sofwear deasign and need of design pattern
 
I gotta dependency on dependency injection
I gotta dependency on dependency injectionI gotta dependency on dependency injection
I gotta dependency on dependency injection
 
MAD Model Aggregator eDitor (EMF)
MAD Model Aggregator eDitor (EMF)MAD Model Aggregator eDitor (EMF)
MAD Model Aggregator eDitor (EMF)
 
Design patterns in brief
Design patterns in briefDesign patterns in brief
Design patterns in brief
 
Novel_Value_Stream_Analysis_for_SAFe_-_ver_8.pdf
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
 
Introduction to design patterns
Introduction to design patternsIntroduction to design patterns
Introduction to design patterns
 
PhD Maintainability of transformations in evolving MDE ecosystems
PhD Maintainability of transformations in evolving MDE ecosystemsPhD Maintainability of transformations in evolving MDE ecosystems
PhD Maintainability of transformations in evolving MDE ecosystems
 

Mehr von Oleksandr Tryshchenko

Mehr von Oleksandr Tryshchenko (10)

PWA to React Native migration
PWA to React Native migrationPWA to React Native migration
PWA to React Native migration
 
Web Scraping
Web ScrapingWeb Scraping
Web Scraping
 
2018 grai
2018 grai2018 grai
2018 grai
 
Front end architecture patterns
Front end architecture patternsFront end architecture patterns
Front end architecture patterns
 
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)
How To Tweak Angular 2 Performance (JavaScript Frameworks Day 2017 Kiev)
 
Angular 2 On Production (IT Talk in Dnipro)
Angular 2 On Production (IT Talk in Dnipro)Angular 2 On Production (IT Talk in Dnipro)
Angular 2 On Production (IT Talk in Dnipro)
 
ES6 Generators On Koa.js Example
ES6 Generators On Koa.js ExampleES6 Generators On Koa.js Example
ES6 Generators On Koa.js Example
 
Angular 2 On Production
Angular 2 On ProductionAngular 2 On Production
Angular 2 On Production
 
How To Tweak Angular 2 Performance
How To Tweak Angular 2 PerformanceHow To Tweak Angular 2 Performance
How To Tweak Angular 2 Performance
 
ES6 basics
ES6 basicsES6 basics
ES6 basics
 

Kürzlich hochgeladen

+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
?#DUbAI#??##{{(☎️+971_581248768%)**%*]'#abortion pills for sale in dubai@
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Safe Software
 

Kürzlich hochgeladen (20)

TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law DevelopmentsTrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
TrustArc Webinar - Stay Ahead of US State Data Privacy Law Developments
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
+971581248768>> SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHA...
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024Manulife - Insurer Innovation Award 2024
Manulife - Insurer Innovation Award 2024
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 

20 000 Leagues Under The Angular 4