Angular 5 vs. React When to Choose Which?

Similar documents
Angular 4 Syllabus. Module 1: Introduction. Module 2: AngularJS to Angular 4. Module 3: Introduction to Typescript

THE PRAGMATIC INTRO TO REACT. Clayton Anderson thebhwgroup.com WEB AND MOBILE APP DEVELOPMENT AUSTIN, TX

BootsFaces and AngularFaces

Angular 2: What s new? Jonas Bandi, IvoryCode GmbH

Advance Mobile& Web Application development using Angular and Native Script

"Charting the Course... Comprehensive Angular. Course Summary

Advanced React JS + Redux Development

ANGULAR 2.X,4.X + TYPESRCIPT by Sindhu

Stencil: The Time for Vanilla Web Components has Arrived

TechWatch Report Javascript Libraries and Frameworks

Full Stack Developer with Java

a Very Short Introduction to AngularJS

P a g e 1. Danish Technological Institute. Scripting and Web Languages Online Course k Scripting and Web Languages

Future Web App Technologies

"Charting the Course... Comprehensive Angular 5. Course Summary

High Performance Single Page Application with Vue.js

Treating Framework Fatigue With JavaScript

IN4MATX 133: User Interface Software

Full Stack Web Developer

AngularJS Fundamentals

Ten interesting features of Google s Angular Project

Full Stack Web Developer

JavaScript and MVC Frameworks FRONT-END ENGINEERING

Course Outline. ProTech Professional Technical Services, Inc. Comprehensive Angular 7 Course Summary. Description

React Not Just Hype!

CodeValue. C ollege. Prerequisites: Basic knowledge of web development and especially JavaScript.

Introduction to. Angular. Prof. Dr.-Ing. Thomas Wiedemann.

Java SE7 Fundamentals

FRONT END WEB. {< Course Details >}

Angular 2 and TypeScript Web Application Development

Frontend UI Training. Whats App :

Full Stack boot camp

React(.js) the Domino Way High-Performance Client for Domino. Knut Herrmann

Front End Nanodegree Syllabus

The course also includes an overview of some of the most popular frameworks that you will most likely encounter in your real work environments.

One Framework. Angular

Modern and Responsive Mobile-enabled Web Applications

Front-End Web Developer Nanodegree Syllabus

Angular 2 Programming

International Research Journal of Engineering and Technology (IRJET) e-issn: Volume: 05 Issue: 06 June p-issn:

This course is designed for web developers that want to learn HTML5, CSS3, JavaScript and jquery.

"Charting the Course... MOC A: Developing with the SharePoint Framework. Course Summary

React & Redux in Hulu. (Morgan Cheng)

React + React Native. Based on material by Danilo Filgueira

Comprehensive AngularJS Programming (5 Days)

"Charting the Course... Comprehensive Angular 6 Course Summary

