creating a responsive website from scratch

54
Creating a Responsive Website From Scratch

Upload: corky-brown

Post on 18-Aug-2015

35 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Creating a Responsive Website From Scratch

Creating a Responsive Website From Scratch

Page 2: Creating a Responsive Website From Scratch

Creating a Responsive Website From Scratch

• Corky Brown – Application Architect; ~9 years at MeetMe.com; back- and front-end development

• Javier Barreto – Web developer; 8 years; mostly back-end, more recently front-end

• Bill Sykes – Web developer; new to MeetMe, 10 years experience back- and front-end

Page 3: Creating a Responsive Website From Scratch

Creating a Responsive Website From Scratch

Page 4: Creating a Responsive Website From Scratch
Page 5: Creating a Responsive Website From Scratch
Page 6: Creating a Responsive Website From Scratch
Page 7: Creating a Responsive Website From Scratch
Page 8: Creating a Responsive Website From Scratch
Page 9: Creating a Responsive Website From Scratch
Page 10: Creating a Responsive Website From Scratch
Page 11: Creating a Responsive Website From Scratch

Something’s missing…• User has a smartphone

• First time visiting meetme.com

• Does not want the native app

• Cannot install the native app

Page 12: Creating a Responsive Website From Scratch
Page 13: Creating a Responsive Website From Scratch

Why?• Users get…

• Modern, native-ish experience • Feature parity with native apps

• MeetMe gets… • Better engagement • Better monetization • Feature parity with native apps • Single server-side API • Work off-loaded to the clients

Page 14: Creating a Responsive Website From Scratch

Everybody wins!

Page 15: Creating a Responsive Website From Scratch

What’s the catch?

Page 16: Creating a Responsive Website From Scratch
Page 17: Creating a Responsive Website From Scratch
Page 18: Creating a Responsive Website From Scratch

“Responsive website”

Phoenix

Page 19: Creating a Responsive Website From Scratch
Page 20: Creating a Responsive Website From Scratch

“From scratch”

Page 21: Creating a Responsive Website From Scratch
Page 22: Creating a Responsive Website From Scratch

6 months later…

Page 23: Creating a Responsive Website From Scratch
Page 24: Creating a Responsive Website From Scratch

Why make it from scratch?

• Current website is years upon years of legacy code.

• Easier to work with new libraries and tools

• Great chance to reimagine our entire development process

• Development will be fasterPhoenix

Page 25: Creating a Responsive Website From Scratch

Goals• One website to manage – mobile, desktop, in between

• Many servers -> one (redundant) server + CDN

• Use Mobile API

• Leverage open source community

• Support smartphone browser+OS+device combinations that use MeetMe

• Organize into releases Phoenix

Page 26: Creating a Responsive Website From Scratch

Organize Into Releases

• Better tracking of bugs & features historically

• Keeps team focused

• Brings us in-line with the native mobile apps

• Use semantic versioning (semver.org)

Phoenix

Page 27: Creating a Responsive Website From Scratch

Focuses

Page 28: Creating a Responsive Website From Scratch

Focuses• Support as many users as quickly as possible

• Fast development

• Well-scoped code

• Documentation

• Standards

• Testing

• Automated builds

Page 29: Creating a Responsive Website From Scratch

Support as many users as quickly as possible

• Focus on top browser & OS (Chrome on Android) first, ignore others.

• Gamble: one browser will give us a great foundation for the next and it should get easier as we go along (more on this later).

Page 30: Creating a Responsive Website From Scratch

Fast Development

• Get end-to-end as soon as possible, optimize going forward

• Dev -> Staging -> Production

• As we optimize this workflow and add tests, we can push faster

Page 31: Creating a Responsive Website From Scratch

Well-Scoped Code

• Let good code thrive

• Minimize scope of compromises

• Feature and bug detection, not browser detection

Page 32: Creating a Responsive Website From Scratch

Documentation

• jsdoc

• auto-generate

• require in code review

Page 33: Creating a Responsive Website From Scratch

Standards• Style

• Best practices

• Pick an existing standard

• jslint/jshint

• Google’s docs for style and annotation

Page 34: Creating a Responsive Website From Scratch

Testing

• Unit tests (jasmine + karma)

• Behavior tests (cucumber + ruby or js)

