Gradual migration to ngular

4developers

Wrocław, November 5, 2019

Rate us at EventoryEventory

A18

← Olga Kichewko

Projectleiterin and fullstack programmer at CGCapgemini

Maciej Małecki →

TT@mmalecki77

software architect and fullstack programmer at CGCapgemini

Roshi

What is the most complex development tasks you could possibly do?

CPM

CP/M

Lisa

Lisa OS

MacOS

Mac OS

GEOS

GEOS

TV

Turbo Vision

Win1

MS Windows 1.0

Win3

MS Windows 3.0

Workbench

Amiga OS

TOS

Atari TOS

NeXT

NeXT STEP

Mosaic

NCSA Mosaic

CGI

CGI

PHP

PHP

Java

Java

JS

JavaScript

By Digital Research, Inc. - http://www.hampa.ch/pce/screenshots/index.html, Public Domain, Link By unknown, Link By Source, Fair use, Link By Screenshot taken and uploaded by Remember the dot (talk · contribs), Link By Screenshot is taken and uploaded by Tyomitch (talk · contribs), Link By Matthias Jaap - own work, http://www.stcarchiv.de/stc1999/01_tos492.php, Public Domain, Link By Source, Fair use, Link By Colin Viebrock - http://php.net/logos, CC BY-SA 4.0, Link By sbmehta converted to SVG from Sun Microsystems AI version. - http://duke.kenai.com/wave/index.html (new), https://duke.dev.java.net/images/wave/index.html (old), BSD, Link By Chris Williams - GitHub.com, Public Domain, Link

What do we do with legacy code?

Koszmary Architektury
Wrecking ball
Joel Spolsky

Joel Spolsky

  • Microsoft Excel
  • Stack Overflow
  • Trello

Joel Spolsky

"Programmers are, in their hearts, architects, and the first thing they want to do when they get to a site is to bulldoze the place flat and build something grand."

Things you should never do (2000)

Challenge

Angular

Migrate an old style web app into modern cutting edge Angular something...

Why?

  • we want to have complex dynamics on our pages
  • we can easily test UI written in Angular
  • server-generated HTML pages are no longer "sexy"
  • old code gets messy (as usual)

Possibilities

Big bang

  • clean sheet design
  • no impact on production during dev
  • huge effort before it's ready
  • "chase the rabbit"
  • Spolsky already said: DON'T!

If only we could migrate gradually...

  • we could deliver small chunks on regular basis
  • no cancellation risk: code is already there
  • two technologies mixed for some (long) time

Let's complicate our case

CI/CD

  • Working (almost) always on short living branches
  • Kanban - no sprints
  • Automatic deployment on test environment
  • Production releases at least once per week

Our approach

Spring MVC

  • Server side rendering
  • Template engine
  • Maybe some standalone JS
  • Maybe some AJAX calls
rght

Hybrid

  • Angular as JS library
  • Manages just portion of the page
  • No routing
  • One by one migration
rght

SPA

  • All pages are Angular components
  • Router introduced
  • Routings defined

Demo time

We can rebuild it
Source: starecat.com

Let's summarize

uHappy parts

  • It works!
  • Very effective for projects with good architecture

s Tricky parts

  • Communication between Thymeleaf and Angular
  • Root component
  • Angular resources versioning
  • Developers' mode

Find us on GitHub

QR Code

https://github.com/kiczelkoo/4dev-angularMigration-slides

Pls rate us and give your feedback: Eventory