SlideShare uma empresa Scribd logo
1 de 26
Baixar para ler offline
Migrating to Angular 5 for Spring Developers
By Gunnar Hillert
@ghillert
1
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
What is this talk about?
Spring Cloud Data Flow Dashboard
“Spring Cloud Data Flow is a toolkit for building data
integration and real-time data processing pipelines.”
• Upgrade from Angular 1.x to 5.0
• Issues we ran into
• How does Angular fit into the Spring developer
experience
2
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Me
• (Java+Spring) developer since 2005
• Java Champion
• Spring Integration, Spring XD, Spring Cloud Data Flow
• Angular since Jan 2014
• DevNexus co-founder (2009)
• Coffee farmer
3
Berlin
Atlanta
Hawaii
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Audience - What do you use?
4
Other
(15%)
React
(5%)
Nothing Yet
(20%)
Angular 2+
(30%)
AngularJS
(30%)
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Demo
5
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Our old stack
6
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Upgrading from AngularJS to Angular
7
AngularJS Angular 5
Grunt npm
Bower npm
Grunt Plugin Angular CLI (Weppack)
Less Saas
RequireJS Angular Modules / Webpack
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Libraries to Migrate
• Busy Indicator to Angular2 Busy
• angularUtils dirPaginate to Angular Pagination (ngx-pagination)
• Growl like status messages to Angular2 Toasty
• Instead of UI Router we use Angular’s built-in router (Much better than in 1.x)
8
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Expected Benefits
• TypeScript delivers refactorability
• Classes and almost Spring-like dependency injection (constructor)
• Modern Stack
• ReactiveX library for JavaScript (RxJS)
• Much simpler directives/components
9
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Upgrade options
• Upgrading with ngUpgrade
• Follow the AngularJS Style Guide
• E.g. Use the ControllerAs syntax (never use $scope)
• Rewrite
• Something else … e.g. React.
10
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Starter Projects
• Angular Webpack Starter
• Angular CLI (official)
11
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Angular CLI
$ npm install -g @angular/cli
$ ng new demo-project --style=scss --routing
$ cd demo-project
$ ng serve
12
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
TypeScript
• Super-set of JavaScript
• Classes
• Interfaces
• [optional] Types (incl. intersection, union types)
• Inheritance
• Generics
13
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Rich Domain Model 1/2
• In 1.x we just used the raw JSON data (no domain model)
• You can cast JSON responses to domain objects
• Don’t Pass JSON objects to your UI!
14
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Rich Domain Model 2/2
• Much better: Deserialize JSON into TypeScript classes explicitly
• Do validation + ensure clean models
15
export class AppRegistration
implements Selectable,
Serializable<AppRegistration> {
…
public deserialize(input) {
this.name = input.name;
this.type = input.type as ApplicationType;
this.uri = input.uri;
return this;
}
…
}
export class Page<T> {
totalPages: number;
totalElements: number;
pageNumber = 0;
pageSize = 10;
items: T[] = [];
filter = '';
…
}
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Remember your Flex skills?
16
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
RxJS - ReactiveX library for JavaScript
• Observable, the new Promise
• Only fulfilled if you subscribe()
• Mind the async pipe and consider share()
• Enhanced ngIf template syntax with Angular 4:
17
<div *ngIf="streams | async; let stream; else loading">
<li>{{stream.name}} {{stream.status}}</li>
</div>
<ng-template #loading>Loading …</ng-template>
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Pain points
• Security and @angular/http (deprecated with Angular 5)
• Favor @angular/http (since 4.3) over @angular/common/http
• APP_INITIALIZER
• Cannot await an Observable … converting to promise
• Enum support is a bit underwhelming (coming from Java)
• If you need full enum support, check out ts-enums
18
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
More Pain points
• Form Handling, dualism: Reactive Forms versus Template Forms
• Dualism of data-binding and vaguenesses on state-management
• Dashboard trackBy for (default: object uniqueness by reference)
19
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Upgrading from Angular 4 to 5
• Ahead-of-Time (AOT) compilation issues with ng —prod
• Early adoption issues, "JavaScript heap out of memory”
• PhantomJS issues — deprecated, switch to Headless Chrome
• ngx-bootstrap update to 2.0.0
• Linting more demanding e.g.:



import { Observable } from ‘rxjs/Rx’

