bayjax: expanding yahoo! axis across 3 screens

66
Caridy Patino Principal Frontend at Yahoo! Search YUI Evangelist Mojito Ambassador [email protected] @caridy

Upload: caridy-patino

Post on 25-Dec-2014

1.769 views

Category:

Technology


0 download

DESCRIPTION

Axis (codename SearchX) has been a pure joy for our team to work on. It is one of the first projects at Yahoo! that runs on the new stack provided by the Cocktails infrastructure. Expanding Axis for iPad, iPhone and all four major desktop browsers from day one, and using the brand new Mojito Application Framework has been a unique experience and today we want to walk you through some of the architecture decisions and lessons learned while trying to choose between a variety of choices like Hybrid vs Native vs Web. The paths we chose to achieve the level of maintainability and scalability required for such a large scale project, some of the UI optimizations we did along the way.

TRANSCRIPT

Page 1: BayJax: Expanding Yahoo! Axis across 3 screens

Caridy PatinoPrincipal Frontend at Yahoo! SearchYUI EvangelistMojito Ambassador

[email protected]@caridy

Page 2: BayJax: Expanding Yahoo! Axis across 3 screens

Expanding Yahoo! Axis across 3 screens

Page 3: BayJax: Expanding Yahoo! Axis across 3 screens

Axis(codename SearchX)

Page 4: BayJax: Expanding Yahoo! Axis across 3 screens

?

From day one:

iPhone/iPad/Desktop

Page 5: BayJax: Expanding Yahoo! Axis across 3 screens

Build mobile products on top of platforms designed primarily for

mobile products

Page 6: BayJax: Expanding Yahoo! Axis across 3 screens
Page 7: BayJax: Expanding Yahoo! Axis across 3 screens

Yahoo! Cocktails is set to become the de facto infrastructure for mobile applications at Yahoo!

Page 8: BayJax: Expanding Yahoo! Axis across 3 screens

Yahoo! Cocktails Umbrella

Page 9: BayJax: Expanding Yahoo! Axis across 3 screens

Mojito JavaScript Application Framework

http://github.com/yahoo/mojito

Page 10: BayJax: Expanding Yahoo! Axis across 3 screens

ManhattanHosting infrastructure for Node.js applications.

Page 11: BayJax: Expanding Yahoo! Axis across 3 screens

Manhattan Stack

Page 12: BayJax: Expanding Yahoo! Axis across 3 screens

Mojito ShakerShaker is a static asset rollup manager for Mojito applications.

http://github.com/yahoo/mojito-shaker

Page 13: BayJax: Expanding Yahoo! Axis across 3 screens

Axisthe making

Page 14: BayJax: Expanding Yahoo! Axis across 3 screens

"write once, deploy everywhere"

Page 15: BayJax: Expanding Yahoo! Axis across 3 screens

Can you imagine a car that works exceptionally well under any condition?

Page 16: BayJax: Expanding Yahoo! Axis across 3 screens

"write once, deploy everywhere"

Page 17: BayJax: Expanding Yahoo! Axis across 3 screens

"divide & conquer"

Page 18: BayJax: Expanding Yahoo! Axis across 3 screens
Page 19: BayJax: Expanding Yahoo! Axis across 3 screens
Page 20: BayJax: Expanding Yahoo! Axis across 3 screens

Analyze each piece individually

Page 21: BayJax: Expanding Yahoo! Axis across 3 screens

vs

Native Web

Page 22: BayJax: Expanding Yahoo! Axis across 3 screens

+

Native Web

Page 23: BayJax: Expanding Yahoo! Axis across 3 screens

vs

Compiled Web-based

Page 24: BayJax: Expanding Yahoo! Axis across 3 screens

vs

$ mojito build $ mojito start

Page 25: BayJax: Expanding Yahoo! Axis across 3 screens

vs vs

... then for each piecedecide between:

Native Compiled Web-based

Page 26: BayJax: Expanding Yahoo! Axis across 3 screens

Where to put the shared logic?

Page 27: BayJax: Expanding Yahoo! Axis across 3 screens

REUSEREDUCERECYCLEREPLACE

Page 28: BayJax: Expanding Yahoo! Axis across 3 screens

How to connect those pieces together?

“Y.CL”

Page 29: BayJax: Expanding Yahoo! Axis across 3 screens

Pros and Cons

Page 30: BayJax: Expanding Yahoo! Axis across 3 screens

Reduce fragmentation

Page 31: BayJax: Expanding Yahoo! Axis across 3 screens

No need to issue an app update

Page 32: BayJax: Expanding Yahoo! Axis across 3 screens

Some webviews might need to berefreshed when restoring the app

Page 33: BayJax: Expanding Yahoo! Axis across 3 screens

