Guidelines! sorry guys you have to!

25
GUIDELINES Sorry guys, you have to! MILANO FRONT END MEETUP - 26/01/2016 Now full-cats powered!

Transcript of Guidelines! sorry guys you have to!

Page 1: Guidelines! sorry guys you have to!

GUIDELINESSorry guys, you have to!

MILANO FRONT END MEETUP - 26/01/2016 Now full-cats powered!

Page 2: Guidelines! sorry guys you have to!

About me

I'm Davide Di Pumpo and I'm a front-end developer. I love graphic novel, competitive videogames and cats.

You can find me on the internet with the nicknameMakhBeth - - Twitter GitHub LinkedIn

Page 3: Guidelines! sorry guys you have to!

Let's startMEOW

Page 4: Guidelines! sorry guys you have to!

Before we start...

A question

Page 5: Guidelines! sorry guys you have to!

Do you ever work alone?

WRONG

Page 6: Guidelines! sorry guys you have to!

You will never work alone

Page 7: Guidelines! sorry guys you have to!

What is a guideline?(a.k.a. code styleguide)

A styleguide is not just a pleasing document to read,picturing an ideal state for your code. It is a key documentin a project’s life, describing how and why code should be

written.

Hugo Giraudel

Page 8: Guidelines! sorry guys you have to!

Basically you have to choice if write something like that

var named = function named() { return true; };

or:

var named = function named() {return true};

Page 9: Guidelines! sorry guys you have to!

It's not onlyAESTHETIC

(Also but not only)

Page 10: Guidelines! sorry guys you have to!

A strong code design is more readable!

/* in a file far far away */ @mixin visually-hidden { border: 0; clip: rect(0 0 0 0); height: 1px; width: 1px; margin: -1px; overflow: hidden; padding: 0; position: absolute; }

/* somewhere in your code */ .pippo { @include visually-hidden(); }

.pluto { @include visually-hidden; }

Page 11: Guidelines! sorry guys you have to!

A real example: Airbnb

// bad - unnecessary function call function() { var name = getName(); if (!arguments.length) { return false; } this.setFirstName(name); return true; }

// good function() { var name; if (!arguments.length) { return false; } name = getName(); this.setFirstName(name); return true; }

Page 12: Guidelines! sorry guys you have to!

So, why a guideline?Let's see, with some cat examples!

Taken from 's Harry Roberts CSS Guidelines

Page 13: Guidelines! sorry guys you have to!

build and maintain products for areasonable length of time;

Page 14: Guidelines! sorry guys you have to!

have developers of differingabilities and specialties;

Page 15: Guidelines! sorry guys you have to!

have a number of differentdevelopers working on a productat any given time;

Page 16: Guidelines! sorry guys you have to!

on-board new staff regularly;

Page 17: Guidelines! sorry guys you have to!

have a number of codebases thatdevelopers dip in and out of.

Page 18: Guidelines! sorry guys you have to!

Ok, you convinced me...

... but NOW?

Page 19: Guidelines! sorry guys you have to!

DO. OR DO NOT.

THERE IS NO TRY.Platone

Page 20: Guidelines! sorry guys you have to!

Yeah, but howabout the

cost?

Page 21: Guidelines! sorry guys you have to!

You don't have to start from scratch!Airbnb styleguideCSS TRICKSSass GuidelinesGoogle Styleguide

Page 22: Guidelines! sorry guys you have to!

Let's see something real!

SassGuidelines

Page 23: Guidelines! sorry guys you have to!

Next step?Why not setup a Linter?

Page 24: Guidelines! sorry guys you have to!

What is a linter?

The linter is the cat, the baby is a lazy programmer!

Page 25: Guidelines! sorry guys you have to!

Questions?