vs import { Observable } from ‘rxjs/Observable’
20
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
State Management
• Stateful components using RouteReuseStrategy
• State in interacting components
• bind data downward emit changes in events upward
• Using services (Singleton) to manage state
• State in services using in Observables
• Use a state library such as @ngrx/store
21
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Documentation
JSDoc - http://usejsdoc.org/
TypeDoc - http://typedoc.org/
CompoDoc - https://compodoc.github.io/website/
22
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Integration with Spring Boot and Maven
Maven Frontend Plugin (https://github.com/eirslett/frontend-maven-plugin)
• downloads + installs Node & NPM locally
• executes NPM install
• /META-INF/resources/, /resources/, /static/, /public/
• Make Boot modules (UI) Pluggable
23
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
Open Issues
• Upgrade underlying Bootstrap 3
• Bootstrap 4, Clarity (VMware), Material Design
• Clarity looks tempting, used by over 35 product teams within VMware
• Browser E2E Testing
• State Management/Performance
• Workflow library - JointJS
• jQuery, Lodash, Backbone
• Messaging to push notifications
24
😵
Or something with CSS Grid?
Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons
Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/
General Tips and Learning
• Keep it simple + Keep Current
• Follow the Angular style guide - https://angular.io/guide/styleguide
• Follow the TypeScript Coding-guidelines and Do’s and Don’ts
• Test build again Linux AND Windows (Node is a bit finnicky)
• Always test against production build as well (AOT magic)
• Udemy - Angular 5 - The Complete Guide
• Pluralsight (Courses by John Papa) and Safari
• Have fun & contribute at to the project on GitHub
25
😃
Learn More. Stay Connected.
Reactive Frontends with RxJS and Angular (Sergi Almar)
Wednesday, 17:00, Room: 2020
26
#springone@s1p
Slides: https://www.slideshare.net/hillert
@ghillert | linkedin.com/in/hillert/ | blog.hillert.com

Mais conteúdo relacionado

Mais procurados

JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinar
Julien Dubois
 

Mais procurados (20)

Latency analysis for your microservices using Spring Cloud & Zipkin
Latency analysis for your microservices using Spring Cloud & ZipkinLatency analysis for your microservices using Spring Cloud & Zipkin
Latency analysis for your microservices using Spring Cloud & Zipkin
 
Angular vs React vs Vue
Angular vs React vs VueAngular vs React vs Vue
Angular vs React vs Vue
 
JDBC, What Is It Good For?
JDBC, What Is It Good For?JDBC, What Is It Good For?
JDBC, What Is It Good For?
 
Industry trend of HTML5 in 2012 (2012년 HTML5 총정리)
Industry trend of HTML5 in 2012 (2012년 HTML5 총정리)Industry trend of HTML5 in 2012 (2012년 HTML5 총정리)
Industry trend of HTML5 in 2012 (2012년 HTML5 총정리)
 
Modern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.jsModern JavaScript Frameworks: Angular, React & Vue.js
Modern JavaScript Frameworks: Angular, React & Vue.js
 
Frontend Monoliths: Run if you can!
Frontend Monoliths: Run if you can!Frontend Monoliths: Run if you can!
Frontend Monoliths: Run if you can!
 
What's New in Spring for Apache Kafka 2.0
What's New in Spring for Apache Kafka 2.0What's New in Spring for Apache Kafka 2.0
What's New in Spring for Apache Kafka 2.0
 
50 common web developer interview questions [2020 updated] [www.full stack....
50 common web developer interview questions [2020 updated]   [www.full stack....50 common web developer interview questions [2020 updated]   [www.full stack....
50 common web developer interview questions [2020 updated] [www.full stack....
 
The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013The Modern Java Web Developer - Denver JUG 2013
The Modern Java Web Developer - Denver JUG 2013
 
[2015/2016] Apache Cordova
[2015/2016] Apache Cordova[2015/2016] Apache Cordova
[2015/2016] Apache Cordova
 
JHipster for Spring Boot webinar
JHipster for Spring Boot webinarJHipster for Spring Boot webinar
JHipster for Spring Boot webinar
 
Angular,react,vue
Angular,react,vueAngular,react,vue
Angular,react,vue
 
Swing is not dead
Swing is not deadSwing is not dead
Swing is not dead
 
Reactjs Basics
Reactjs BasicsReactjs Basics
Reactjs Basics
 
Next Generation OAuth Support with Spring Security 5.0
Next Generation OAuth Support with Spring Security 5.0Next Generation OAuth Support with Spring Security 5.0
Next Generation OAuth Support with Spring Security 5.0
 
Microsoft Azure in der Praxis
Microsoft Azure in der PraxisMicrosoft Azure in der Praxis
Microsoft Azure in der Praxis
 
Frameworks in java
Frameworks in javaFrameworks in java
Frameworks in java
 
Android Security: Defending Your Users
Android Security: Defending Your UsersAndroid Security: Defending Your Users
Android Security: Defending Your Users
 
Review on React JS
Review on React JSReview on React JS
Review on React JS
 
IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016IPT angular2 typescript SPA 2016
IPT angular2 typescript SPA 2016
 

Semelhante a Migrating to Angular 5 for Spring Developers

Cloud Configuration Ecosystem at Intuit
Cloud Configuration Ecosystem at IntuitCloud Configuration Ecosystem at Intuit
Cloud Configuration Ecosystem at Intuit
VMware Tanzu
 

Semelhante a Migrating to Angular 5 for Spring Developers (20)

Cloud Configuration Ecosystem at Intuit
Cloud Configuration Ecosystem at IntuitCloud Configuration Ecosystem at Intuit
Cloud Configuration Ecosystem at Intuit
 
Building .NET Microservices
Building .NET MicroservicesBuilding .NET Microservices
Building .NET Microservices
 
SpringOnePlatform2017 recap
SpringOnePlatform2017 recapSpringOnePlatform2017 recap
SpringOnePlatform2017 recap
 
Building a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / SpringBuilding a Secure App with Google Polymer and Java / Spring
Building a Secure App with Google Polymer and Java / Spring
 
12 Factor, or Cloud Native Apps - What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps - What EXACTLY Does that Mean for Spring Deve...12 Factor, or Cloud Native Apps - What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps - What EXACTLY Does that Mean for Spring Deve...
 
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
12 Factor, or Cloud Native Apps – What EXACTLY Does that Mean for Spring Deve...
 
Cloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven MicroservicesCloud-Native Streaming and Event-Driven Microservices
Cloud-Native Streaming and Event-Driven Microservices
 
Intro to Reactive Programming
Intro to Reactive ProgrammingIntro to Reactive Programming
Intro to Reactive Programming
 
In the workshop with GCP, Home Depot & Cloud Foundry
In the workshop with GCP, Home Depot & Cloud FoundryIn the workshop with GCP, Home Depot & Cloud Foundry
In the workshop with GCP, Home Depot & Cloud Foundry
 
Documenting RESTful APIs with Spring REST Docs
Documenting RESTful APIs with Spring REST Docs Documenting RESTful APIs with Spring REST Docs
Documenting RESTful APIs with Spring REST Docs
 
Consumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice ArchitectureConsumer Driven Contracts and Your Microservice Architecture
Consumer Driven Contracts and Your Microservice Architecture
 
P to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to ContainersP to V to C: The Value of Bringing “Everything” to Containers
P to V to C: The Value of Bringing “Everything” to Containers
 
Crossing the CI/CD/DevOps Chasm
Crossing the CI/CD/DevOps ChasmCrossing the CI/CD/DevOps Chasm
Crossing the CI/CD/DevOps Chasm
 
Developing Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache KafkaDeveloping Real-Time Data Pipelines with Apache Kafka
Developing Real-Time Data Pipelines with Apache Kafka
 
Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015Ratpack - SpringOne2GX 2015
Ratpack - SpringOne2GX 2015
 
Cloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud ServicesCloud Native Java with Spring Cloud Services
Cloud Native Java with Spring Cloud Services
 
Debugging Serverless for Cloud
Debugging Serverless for CloudDebugging Serverless for Cloud
Debugging Serverless for Cloud
 
Zuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne PlatformZuul @ Netflix SpringOne Platform
Zuul @ Netflix SpringOne Platform
 
Spring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and BeyondSpring Tools 4 - Eclipse and Beyond
Spring Tools 4 - Eclipse and Beyond
 
What's new in Spring Boot 2.0
What's new in Spring Boot 2.0What's new in Spring Boot 2.0
What's new in Spring Boot 2.0
 

Mais de Gunnar Hillert

Mais de Gunnar Hillert (16)

High Precision GPS Positioning for Spring Developers
High Precision GPS Positioning for Spring DevelopersHigh Precision GPS Positioning for Spring Developers
High Precision GPS Positioning for Spring Developers
 
The Spring Update
The Spring UpdateThe Spring Update
The Spring Update
 
Ajug - The Spring Update
Ajug - The Spring UpdateAjug - The Spring Update
Ajug - The Spring Update
 
s2gx2015 who needs batch
s2gx2015 who needs batchs2gx2015 who needs batch
s2gx2015 who needs batch
 
Spring Batch Performance Tuning
Spring Batch Performance TuningSpring Batch Performance Tuning
Spring Batch Performance Tuning
 
Creating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJSCreating Modular Test-Driven SPAs with Spring and AngularJS
Creating Modular Test-Driven SPAs with Spring and AngularJS
 
Modular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJSModular Test-driven SPAs with Spring and AngularJS
Modular Test-driven SPAs with Spring and AngularJS
 
Atlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring IntegrationAtlanta JUG - Integrating Spring Batch and Spring Integration
Atlanta JUG - Integrating Spring Batch and Spring Integration
 
DevNexus 2013 - Introduction to WebSockets
DevNexus 2013 - Introduction to WebSocketsDevNexus 2013 - Introduction to WebSockets
DevNexus 2013 - Introduction to WebSockets
 
Introduction to WebSockets
Introduction to WebSocketsIntroduction to WebSockets
Introduction to WebSockets
 
S2GX 2012 - Spring Projects Infrastructure
S2GX 2012 - Spring Projects InfrastructureS2GX 2012 - Spring Projects Infrastructure
S2GX 2012 - Spring Projects Infrastructure
 
S2GX 2012 - What's New in Spring Integration
S2GX 2012 - What's New in Spring IntegrationS2GX 2012 - What's New in Spring Integration
S2GX 2012 - What's New in Spring Integration
 
S2GX 2012 - Introduction to Spring Integration and Spring Batch
S2GX 2012 - Introduction to Spring Integration and Spring BatchS2GX 2012 - Introduction to Spring Integration and Spring Batch
S2GX 2012 - Introduction to Spring Integration and Spring Batch
 
Spring Projects Infrastructure
Spring Projects InfrastructureSpring Projects Infrastructure
Spring Projects Infrastructure
 
Cloud Foundry for Spring Developers
Cloud Foundry for Spring DevelopersCloud Foundry for Spring Developers
Cloud Foundry for Spring Developers
 
jRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting ServicejRecruiter - The AJUG Job Posting Service
jRecruiter - The AJUG Job Posting Service
 

Último

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 
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
 

Último (20)

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemkeProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
ProductAnonymous-April2024-WinProductDiscovery-MelissaKlemke
 
WSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering DevelopersWSO2's API Vision: Unifying Control, Empowering Developers
WSO2's API Vision: Unifying Control, Empowering Developers
 
MS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectorsMS Copilot expands with MS Graph connectors
MS Copilot expands with MS Graph connectors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Vector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptxVector Search -An Introduction in Oracle Database 23ai.pptx
Vector Search -An Introduction in Oracle Database 23ai.pptx
 
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
Apidays New York 2024 - APIs in 2030: The Risk of Technological Sleepwalk by ...
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
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
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
Navigating the Deluge_ Dubai Floods and the Resilience of Dubai International...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
Biography Of Angeliki Cooney | Senior Vice President Life Sciences | Albany, ...
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 

Migrating to Angular 5 for Spring Developers

  • 1. Migrating to Angular 5 for Spring Developers By Gunnar Hillert @ghillert 1
  • 2. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ What is this talk about? Spring Cloud Data Flow Dashboard “Spring Cloud Data Flow is a toolkit for building data integration and real-time data processing pipelines.” • Upgrade from Angular 1.x to 5.0 • Issues we ran into • How does Angular fit into the Spring developer experience 2
  • 3. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Me • (Java+Spring) developer since 2005 • Java Champion • Spring Integration, Spring XD, Spring Cloud Data Flow • Angular since Jan 2014 • DevNexus co-founder (2009) • Coffee farmer 3 Berlin Atlanta Hawaii
  • 4. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Audience - What do you use? 4 Other (15%) React (5%) Nothing Yet (20%) Angular 2+ (30%) AngularJS (30%)
  • 5. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Demo 5
  • 6. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Our old stack 6
  • 7. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Upgrading from AngularJS to Angular 7 AngularJS Angular 5 Grunt npm Bower npm Grunt Plugin Angular CLI (Weppack) Less Saas RequireJS Angular Modules / Webpack
  • 8. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Libraries to Migrate • Busy Indicator to Angular2 Busy • angularUtils dirPaginate to Angular Pagination (ngx-pagination) • Growl like status messages to Angular2 Toasty • Instead of UI Router we use Angular’s built-in router (Much better than in 1.x) 8
  • 9. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Expected Benefits • TypeScript delivers refactorability • Classes and almost Spring-like dependency injection (constructor) • Modern Stack • ReactiveX library for JavaScript (RxJS) • Much simpler directives/components 9
  • 10. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Upgrade options • Upgrading with ngUpgrade • Follow the AngularJS Style Guide • E.g. Use the ControllerAs syntax (never use $scope) • Rewrite • Something else … e.g. React. 10
  • 11. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Starter Projects • Angular Webpack Starter • Angular CLI (official) 11
  • 12. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Angular CLI $ npm install -g @angular/cli $ ng new demo-project --style=scss --routing $ cd demo-project $ ng serve 12
  • 13. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ TypeScript • Super-set of JavaScript • Classes • Interfaces • [optional] Types (incl. intersection, union types) • Inheritance • Generics 13
  • 14. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Rich Domain Model 1/2 • In 1.x we just used the raw JSON data (no domain model) • You can cast JSON responses to domain objects • Don’t Pass JSON objects to your UI! 14
  • 15. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Rich Domain Model 2/2 • Much better: Deserialize JSON into TypeScript classes explicitly • Do validation + ensure clean models 15 export class AppRegistration implements Selectable, Serializable<AppRegistration> { … public deserialize(input) { this.name = input.name; this.type = input.type as ApplicationType; this.uri = input.uri; return this; } … } export class Page<T> { totalPages: number; totalElements: number; pageNumber = 0; pageSize = 10; items: T[] = []; filter = ''; … }
  • 16. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Remember your Flex skills? 16
  • 17. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ RxJS - ReactiveX library for JavaScript • Observable, the new Promise • Only fulfilled if you subscribe() • Mind the async pipe and consider share() • Enhanced ngIf template syntax with Angular 4: 17 <div *ngIf="streams | async; let stream; else loading"> <li>{{stream.name}} {{stream.status}}</li> </div> <ng-template #loading>Loading …</ng-template>
  • 18. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Pain points • Security and @angular/http (deprecated with Angular 5) • Favor @angular/http (since 4.3) over @angular/common/http • APP_INITIALIZER • Cannot await an Observable … converting to promise • Enum support is a bit underwhelming (coming from Java) • If you need full enum support, check out ts-enums 18
  • 19. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ More Pain points • Form Handling, dualism: Reactive Forms versus Template Forms • Dualism of data-binding and vaguenesses on state-management • Dashboard trackBy for (default: object uniqueness by reference) 19
  • 20. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Upgrading from Angular 4 to 5 • Ahead-of-Time (AOT) compilation issues with ng —prod • Early adoption issues, "JavaScript heap out of memory” • PhantomJS issues — deprecated, switch to Headless Chrome • ngx-bootstrap update to 2.0.0 • Linting more demanding e.g.:
 
 import { Observable } from ‘rxjs/Rx’
 vs import { Observable } from ‘rxjs/Observable’ 20
  • 21. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ State Management • Stateful components using RouteReuseStrategy • State in interacting components • bind data downward emit changes in events upward • Using services (Singleton) to manage state • State in services using in Observables • Use a state library such as @ngrx/store 21
  • 22. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Documentation JSDoc - http://usejsdoc.org/ TypeDoc - http://typedoc.org/ CompoDoc - https://compodoc.github.io/website/ 22
  • 23. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Integration with Spring Boot and Maven Maven Frontend Plugin (https://github.com/eirslett/frontend-maven-plugin) • downloads + installs Node & NPM locally • executes NPM install • /META-INF/resources/, /resources/, /static/, /public/ • Make Boot modules (UI) Pluggable 23
  • 24. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ Open Issues • Upgrade underlying Bootstrap 3 • Bootstrap 4, Clarity (VMware), Material Design • Clarity looks tempting, used by over 35 product teams within VMware • Browser E2E Testing • State Management/Performance • Workflow library - JointJS • jQuery, Lodash, Backbone • Messaging to push notifications 24 😵 Or something with CSS Grid?
  • 25. Unless otherwise indicated, these slides are © 2013-2016 Pivotal Software, Inc. and licensed under a Creative Commons Attribution-NonCommercial license: http://creativecommons.org/licenses/by-nc/3.0/ General Tips and Learning • Keep it simple + Keep Current • Follow the Angular style guide - https://angular.io/guide/styleguide • Follow the TypeScript Coding-guidelines and Do’s and Don’ts • Test build again Linux AND Windows (Node is a bit finnicky) • Always test against production build as well (AOT magic) • Udemy - Angular 5 - The Complete Guide • Pluralsight (Courses by John Papa) and Safari • Have fun & contribute at to the project on GitHub 25 😃
  • 26. Learn More. Stay Connected. Reactive Frontends with RxJS and Angular (Sergi Almar) Wednesday, 17:00, Room: 2020 26 #springone@s1p Slides: https://www.slideshare.net/hillert @ghillert | linkedin.com/in/hillert/ | blog.hillert.com