Arjen de Blok. Senior Technical Consultant bij ICT Groep ( sinds 1995 Programmeren sinds 1990 Technologiën. Links

Sample Copy. Not For Distribution.

ANGULAR2 OVERVIEW. The Big Picture. Getting Started. Modules and Components. Declarative Template Syntax. Forms

Angular 4 Training Course Content

Financial. AngularJS. AngularJS. Download Full Version :

STARCOUNTER. Technical Overview

Course 1: Microsoft Professional Orientation: Front-End Web Developer

Building mobile app using Cordova and AngularJS, common practices. Goran Kopevski

Choosing the web s future. Peter-Paul Koch Van Lanschot, 9 February 2017

Financial. AngularJS. AngularJS.

Modern SharePoint and Office 365 Development

55249: Developing with the SharePoint Framework Duration: 05 days

Think like an Elm developer

By the end of this Angular 6 tutorial, you'll learn by building a real world example application:

Front End Nanodegree Syllabus

3 Days Training Program

Modernize your IT- Landscape

MASTERS COURSE IN FULL STACK WEB APPLICATION DEVELOPMENT W W W. W E B S T A C K A C A D E M Y. C O M

Web Development for Dinosaurs An Introduction to Modern Web Development

API Management and why it matters

55191: Advanced SharePoint Development

Demystifying Angular 2. SPAs for the Web of Tomorrow

welcome to BOILERCAMP HOW TO WEB DEV

Lesson: Web Programming(6) Omid Jafarinezhad Sharif University of Technology

AngularJS Introduction

Etanova Enterprise Solutions

P a g e 1. Danish Tecnological Institute. Developer Collection Online Course k Developer Collection

Getting Started with ReactJS

Single Page Applications using AngularJS

Angular2. Bernhard Niedermayer. Software Development playing around with Angular2 since alpha.

Angular 2 and TypeScript Web Application Development

Client Side MVC with Backbone & Rails. Tom

The DOM and jquery functions and selectors. Lesson 3

Lecture 8. ReactJS 1 / 24

Simple AngularJS thanks to Best Practices

UI Course HTML: (Html, CSS, JavaScript, JQuery, Bootstrap, AngularJS) Introduction. The World Wide Web (WWW) and history of HTML

CHOOSING THE RIGHT HTML5 FRAMEWORK To Build Your Mobile Web Application

Decoupled Drupal with Angular

Integrating Angular with ASP.NET Core RESTful Services. Dan Wahlin

Microsoft Office 365 for Business. Your office-on-the-go. Get more work done virtually anytime, anywhere, on any device.

COURSE OUTLINE MOC 20480: PROGRAMMING IN HTML5 WITH JAVASCRIPT AND CSS3

PHP WITH ANGULAR CURRICULUM. What you will Be Able to Achieve During This Course

DECOUPLING PATTERNS, SERVICES AND CREATING AN ENTERPRISE LEVEL EDITORIAL EXPERIENCE

August, HPE Propel Microservices & Jumpstart

Qiufeng Zhu Advanced User Interface Spring 2017

INTERFACE FOUNDATIONS OF WEB DEVELOPMENT

Drupal 8 THE VIDER ITY APPR OACH

Down With JavaScript!

Tooling for Ajax-Based Development. Craig R. McClanahan Senior Staff Engineer Sun Microsystems, Inc.

D3 + Angular JS = Visual Awesomesauce

Varargs Training & Software Development Centre Private Limited, Module: HTML5, CSS3 & JavaScript

CGS 3066: Spring 2015 JavaScript Reference

SPA Design And Architecture: Understanding Single Page Web Applications Ebooks Free

Model-View-Whatever A COMPARISON OF JAVASCRIPT MVC/MVP/MVVM FRAMEWORKS. J. Tower

Transcription:

Angular 5 vs. React When to Choose Which? Stephan Rauh Dr. Marius Hofmeister OPITZ CONSULTING Deutschland GmbH OPITZ CONSULTING 2017 OPITZ CONSULTING 2017

Setting the Stage https://upload.wikimedia.org/wikipedia/commons/5/52/summer_solstice_sunrise_over_stonehenge_2005.jpg OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 2

What People Say About Angular update hell Angular is slow Angular is fast two-way binding considered bad But it's TypeScript! dependency hell great tooling complicated dependency injection is broken too enterprisy opinionated great productivity mediocre productivity OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 3

What People Say About React.js fast unidirectional data flow great tooling limited editor support flexible small footprint requires TDD integrates everywhere It's simple JavaScript! difficult to set up easy to learn I can use any library I want great productivity mediocre productivity OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 4

Image source: https://pixabay.com/de/hier-entlang-verwirren-718660/, https://angular.io/presskit, https://en.wikipedia.org/wiki/file:react-icon.svg OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 5

What's Going On? Different target audiences Web developers vs. enterprise developers Different use cases Interactive web pages Web shops Back-office processing Internet vs intranet Image source: https://pixabay.com/de/online-speicher-gesch%c3%a4ft-kaufen-1905889/ OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 6

History 101: AngularJS 1.x Combined ideas from Backbone, Knockout, Web Components spec Made MVVM popular in the browser Declarative programming style Got rid of DOM manipulations Added dependency injection to JavaScript Brought custom components OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 7

History 101: Migration to Angular 2+ AngularJS had a couple of issues Painful migration to Angular 2+ Many breaking changes of ng2 In the beta versions! Frustrated developers left OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 8

Angular 5? Angular 2+ comes with strong improvements Angular 3 has been skipped because there's already version 3 of the router Angular 4 contains two minor breaking changes Angular 5 (23.10.) contains changes concerning performance and usability OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 9

History 101: React.js Features Virtual DOM Unidirectional data flow Transactional state (Redux) JSX Powerful toolchain "React was transformational because it singlehandedly made MVC seem like obsolete tech & unleashed unidirectional flow on the masses. Eric Elliot OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 10

Contemporary History React has been re-written from Scratch (Fiber) Suitability for animation, layout, and gestures Main feature incremental rendering Less resources required Fully downward compatible http://isfiberreadyyet.com/ New contender: Vue.js less opinionated OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 11

2 Image source: https://pixabay.com/de/%c3%a4pfel-kiwi-orangen-obst-vitamine-428075/ OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 12

What About Your Needs? React.js: "Just a library" Concentrates on the "V" of MVC React is all about components and composition Ideal for complex user interactions Angular: Full-blown framework Covers all of the MVVM paradigm (or MVC, or MVW) Angular is all about structuring your application Allows for large-scale business applications OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 13

Framework vs. Library Angular: Forms and validation Modules Shadow DOM / local CSS Built-in support for AJAX, HTTP, and Observables Routing (Optional) two-way binding React.js: Uses 3rd party libraries Can be combined straightforwardly with libraries No two-way binding deliberate decision OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 14

Image source: https://upload.wikimedia.org/wikipedia/en/0/02/telehealth_-_blood_pressure_monitor.jpg OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 15

Market Share No unbiased figures available Educated guess React.js and Angular dominate the browser market Image source: https://pixabay.com/de/sieger-siegertreppe-1013979/ OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 16

License React: Since version 16.0.0 (09/2017): MIT License Angular: MIT License Before: Adapted from 3-Clause BSD, With patent grant voided if licensor engages in any patent litigation with Facebook or its subsidiaries. OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 17

But it's TypeScript! OPITZ CONSULTING 2017 Image source: https://www.pexels.com/photo/adult-black-and-white-body-dark-271418/

TypeScript Myths Strong types reduce my productivity TDD detects more errors than strong types Finding type definitions for everything is painful Before long, everybody uses any or starts ignoring error messages OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 19

TypeScript Mythbusting Strong types reduce my productivity True. But only for small programs. Some teams report tremendous productivity boost TDD detects more errors than strong types Strong types allow you to omit trivial tests Finding type definitions for everything is painful True. But things have improved a lot. Before long, everybody uses any or starts ignoring error messages The Angular compiler has become very strict Enterprise teams have learned not to ignore error messages OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 20

Another TypeScript Myth React uses JavaScript. There's also TSX! OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 21

TypeScript Highlights Angular classes look clean and tidy Autocompletion Errors detected by compiler Optional null-safety Type inference Powerful refactorings Hides prototypes from you Easy-to-grasp semantics TypeScript class decorator private scope closure interface constructor method JavaScript (ES5) function function function function n/a function function OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 22

Core Concepts React: Language: JSX or TSX HTML and code are deliberately put in the same file Unconventional programming paradigm Angular: Language: TypeScript + HTML + LESS (or CSS) HTML, CSS and code may or may not be in the same file Supports both traditional and reactive programming paradigms Complex lifecycle (doesn t match with jquery) OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 23

Hot Technical Topics Virtual DOM vs. change detection Unidirectional data flow Components Local CSS (shadow DOM) (Angular) JSX vs. TypeScript Lifecycle (Angular) Dependency injection (Angular) OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 24

Components React: All about components Each component has Mutable state Immutable properties Angular: All about structuring your application Behavior is implemented in components State is managed in services Modules allow for lazy loading Plus clean architecture OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 25

Components OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 26

Components <approot> <history> <settings> <board> <statistics> <piece> <field> OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 27

Example Component - React class ChessPiece extends React.Component { public state : IPieceState; defaultprops = { piece: "pawn", color: "black" }; constructor() { this.state = { pos: { x: 5, y: 6 } }; } (The source code doesn't compile, but it shows the general idea) } public render() { return ( <img src="{this.props.piece} {this.props.color}.png"/> ); } OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 28

Example Component - React class ChessPiece extends React.Component { defaultprops = { piece: "pawn" }; constructor() { this.state = { x:5, y:6 } } (The source code doesn't compile, but it shows the general idea) } public render() { return ( <img src="{this.props.piece}.png"/> ); } OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 29

Example Component - Angular @Component({ selector: 'app-chess-piece', template: '<img src="{state.piece}.png"/>', styleurls: ['./chess-piece.component.css'] }) export class ChessPieceComponent implements OnInit { private state: IPieceState; constructor(private engine: Engine) { } } ngoninit() { } OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 30

Components Data Flow (both React and Angular) <approot> <history> <settings> <board> <statistics> Legend: "Pawn at E6 has moved" <piece> <field> OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 31

Components Data Flow (Angular only) Legend: "Change detected" <history> <settings> <board> <statistics> <approot> GameBoard- Service <piece> <field> OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 32

Components Redux (simplified picture) Optional with Angular and React <approot> Legend: "Change detected" <history> <settings> <board> <statistics > Central state store <piece> <field> OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 33

Rendering React: Virtual DOM Components initially are rendered virtually, reified later and only when necessary Separation between immutable properties and mutable state Angular: Efficient change detection strategy Each and every change is triggered by a change of a component's state Shared state should be moved to services OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 34

Local CSS (Shadow DOM) Angular encapsulates components in the shadow DOM CSS rules defined in a component only apply for this component There's also a global CSS file By default, React does not use the shadow DOM Here s a project for that: https://github.com/wildhoney/reactshadow OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 35

Dependency Injection (Angular Only) Central building block of Angular Allows both Decoupling and Exchanging services for testing purposes Example usecases FakeHttpService instead of the standard http service (since Angular 4 you can also use interceptors) Testing and mocking OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 36

Tests (Angular Only) Tests are first class citizens of Angular Angular has been built with automated tests in mind The Angular CLI automatically generates test stubs for each entity Note that the strict type checks of TypeScript make many tests superfluous OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 37

Going Native React Native NativeScript (Angular) Ionic (Angular) Image source: https://pixabay.com/get/eb31b70f2af7063ed1584d05fb0938c9bd22ffd41cb1144595f9c770a7/sign-2460237_1280.png OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 38

When to Use Which? Image source: https://pixabay.com/de/richtung-weg-entscheidung-ziel-2320124/ OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 39

When to Use React.js? Web applications with complex user interactions Multiple events triggering multiple view updates You're worried about application state You love functional programming Teams familiar with JavaScript and/or action based frameworks React can be added to existing apps Code size matters more than developer productivity Learning curve is reported to be high OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 40

When to Use Angular? Enterprise applications (large-scale) Easy for teams familiar with Java and component-based frameworks Angular is a framework to build your application with Unit and e2e tests are first class citizens of Angular applications You agree with the technical choices of the Angular team You're ready to spend some time learning OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 41

Any questions? It s your turn! OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 42

überraschend mehr Möglichkeiten! Let s make the web a place to be! Stephan Rauh Leiter CC moderne Clients und agile Architekturen Stephan.Rauh@opitz-consulting.com Dr. Marius Hofmeister Senior Consultant marius.hofmeister@opitz-consulting.com @beyondjava http://www.beyondjava.net WWW.OPITZ-CONSULTING.COM @OC_WIRE OPITZCONSULTING opitzconsulting OPITZ CONSULTING 2017 Angular vs. React - When to Choose Which? Seite 43