SlideShare a Scribd company logo
Refactoring
Web Interfaces
@JINA // DEVCONFU // JŪRMALA // 2014
@jina
Senior Product Designer
— PAUL SAFFO
“It used to be that designers made an object
and walked away. Today the emphasis must
shift to designing the entire life cycle.”
What is
refactoring?
Refactoring:
GETTING RID OF CODE SMELLS?
— SOME LIAR
“I always code perfectly
the first time.”
lack of clarity
confusion
no maintainability
inefficiency
duplication
bloat
Refactoring:
BUSY WORK?
Refactoring:
CHANGE THE STRUCTURE OF EXISTING CODE WITHOUT
CHANGING THE BEHAVIOR OF THAT CODE
My first large
major CSS refactor:
2007–2008 // Apple Online Store
old styles // legacy CSS
new styles // basic font sizes, colors, & fonts
typography // basic font sizes, colors, & fonts
layout // grid, borders, backgrounds
overrides // temporary overrides for old styles
local styles // localization
context styles // styles for stores for b2b, education, etc.
Too bad I wasn’t
using Sass then…
Jina bolton - Refactoring Web Interfaces
2010–2011 // AppCloud
Nesting
USE (CAREFULLY) TO AVOID REPETITION
If you’re nesting more than
3 levels deep, you’re probably
doing something wrong.
Variables
STORE COMMON ATTRIBUTES FOR MAINTAINABILITY
Mixins
STORE REUSABLE CODE & PASS ARGUMENTS FOR OVERRIDES
@mixin mod($txt: #ccc) {
background: #111;
color: $txt;
}
body { @include mod; }
h1 { @include mod(#888); }
body {
background: #111;
color: #ccc;
}
h1 {
background: #111;
color: #888888;
}
SCSS Output
@extend
CHAIN SELECTORS TOGETHER
.message {
padding: 1em;
a { color: #369; }
}
.error {
@extend .message;
color: #eee;
}
.message, .error {
padding: 1em;
}
.message a, .error a {
color: #369;
}
.error {
color: #eee;
}
SCSS Output
Placeholder
Selectors
CREATE SILENT CLASSES FOR @EXTEND
%grid-1 { width: 240px; }
%grid-2 { width: 480px; }
.content {
@extend %grid-1;
color: #369;
}
.main {
@extend %grid-1;
background: #eee;
}
.content, .main {
width: 240px;
}
.content {
color: #369;
}
.main {
background: #eee;
}
SCSS Output
ZOMG!
Refactoring, Sass,
& Style Guides are
awesome together!
Engine Yard App Cloud Style Guide, Early 2011
blog.engineyard.com/2011/front-end-maintainability-with-sass-and-style-guides
2012–2013 // Web App & Web Site
Make Refactoring
a regular part of
your workflow.
01 //
Don’t try to refactor
everything at once.
YOU’LL LIKELY GIVE UP.
Refactor
going forward.
Making
something new?
Document it.
Revising something?
Refactor it.
Then document it.
If code style preferences
are agreed upon,
document it.
Do you have a
CSS Gatekeeper?
Document
your ideal CSS
Architecture.
02 //
smacss.com
Do Web App “Deathstar”
Do Website “Kenobi”
deathstar.sass kenobi.sass
deathstar.sass kenobi.sass
deathstar.sass kenobi.sass
deathstar.sass kenobi.sass
deathstar.sass kenobi.sass
vendor // third party libraries
@import compass
@import susy
@import breakpoint
vendor/_shared.sass
compass-style.org
susy.oddbird.net
breakpoint-sass.com
// ------------------------
// VENDOR
@import vendor/shared
@import bootstrap/variables
@import bootstrap/mixins
// ------------------------
// VENDOR
@import vendor/shared
deathstar.sass kenobi.sass
vendor
dependencies // Global variables, mixins, & functions
@import color
@import type
@import layout
dependencies/_shared.sass
// ---------------------------------------
// DEPENDENCIES
@import dependencies/shared
@import dependencies/deathstar/themes
@import dependencies/deathstar/animations
// ---------------------------------------
// DEPENDENCIES
@import dependencies/shared
@import dependencies/kenobi/themes
deathstar.sass kenobi.sass
vendor
dependencies
base // Plain old semantic HTML
@include border-box-sizing
@import vendor/normalize
@import type
@import lists
@import tables
base/_shared.sass
// -----------------------
// BASE
@import base/shared
// -----------------------
// BASE
@import base/shared
@import base/kenobi/fonts
deathstar.sass kenobi.sass
vendor
dependencies
base
components // Modular components & states
@import icons
@import forms
@import buttons
@import toggles
@import messages
components/_shared.sass
// --------------------------------
// COMPONENTS
@import components/shared
@import components/deathstar/modals
// --------------------------------
// COMPONENTS
@import components/shared
deathstar.sass kenobi.sass
vendor
dependencies
base
components
regions // Divided page regions
// ------------------------------------
// REGIONS
@import regions/deathstar/banner
@import regions/deathstar/navigation
// ------------------------------------
// REGIONS
@import regions/kenobi/banner
@import regions/kenobi/complementary
@import regions/kenobi/contentinfo
deathstar.sass kenobi.sass
vendor
dependencies
base
components
regions
helpers // Layout helpers
@import layout-float
@import layout-display-table
@import visibility
helpers/_shared.sass
// --------------------------------
// HELPERS
@import helpers/shared
@import helpers/deathstar/sprites
// --------------------------------
// HELPERS
@import helpers/shared
deathstar.sass kenobi.sass
vendor
dependencies
base
components
regions
helpers
responsive // Adjustments to type & spacing
// --------------------------------
// RESPONSIVE
@import responsive/deathstar/mobile
@import responsive/deathstar/tablet
@import responsive/deathstar/screen
@import responsive/deathstar/retina
@import responsive/print
// --------------------------------
// RESPONSIVE
@import responsive/kenobi/mobile
@import responsive/kenobi/tablet
@import responsive/kenobi/screen
@import responsive/kenobi/retina
@import responsive/print
deathstar.sass kenobi.sass
_buttons.sass _screen.sass
_forms.sass
_modals.sass
vendor
dependencies
base
components
regions
helpers
responsive
tools // Visible grids & diagnostics
@import show-grid
@import diagnostics
tools/_shared.sass
<% if Rails.env.development? && Settings.show_grids %>
@import show-grid
@import diagnostics
<% end %>
tools/_shared.sass.erb
vendor/
dependencies/
base/
components/
regions/
helpers/
responsive/
tools/
}
PUT NEW CSS IN ITS PLACE
MOVE OLD CSS AS YOU GET TO
IT IN REVISIONS
MOVE MORE WHEN YOU
HAVE TIME TO WORK ON
TECH DEBT
Refactor when you’re adding something new.
Refactor when you’re fixing an issue.
Refactor during issues come up in code reviews.
Keep commits
focused & organized.
03 //
Bigger commits
lazy reviews
If you see something you want to fix that is
not within the scope of the current commit,
take note, and fix it in a new commit.
To debug, inspect at the
inner-most element
then work outward.
Find in Project (or GREP)
to determine if what you’re
editing is used anywhere else.
Check how your commit
affects the style guide.
Not in a style guide?
Put it in one!
Color
MAINTAINABILITY WITH SASS
Use your Sass Variables to
generate a living color
palette in your Style Guide.
Create a simple
color palette. Use
Sass to do variations.
$x: #369;
$y: #fff;
.a { color: lighten($x, 5%); }
.b { color: darken($x, 5%); }
.c { color: saturate($x, 5%); }
.d { color: grayscale($x ); }
.e { color: mix($x, $y); }
Just a few things Sass can do to your colors.
Make Variables for common
pairings of color & Sass
functions, and document it.
$black: #000;
$grey: #eee;
$white: invert($black);
$h-bg-color: $black;
$h-text-color: $grey;
$h-link-color: $white;
_colors.scss _header.scss
sassme.arc90.com
Make Mixins for common
pairings of backgrounds,
text colors, & shadow colors.
Typography:
CREATE A SMART SYSTEM & START MOVING TOWARD IT.
Choose a standard
base unit.
4 IS A GOOD BASE… IT MULTIPLIES INTO 8, 12, 16, ETC.
Create Mixins for
common type styles.
SPACED OUT CAPS, BIG QUOTE STYLES…
BUT DON’T HAVE TOO MANY. AND DOCUMENT THEM!
Don’t try to refactor
everything at once.
YOU’LL LIKELY GIVE UP.
Refactor
going forward.
— GUSTAVE FLAUBERT
“Be regular and orderly in your
life so that you may be violent
and original in your work.”
sfdc-styleguide.herokuapp.com
@SalesforceUX
dribbble.com/salesforce
sass-lang.com
@TeamSassDesign
dribbble.com/TeamSassDesign
themixinsf.com
susy.oddbird.net
T W I T T E R , D R I B B B L E , I N STAG RA M , & G I T H U B
@jina

More Related Content

Viewers also liked (6)

PDF
Jina Bolton - in the search of the single source of truth
DevConFu
 
PDF
UI Realigning & Refactoring by Jina Bolton
Codemotion
 
PDF
Jina Bolton
Carsonified Team
 
PDF
Under the influence: Dark patterns & the power of persuasive design
Ben Tollady
 
PPTX
The researcher’s blind spot: 6 cognitive biases we shouldn’t ignore in research
Ruth Ellison
 
PDF
Designers are from Mars, BAs are from Venus
Cornelius Rachieru Jr.
 
Jina Bolton - in the search of the single source of truth
DevConFu
 
UI Realigning & Refactoring by Jina Bolton
Codemotion
 
Jina Bolton
Carsonified Team
 
Under the influence: Dark patterns & the power of persuasive design
Ben Tollady
 
The researcher’s blind spot: 6 cognitive biases we shouldn’t ignore in research
Ruth Ellison
 
Designers are from Mars, BAs are from Venus
Cornelius Rachieru Jr.
 

Similar to Jina bolton - Refactoring Web Interfaces (20)

PPTX
SASS is more than LESS
Itai Koren
 
PPTX
SCSS Implementation
Amey Parab
 
PDF
Sass that CSS
Trish Ang
 
PPTX
Arunan Skanthan - Roll Your own Style Guide
Web Directions
 
PDF
SASS, Compass, Gulp, Greensock
Marco Pinheiro
 
PPTX
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
Eric Carlisle
 
KEY
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Claudina Sarahe
 
KEY
Advanced sass/compass
Nick Cooley
 
PPTX
Introduction to sass
Anoop Raveendran
 
PDF
A complete html and css guidelines for beginners
Surendra kumar
 
KEY
Sass: The Future of Stylesheets
chriseppstein
 
PDF
Creating Living Style Guides to Improve Performance
Nicole Sullivan
 
PDF
Sass
Bram Verdyck
 
PDF
PechaKucha Less VS Sass
Hoang Huynh
 
PDF
A better CSS: Sass and Less - CC FE & UX
JWORKS powered by Ordina
 
PDF
CSS Workflow. Pre & Post
Anton Dosov
 
PDF
SASS: The Next Wave in Styling and Theming
Sencha
 
PPTX
Revamp Your Stylesheet
Gary Homidas
 
PDF
CSS preprocessor: why and how
mirahman
 
PDF
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
SASS is more than LESS
Itai Koren
 
SCSS Implementation
Amey Parab
 
Sass that CSS
Trish Ang
 
Arunan Skanthan - Roll Your own Style Guide
Web Directions
 
SASS, Compass, Gulp, Greensock
Marco Pinheiro
 
The New UI - Staying Strong with Flexbox, SASS, and {{Mustache.js}}
Eric Carlisle
 
Bringing sexy back to CSS: SASS/SCSS, LESS and Compass
Claudina Sarahe
 
Advanced sass/compass
Nick Cooley
 
Introduction to sass
Anoop Raveendran
 
A complete html and css guidelines for beginners
Surendra kumar
 
Sass: The Future of Stylesheets
chriseppstein
 
Creating Living Style Guides to Improve Performance
Nicole Sullivan
 
PechaKucha Less VS Sass
Hoang Huynh
 
A better CSS: Sass and Less - CC FE & UX
JWORKS powered by Ordina
 
CSS Workflow. Pre & Post
Anton Dosov
 
SASS: The Next Wave in Styling and Theming
Sencha
 
Revamp Your Stylesheet
Gary Homidas
 
CSS preprocessor: why and how
mirahman
 
Css preprocessor-140606115334-phpapp01
Anam Hossain
 
Ad

More from DevConFu (20)

PDF
Hanno Jarvet - Agile is a bad strategy or 5 things every Agile practitioner s...
DevConFu
 
PDF
Wilko Nienhaus - continuous delivery release the right thing, done right, at ...
DevConFu
 
PDF
Gojko Adzic - Taking the business on the journey - ConFu
DevConFu
 
PPTX
Vasco Duarte - Agile Innovation - Product Management in turbulent times - ConFu
DevConFu
 
PDF
Hanno Jarvet - VSM, Planning and Problem Solving - ConFu
DevConFu
 
PDF
Andrey Adamovich - Enterprise flight into DevOps space - ConFu
DevConFu
 
PDF
Hanno Jarvet - The Lean Toolkit – Value Stream Mapping and Problem Solving
DevConFu
 
PDF
Didzis Balodis - Web application security – war stories from real penetration...
DevConFu
 
PDF
Ivan Gaydamakin and Juri Tishko - ​3D Printing (workshop)
DevConFu
 
PDF
Robin Hawkes - Using OpenStreetMap and WebGL to create real-world cities in 3D
DevConFu
 
PPTX
Marion de Groot - Scrum and Specs
DevConFu
 
PDF
Allan Kelly - Dialogue Sheets for retrospectives and discussion
DevConFu
 
PDF
Robert Virkus - Playing with LEGO Mindstorms from your Mobile Phone
DevConFu
 
PPTX
Eduards Sizovs - Micro Service Architecture
DevConFu
 
ODP
Misha Beshkin - How to organize execution of tests on real Android devices
DevConFu
 
PDF
Jon Arne Sæterås - Give Responsive Design a mobile performance boost
DevConFu
 
PDF
Andrey Adamovich and Luciano Fiandesio - Groovy dev ops in the cloud
DevConFu
 
PDF
Patrick H. Lauke - Getting Touchy; an introduction to touch and pointer events
DevConFu
 
PDF
Allan Kelly - Do it right, then do the right thing
DevConFu
 
PDF
Filipp Keks - Unity3D
DevConFu
 
Hanno Jarvet - Agile is a bad strategy or 5 things every Agile practitioner s...
DevConFu
 
Wilko Nienhaus - continuous delivery release the right thing, done right, at ...
DevConFu
 
Gojko Adzic - Taking the business on the journey - ConFu
DevConFu
 
Vasco Duarte - Agile Innovation - Product Management in turbulent times - ConFu
DevConFu
 
Hanno Jarvet - VSM, Planning and Problem Solving - ConFu
DevConFu
 
Andrey Adamovich - Enterprise flight into DevOps space - ConFu
DevConFu
 
Hanno Jarvet - The Lean Toolkit – Value Stream Mapping and Problem Solving
DevConFu
 
Didzis Balodis - Web application security – war stories from real penetration...
DevConFu
 
Ivan Gaydamakin and Juri Tishko - ​3D Printing (workshop)
DevConFu
 
Robin Hawkes - Using OpenStreetMap and WebGL to create real-world cities in 3D
DevConFu
 
Marion de Groot - Scrum and Specs
DevConFu
 
Allan Kelly - Dialogue Sheets for retrospectives and discussion
DevConFu
 
Robert Virkus - Playing with LEGO Mindstorms from your Mobile Phone
DevConFu
 
Eduards Sizovs - Micro Service Architecture
DevConFu
 
Misha Beshkin - How to organize execution of tests on real Android devices
DevConFu
 
Jon Arne Sæterås - Give Responsive Design a mobile performance boost
DevConFu
 
Andrey Adamovich and Luciano Fiandesio - Groovy dev ops in the cloud
DevConFu
 
Patrick H. Lauke - Getting Touchy; an introduction to touch and pointer events
DevConFu
 
Allan Kelly - Do it right, then do the right thing
DevConFu
 
Filipp Keks - Unity3D
DevConFu
 
Ad

Recently uploaded (20)

PDF
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
PPTX
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PDF
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
PPTX
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
PDF
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
PDF
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
PDF
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
PDF
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
PPTX
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
PPTX
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
PPTX
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
PDF
Simplify React app login with asgardeo-sdk
vaibhav289687
 
PDF
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
PDF
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
PDF
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
PPTX
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
PPTX
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
PDF
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
PDF
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
PPTX
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 
TheFutureIsDynamic-BoxLang witch Luis Majano.pdf
Ortus Solutions, Corp
 
Finding Your License Details in IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
[Solution] Why Choose the VeryPDF DRM Protector Custom-Built Solution for You...
Lingwen1998
 
Milwaukee Marketo User Group - Summer Road Trip: Mapping and Personalizing Yo...
bbedford2
 
AOMEI Partition Assistant Crack 10.8.2 + WinPE Free Downlaod New Version 2025
bashirkhan333g
 
UITP Summit Meep Pitch may 2025 MaaS Rebooted
campoamor1
 
ERP Consulting Services and Solutions by Contetra Pvt Ltd
jayjani123
 
How to Hire AI Developers_ Step-by-Step Guide in 2025.pdf
DianApps Technologies
 
Function & Procedure: Function Vs Procedure in PL/SQL
Shani Tiwari
 
Homogeneity of Variance Test Options IBM SPSS Statistics Version 31.pptx
Version 1 Analytics
 
Get Started with Maestro: Agent, Robot, and Human in Action – Session 5 of 5
klpathrudu
 
Simplify React app login with asgardeo-sdk
vaibhav289687
 
SciPy 2025 - Packaging a Scientific Python Project
Henry Schreiner
 
Generic or Specific? Making sensible software design decisions
Bert Jan Schrijver
 
AI Prompts Cheat Code prompt engineering
Avijit Kumar Roy
 
Smart Doctor Appointment Booking option in odoo.pptx
AxisTechnolabs
 
Home Care Tools: Benefits, features and more
Third Rock Techkno
 
IDM Crack with Internet Download Manager 6.42 Build 43 with Patch Latest 2025
bashirkhan333g
 
Download Canva Pro 2025 PC Crack Full Latest Version
bashirkhan333g
 
In From the Cold: Open Source as Part of Mainstream Software Asset Management
Shane Coughlan
 

Jina bolton - Refactoring Web Interfaces