67
Life Beyond Rails Building Cross Platform Applications

Life Beyond Rails: Creating Cross Platform Ruby Apps

Embed Size (px)

Citation preview

Page 1: Life Beyond Rails: Creating Cross Platform Ruby Apps

Life Beyond RailsBuilding Cross Platform Applications

Page 2: Life Beyond Rails: Creating Cross Platform Ruby Apps

DEMO

Page 3: Life Beyond Rails: Creating Cross Platform Ruby Apps

@parasquidChief Problem Solver

at Mindvalley

Page 4: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 5: Life Beyond Rails: Creating Cross Platform Ruby Apps

Why not Ruby on the browser and on

mobile?

Page 6: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 7: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 8: Life Beyond Rails: Creating Cross Platform Ruby Apps

Dead end product

Page 9: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 10: Life Beyond Rails: Creating Cross Platform Ruby Apps

So what if voyager can go to Mars, or dive in the ocean

So what if your hackathon was written in JS that runs on both server and client

So what if your legacy code was written in Ruby (cross platform!)

Page 11: Life Beyond Rails: Creating Cross Platform Ruby Apps

Can you reuse a significant portion of the code you wrote?

Page 12: Life Beyond Rails: Creating Cross Platform Ruby Apps

Cross platform is useless if your code

can't be reused.

Page 13: Life Beyond Rails: Creating Cross Platform Ruby Apps

Reuse of prior work across multiple platforms is the

biggest reason why you want cross platform support

Page 14: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 15: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 16: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 17: Life Beyond Rails: Creating Cross Platform Ruby Apps

“cross platform” is mostly solved in the

physical world

Page 18: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 19: Life Beyond Rails: Creating Cross Platform Ruby Apps

cable

usb powerbank

usb camera

usb phone

usb ereader

Page 20: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 21: Life Beyond Rails: Creating Cross Platform Ruby Apps

• How does this work?

• Which things can I use this with?

• What can this do?

Page 22: Life Beyond Rails: Creating Cross Platform Ruby Apps

• How does this work?

• Which things can I use this with?

• What can this do?Encapsulation

Polymorphism

Page 23: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 24: Life Beyond Rails: Creating Cross Platform Ruby Apps

(DESCRIPTOR)

Page 25: Life Beyond Rails: Creating Cross Platform Ruby Apps

• open()• close()• read()• write()• seek()

Page 26: Life Beyond Rails: Creating Cross Platform Ruby Apps

You’re not a beautiful or unique snowflake.-Tyler Durden, Fight Club

Page 27: Life Beyond Rails: Creating Cross Platform Ruby Apps

–Linus Torvalds

“Use common tools tooperate on different things.”

Page 28: Life Beyond Rails: Creating Cross Platform Ruby Apps

principle: common tools operating on different things

technique: polymorphism

Page 29: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 30: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 31: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 32: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 33: Life Beyond Rails: Creating Cross Platform Ruby Apps

Surface Area of the API is small

Page 34: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 35: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 36: Life Beyond Rails: Creating Cross Platform Ruby Apps

principle: information hiding

technique: encapsulation

Page 37: Life Beyond Rails: Creating Cross Platform Ruby Apps

Oooh. But I already know OOP.

Page 38: Life Beyond Rails: Creating Cross Platform Ruby Apps

OOP is about programming with

objects

Page 39: Life Beyond Rails: Creating Cross Platform Ruby Apps

OOP is about programming with

objects

Page 40: Life Beyond Rails: Creating Cross Platform Ruby Apps

OOP is about the organization of your

program

Page 41: Life Beyond Rails: Creating Cross Platform Ruby Apps

• Procedural• Object Oriented• Functional• Prototype based• Rails-way based• Hybrid / Combination

How are things

connected?

Page 42: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 43: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 44: Life Beyond Rails: Creating Cross Platform Ruby Apps

Rails is omakase.I [am] … the head chef of the

omakase experience that is Rails-DHH

Page 45: Life Beyond Rails: Creating Cross Platform Ruby Apps

To Rails or not to Rails

Page 46: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 47: Life Beyond Rails: Creating Cross Platform Ruby Apps

–Kent Beck

In a connected system, elements are highly available to each other (via global

state, for example). Adding the first feature to a connected system is cheap. All the resources you need are available.

However, the cost of all those connections is that subsequent features are very likely to interact with previous features, driving

up the cost of development over time.

Page 48: Life Beyond Rails: Creating Cross Platform Ruby Apps

–Kent Beck

A modular design has connections deliberately kept to a minimum. The cost for the first feature is likely to be higher than in the connected system, because

you need to find the necessary resources and bring them together, possibly re-

modularizing in the process. Features are much less likely to interact in a modular

system, though, leading to a steady stream of features at relatively constant

cost.

Page 49: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 50: Life Beyond Rails: Creating Cross Platform Ruby Apps

Stay on the connected curve until the climb phase, then switch to the

modular curve.Kent Beck

Page 51: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 52: Life Beyond Rails: Creating Cross Platform Ruby Apps

App

Rails

request-response

Page 53: Life Beyond Rails: Creating Cross Platform Ruby Apps

App

TelnetWeb sockets

streaming

Page 54: Life Beyond Rails: Creating Cross Platform Ruby Apps

App

RubyMotion

mobile

Page 55: Life Beyond Rails: Creating Cross Platform Ruby Apps

App

Opal

browser

Page 56: Life Beyond Rails: Creating Cross Platform Ruby Apps

App

mRuby

hardware

Page 57: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 58: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 59: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 60: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 61: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 62: Life Beyond Rails: Creating Cross Platform Ruby Apps
Page 63: Life Beyond Rails: Creating Cross Platform Ruby Apps

Programming is the act of managing

complexity.

Page 64: Life Beyond Rails: Creating Cross Platform Ruby Apps

Programming is the act of managing

complexity.

Page 65: Life Beyond Rails: Creating Cross Platform Ruby Apps

Programming is the act of managing

complexity.

Page 66: Life Beyond Rails: Creating Cross Platform Ruby Apps

Write flexible, maintainable,reusable code

Page 67: Life Beyond Rails: Creating Cross Platform Ruby Apps

@parasquidChief Problem Solver

at Mindvalley