Project Ironman - Large Scale CSS Refactoring @trivago

41
Large Scale CSS Refactoring at trivago @pistenprinz

Transcript of Project Ironman - Large Scale CSS Refactoring @trivago

Page 1: Project Ironman - Large Scale CSS Refactoring @trivago

Large Scale CSS Refactoring at trivago

@pistenprinz

Page 2: Project Ironman - Large Scale CSS Refactoring @trivago

Ironman release picture

Crazy Guy

Talking to you right now

Does something with frontend at trivago

Loves giving presentations

U.Bolt

Performance Unicorn

Page 3: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

What is it?A description

Project Ironman was the technical migration of the trivago hotel search's existing CSS core to a pattern library based user interface.*

*) business translation for #refactorAllTheThings

Page 4: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the tech contextThe big picture

• Establishing a Frontend / Design System • Reduce technical debt • Consistency in Code (and Design) over all

applications • Provide base for modern & sustainable UI rebuild

Page 5: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman & the pattern library Built without Design Thinking and Atomic Design

Page 6: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman & the pattern library Built with Design Thinking and Atomic Design

Page 7: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman & Atomic Design

Atomic Design in one gif

http://bradfrost.com/blog/post/atomic-design-in-one-gif/

Page 8: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman & the pattern library Behind the scenes - the developer playground

Page 9: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Before Ironman

The pain points

• IE7 support • Layout built on reset.css • Overly complex CSS/DOM structure • Desktop first approach • Inconsistency

Page 10: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Before Ironman

The pain points

Page 11: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Fifty shades of greyOr how to prove inconsistency

Page 12: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Specificity graph 2012

The specificity wall

Page 13: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Graph before ironman

Way better, but still …

peaks at the beginning of the stylesheet

Page 14: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman & IE7

Disqualification

Page 15: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the scope

The 3 disciplines

• Normalize.css incl. border-box switch* • Mobile first switch* • SVG icons instead of image sprites*

*) integrate the new CSS framework base which was developed with the Pattern Library but retain the existing layout and design

Page 16: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the scope

In detail

• Refactor > 50000 lines of Code of SCSS • Adapt dozens of templates • Keep IE8 support • Remove 1200 Icons • Extensive (Device-)Testing • In 4 weeks!

Page 17: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the challengesThe business

How to tell management that you need 4 weeks of feature freeze and the User Interface will look exactly the same afterwards?

Page 18: Project Ironman - Large Scale CSS Refactoring @trivago

Code / Process AuditsHow to tell management that you need you need 4 weeks of feature freeze and the User Interface will exactly look the same afterwards?

Page 19: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the challengesPossible ways to convince the business side

• Argue! • Be a salesman- Sell it! Prove it! Show benefits! • Do it in 3 weeks! • Don’t only think technically!

Page 20: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the challengesThe process

• How to integrate such a project into an existing process?

• How to handle management expectation? • How to plan and estimate?

Page 21: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - the challengesPossible ways to enforce culture

• People over process • Commitment over estimation • Agility • Make progress transparent • Involve everybody • Motivate people and let them be awesome

Page 22: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Page 23: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman in numbers People and processes

• 1 Project Team • 9 awesome developers, 3 lovely designers • Infinite supporters • 3 Meetings • 17 daily stand-ups • 67 Post-Its on Kanban board • 1 Slack-channel

Page 24: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman in numbers Code and Outcome

• ~800 Commits in 3 weeks • 11973 LOC added • 36668 LOC removed • Reduced SCSS LOC from 52991 to 39755 • Infinite icons replaced with 451 SVGs • 352 files changed

Page 25: Project Ironman - Large Scale CSS Refactoring @trivago

Code / Process Audits• 1 Project Team • 7 awesome developers • infinite supporters

Page 26: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Showcase 1Desktop first vs. Mobile first

Page 27: Project Ironman - Large Scale CSS Refactoring @trivago
Page 28: Project Ironman - Large Scale CSS Refactoring @trivago
Page 29: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Showcase 2Sprite Wars vs. SVG beauty

Page 30: Project Ironman - Large Scale CSS Refactoring @trivago
Page 31: Project Ironman - Large Scale CSS Refactoring @trivago
Page 32: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Showcase 3HTTP Requests

Page 33: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Showcase 3HTTP requests

Page 34: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Showcase 3HTTP requests

Page 35: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - At a glance

Happy times

• Foundation built to move the UI Development to the next level

• Better rendering performance on mobile • Shared knowledge and understanding

throughout, between all developers and the entire design/product team

Page 36: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ironman - At a glance

Happy times

• Optimized design-development process through Atomic Design

• Changed coding guidelines and improved structure (ITCSS, BEM, OOCSS, …)

Page 37: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Moved to ITCSS

Prepared base for new UI components

Page 38: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Graph before Ironman

Way better, but still …

peaks at the beginning of the stylesheet

Page 39: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Graph after Ironman

Improved curve

New CSS base

Adapted old UI components. Can now be easily rebuilt!

SVG

Page 40: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

Ready for the next stepsAutomate the pattern integration

Page 41: Project Ironman - Large Scale CSS Refactoring @trivago

Christoph Reinartz - @pistenprinz

ThanksI’m done

Christoph Reinartz Team Lead UI/UX Engineering @pistenprinz