• Builds auto-generated for QA at URL (with QR code from http://goqr.me/)

Page 35: Creating a Responsive Website From Scratch

Automated Builds

• Continuous Integration

• Jenkins CI (jenkins-ci.org)

• Grunt.js (gruntjs.com)

Page 36: Creating a Responsive Website From Scratch

Non-Focuses

Page 37: Creating a Responsive Website From Scratch

Non-Focuses

• Clients that we don’t support

• Performance (to a degree)

• SEO

Page 38: Creating a Responsive Website From Scratch

Performance• (to a degree)

• Trust that QA will report performance issues (and they did)

• Devices we are targeting can handle what we’re doing (nothing too intensive)

• Browsers and OSes dedicate a lot to JS and CSS processing

Page 39: Creating a Responsive Website From Scratch

SEO

• Common problem for “single page dynamic websites”.

• Our current mobile site is crawled & “Mobile-friendly”, according to Google. We redirect supported clients from there to touch.meetme.com.

• We can skip and revisit later

Page 40: Creating a Responsive Website From Scratch

Principles & Practices

Page 41: Creating a Responsive Website From Scratch

Principles & Practices

• Well-scoped code

• Leverage third-party and open source libraries and tools (Bill)

• Tools for responsive and mobile web development (Javier)

Page 42: Creating a Responsive Website From Scratch

Well-Scoped Coderequirejs or equivalent (browserify)

// js/lib/models/member/MemberPrivacyModel.js define([‘lodash', 'Backbone'], function(_, Backbone) { 'use strict’;

return function() { // };});

Page 43: Creating a Responsive Website From Scratch

Well-Scoped CodeSay What You Do

(Not Why You Do It) (And Not How You Do It)

// js/lib/helpers/RequestHelper.js var errorsToHandle = { 'MemberException' : { 'code_1' : displayLoginModal }, // };

Page 44: Creating a Responsive Website From Scratch

Well-Scoped CodeSay What You Do

(Not Why You Do It) (And Not How You Do It)

// js/lib/helpers/RequestHelper.js var errorsToHandle = { 'MemberException' : { 'code_1' : requestUserAuthentication }, // };

Page 45: Creating a Responsive Website From Scratch

Well-Scoped CodeDo it the “right” way first (HTML5 and community accepted) Keep “fixes” in one function or variable and gracefully fall back

http://caniuse.com/#feat=flexbox

Page 46: Creating a Responsive Website From Scratch

Well-Scoped CodeDo it the “right” way first (HTML5 and community accepted) Keep “fixes” in one function or variable and gracefully fall back

// less/mixins/flex.less .flex-display { display: -webkit-flex; display: -moz-flex; display: -ms-flex; display: -o-flex; display: flex;}

Page 47: Creating a Responsive Website From Scratch

Well-Scoped CodeDo it the “right” way first (HTML5 and community accepted)Keep “fixes” in one function or variable and gracefully fall back

Detect bugs and features, not browsers and devices (modernizr.com)

When the browser or device manufacturer fixes the bug, your code should still work

Page 48: Creating a Responsive Website From Scratch

Third-Party, Open Source• Bootstrap (getbootstrap.com) – responsive UI

• Backbone (backbonejs.org) – models, collections, views, router

• Lodash (lodash.com) – utility library

• Grunt (gruntjs.com) – task runner

• LESS (lesscss.org) – dynamic CSS

• Handlebars (handlebarsjs.com) – templating

• requirejs (requirejs.org) – module & scope management

Page 49: Creating a Responsive Website From Scratch

Leverage third-party and open source libraries and

tools (Bill)

Page 50: Creating a Responsive Website From Scratch

Tools for responsive and mobile web development

(Javier)

Page 51: Creating a Responsive Website From Scratch

Lessons

Page 52: Creating a Responsive Website From Scratch

Lessons

• Browsers: quirkier than we imagined

• Some bugs cannot be detected (or not easily). Treat as though you did detect it!

• Can’t reliably detect device

Page 53: Creating a Responsive Website From Scratch

The Future• Revisit

• SEO

• Render on server first (Rendr, et al.)

• File size & number of requests

• Performance

• Improvements

• React

Page 54: Creating a Responsive Website From Scratch

Questions?