Easy to ramp-up for web developers

Page 34: BayJax: Expanding Yahoo! Axis across 3 screens

Ideal for experiment-driven development

http://www.bluefountainmedia.com/blog/how-to-be-successful-using-ab-and-multivariate-testing/

Page 35: BayJax: Expanding Yahoo! Axis across 3 screens

It is all about control

Page 36: BayJax: Expanding Yahoo! Axis across 3 screens

Network failures need to be controlled

Page 37: BayJax: Expanding Yahoo! Axis across 3 screens

http://blog.mobtest.com/2012/05/heres-why-the-facebook-ios-app-is-so-bad-uiwebviews-and-no-nitro/

Initialization needs to be controlled

Page 38: BayJax: Expanding Yahoo! Axis across 3 screens

A WebView loading remote contentis not first class citizen in iOS

Page 39: BayJax: Expanding Yahoo! Axis across 3 screens

Loading over the network is still easier and safer than stepping into the gray area of

auto-upgrading HTML5 apps

Page 40: BayJax: Expanding Yahoo! Axis across 3 screens

Optimization vs Adaptation

Page 41: BayJax: Expanding Yahoo! Axis across 3 screens

Optimization vs AdaptationAnalogy

Page 42: BayJax: Expanding Yahoo! Axis across 3 screens

Optimization in Mojito

Page 43: BayJax: Expanding Yahoo! Axis across 3 screens

Performance as a product feature

Page 44: BayJax: Expanding Yahoo! Axis across 3 screens

Optimization in Mojito is about customizing the way your product

behaves per runtime and per request.

Page 45: BayJax: Expanding Yahoo! Axis across 3 screens

It is about producing the right HTML, JS and CSS per runtime and per request.

Page 46: BayJax: Expanding Yahoo! Axis across 3 screens

Mojito Runtimes

Page 47: BayJax: Expanding Yahoo! Axis across 3 screens

Mojito Context

- Locale (en-US. pt-BR)- Environment (staging, qa, prod)- Device type (iphone, ipad)- Runtime (Server, Client)

- Network (AT&T, verizon)- CPU (low, medium, high)- Foo / Bar / Baz (???)

Page 48: BayJax: Expanding Yahoo! Axis across 3 screens

Optimize per context

Page 49: BayJax: Expanding Yahoo! Axis across 3 screens

/Mojits/Foo/definition.json

Page 50: BayJax: Expanding Yahoo! Axis across 3 screens

What to do in an event of a traffic surge?

Page 51: BayJax: Expanding Yahoo! Axis across 3 screens

/Mojits/Bar/definition.json

Page 52: BayJax: Expanding Yahoo! Axis across 3 screens

Control your dimensions in Mojito

Page 53: BayJax: Expanding Yahoo! Axis across 3 screens

/dimensions.json

Page 54: BayJax: Expanding Yahoo! Axis across 3 screens

Adaptation in Mojito

Page 55: BayJax: Expanding Yahoo! Axis across 3 screens

Adaptability as a product feature

Page 56: BayJax: Expanding Yahoo! Axis across 3 screens

Adaptation in Mojito is about customizing the UI per screen size, per connection speed, per feature

detection, etc.

Page 57: BayJax: Expanding Yahoo! Axis across 3 screens

It is about responsive UI

Page 58: BayJax: Expanding Yahoo! Axis across 3 screens

- YUI().use(‘cache-offline’)- Y.on(‘click’)- Y.on(‘orientationchange’)- Y.CL.on(‘query’)- Y.Foo

In Mojito, YUI covers a lot in terms of adaptation:

Page 59: BayJax: Expanding Yahoo! Axis across 3 screens

- Screen size (css media queries)- Orientation (landscape vs portrait)- Connection Speed (3G)- Memory (iOS memory warning)- Foo / Bar / Baz (???)

Adapt per:

Page 60: BayJax: Expanding Yahoo! Axis across 3 screens

Let’s recap

Page 61: BayJax: Expanding Yahoo! Axis across 3 screens

Axis runs on Yahoo! Cocktails

Page 62: BayJax: Expanding Yahoo! Axis across 3 screens

Axis is some sort of hybrid application composed of independent small native

and HTML5 apps

Page 63: BayJax: Expanding Yahoo! Axis across 3 screens

HTML5 parts were written on Yahoo! Mojito, an open source

application frameworkon top of YUI and Node.js

Page 64: BayJax: Expanding Yahoo! Axis across 3 screens

Axis leverages Mojito context to optimize and adapt those HTML5 parts

Page 65: BayJax: Expanding Yahoo! Axis across 3 screens

Axis leverages Y.CL as the main infrastructure to connect different parts

Page 66: BayJax: Expanding Yahoo! Axis across 3 screens

Thank you! @caridy