bringing the ruby language into the mobile world

115
Bringing the Ruby language into the mobile world RUBYMOTION

Upload: laurent-sansonetti

Post on 02-Jul-2015

1.074 views

Category:

Software


0 download

DESCRIPTION

Presentation given at RubyWorld 2014 (Matsue, Japan), a business conference about the Ruby programming language. Slides in Japanese / English. Sample code: https://github.com/lrz/rubymotion-hybrid-sample

TRANSCRIPT

Page 1: Bringing the Ruby language into the mobile world

Bringing the Ruby language into the mobile world

RUBYMOTION

Page 2: Bringing the Ruby language into the mobile world

Laurent Sansonetti

Page 3: Bringing the Ruby language into the mobile world

Founder of HipByte (RubyMotion)

Page 4: Bringing the Ruby language into the mobile world

2001年から

Ruby信者ですI love Ruby since 2001

Page 5: Bringing the Ruby language into the mobile world

ここにいる皆さんもRuby信者ですよね

We are all here because we love Ruby

Page 6: Bringing the Ruby language into the mobile world
Page 7: Bringing the Ruby language into the mobile world

Rubyで優れている点は何でしょうか?

What is the best thing about Ruby?

Page 8: Bringing the Ruby language into the mobile world

文法が、The syntax

Page 9: Bringing the Ruby language into the mobile world

パワフルで簡潔なことConcise, yet powerful

Page 10: Bringing the Ruby language into the mobile world

初心者が学ぶのが 簡単なこと

Easy enough to learn for beginners

Page 11: Bringing the Ruby language into the mobile world

柔軟性があることFlexible enough for advanced use

Page 12: Bringing the Ruby language into the mobile world

Some may say Ruby is a bad rip-off of Lisp or Smalltalk, and I admit that. But it is nicer to

ordinary people. !

— matz

Page 13: Bringing the Ruby language into the mobile world

Ruby文法を最も活用しているものは何でしょう?

What is the best use of the Ruby syntax?

Page 14: Bringing the Ruby language into the mobile world

DSLs

Page 15: Bringing the Ruby language into the mobile world

Domain Specific Languages

Page 16: Bringing the Ruby language into the mobile world

特定機能を高いレベルで抽象化します

Wrap a particular functionality into a higher-level abstraction

Page 17: Bringing the Ruby language into the mobile world

抽象化された機能は 自然なインタフェースで

記述できますThe abstraction becomes a natural

language interface

Page 18: Bringing the Ruby language into the mobile world

より簡単に機能を利用できるようなります

The functionality can then be accessed more easily

Page 19: Bringing the Ruby language into the mobile world

Complex → Simple

Page 20: Bringing the Ruby language into the mobile world

Programmers → Happy

Page 21: Bringing the Ruby language into the mobile world

RubyはWeb開発で

とてもポピューラですRuby is very popular for

Web development

Page 22: Bringing the Ruby language into the mobile world

多くのWebアプリがRubyで書かれています

There are lots of Web apps written in Ruby

Page 23: Bringing the Ruby language into the mobile world

Twitter, Github, Basecamp, etc.

Page 24: Bringing the Ruby language into the mobile world

なぜでしょう?Why so?

Page 25: Bringing the Ruby language into the mobile world

Ruby on Rails

Page 26: Bringing the Ruby language into the mobile world

RailsはWeb開発用の

Ruby製フレームワークRails is a Ruby framework for

Web development

Page 27: Bringing the Ruby language into the mobile world

RailsはWeb開発を容易にしました

Rails makes Web development easier

Page 28: Bringing the Ruby language into the mobile world

RailsはWebテクノロジーに特化したDSLです

Rails is a DSL for Web technologies

Page 29: Bringing the Ruby language into the mobile world

Complex → Simple

Page 30: Bringing the Ruby language into the mobile world

Programmers → Happy

Page 31: Bringing the Ruby language into the mobile world

Change

Page 32: Bringing the Ruby language into the mobile world

現在、モバイルデバイスはPCシェアを奪っています

Mobile devices are now replacing personal computers

Page 33: Bringing the Ruby language into the mobile world

Source: http://ben-evans.com/benedictevans/2014/10/28/presentation-mobile-is-eating-the-world

Page 34: Bringing the Ruby language into the mobile world

PC → Phone / Tablet

Page 35: Bringing the Ruby language into the mobile world

Source: http://ben-evans.com/benedictevans/2014/10/28/presentation-mobile-is-eating-the-world

Page 36: Bringing the Ruby language into the mobile world

多くの人々は、ネットの閲覧などにモバイルデバイスを利

用していますMost people use mobile devices

to be connected

Page 37: Bringing the Ruby language into the mobile world

モバイルの世界では、2つの巨人がいます

Two major players in the mobile industry

Page 38: Bringing the Ruby language into the mobile world

Apple and Google

Page 39: Bringing the Ruby language into the mobile world

iOS and Android

Page 40: Bringing the Ruby language into the mobile world

0%

20%

40%

60%

80%

2012 2013

78.6%69%

15.2%18.7%

iOS Android

Smartphone Market Share

Source: © IDC (Jan 2014)

Page 41: Bringing the Ruby language into the mobile world

0%

18%

35%

53%

70%

2012 2013

61.9%

45.8%

36%

52.8%

iOS Android

Tablet Market Share

Source: © Gartner (March 2014)

Page 42: Bringing the Ruby language into the mobile world

モバイルマーケットのほぼすべてがiOSとAndroidです

Almost all of the mobile market is iOS and Android

Page 43: Bringing the Ruby language into the mobile world

デバイスは20億以上+2 billion devices combined

Page 44: Bringing the Ruby language into the mobile world

モバイルデバイスはアプリを実行できます

Mobile devices run apps

Page 45: Bringing the Ruby language into the mobile world

Webアプリの技術を利用し、アプリを開発できます

It is possible to write mobile apps using Web technologies

Page 46: Bringing the Ruby language into the mobile world

しかし、エンドユーザは ネイティブなモバイルアプリ

を好みますBut end users prefer using

native mobile apps

Page 47: Bringing the Ruby language into the mobile world

ネイティブアプリは、iOSやAndroidのSDK APIを使用し開発

されますNative apps are written using the

platform SDK APIs

Page 48: Bringing the Ruby language into the mobile world

ネイティブアプリはより良いUXを提供します

Native apps provide a better user experience

Page 49: Bringing the Ruby language into the mobile world

ネイティブアプリは軽快に動作します

Native apps are faster

Page 50: Bringing the Ruby language into the mobile world

Facebook released major upgrades to its iPhone and iPad apps. Those who have suffered from the sluggishness of the current apps can breathe a collective sigh of relief: these new versions are much faster. !The apps look nearly identical to their predecessors. The main difference is that most of their old Web-based code has been replaced with the native programming code used for iOS, Apple’s mobile operating system. !New York Times, August 23, 2012Source: http://bits.blogs.nytimes.com/2012/08/23/facebook-iphone-ipad/

Page 51: Bringing the Ruby language into the mobile world

We have definitely shifted from HTML5 to native. The primary reason for that is, we’re seeing that more and more people are spending more time in the app, and the app is running out of memory. […] !The second reason we’ve gone native is trying to get some of the animations — the spinners and the way they work — getting that smoothness, we felt like we needed native to really do that well. !Venture Beat, April 17, 2013Source: http://venturebeat.com/2013/04/17/linkedin-mobile-web-breakup

Page 52: Bringing the Ruby language into the mobile world

現在、ネイティブなモバイルアプリ開発は分断化されてい

ますThe current state of native mobile

development is fragmented

Page 53: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS Objective-C Swift Xcode iOS SDK

Android Java Android Studio Android SDK

Page 54: Bringing the Ruby language into the mobile world

異なる二つの開発言語Two different languages

Page 55: Bringing the Ruby language into the mobile world

コードの共有は 困難

Difficult to share code

Page 56: Bringing the Ruby language into the mobile world

異なる二つのIDETwo different IDEs

Page 57: Bringing the Ruby language into the mobile world

開発の効率が悪いDifficult to be efficient

Page 58: Bringing the Ruby language into the mobile world

どうにか簡単にすることができないでしょうか?

Can we make this simpler?

Page 59: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS Objective-C / Swift Xcode iOS SDK

Android Java Android Studio Android SDK

Page 60: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS

Ruby

Xcode iOS SDK

Android Android Studio Android SDK

Page 61: Bringing the Ruby language into the mobile world

共通言語としてのRubyRuby as a common platform language

Page 62: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS

Ruby

Xcode iOS SDK

Android Android Studio Android SDK

Page 63: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS

Ruby Your favorite editor

iOS SDK

Android Android SDK

Page 64: Bringing the Ruby language into the mobile world

開発者はテキストエディタにこだわりがあります

Developers have strong opinions regarding text editors

Page 65: Bringing the Ruby language into the mobile world

開発者には好きなエディタを使用していただきましょう

Let’s make them use the editor they like

Page 66: Bringing the Ruby language into the mobile world
Page 67: Bringing the Ruby language into the mobile world

RUBYMOTION

Page 68: Bringing the Ruby language into the mobile world

Rubyで、iOSとAndroidのネイティブアプリを開発できます

Write iOS and Android native apps in Ruby

Page 69: Bringing the Ruby language into the mobile world

iOS向けのRubyの実装Implementation of Ruby for iOS

Page 70: Bringing the Ruby language into the mobile world

RubyMotion Objective-C

Objective-C Runtime

iOS / OS X

Page 71: Bringing the Ruby language into the mobile world

iOS APIをネイティブに呼び出します

Call into the native iOS APIs natively

Page 72: Bringing the Ruby language into the mobile world

ブリッジでは ありません

Not a bridge

Page 73: Bringing the Ruby language into the mobile world

iOS Hello Worldclass AppDelegate def application(application, didFinishLaunchingWithOptions:options) label = UILabel.new label.text = "Hello World!" label.sizeToFit! viewController = UIViewController.new viewController.view.backgroundColor = UIColor.whiteColor label.center = viewController.view.center viewController.view.addSubview(label)! frame = UIScreen.mainScreen.applicationFrame @window = UIWindow.alloc.initWithFrame(frame) @window.rootViewController = viewController @window.makeKeyAndVisible! true endend

Page 74: Bringing the Ruby language into the mobile world

iOS Hello Worldclass AppDelegate def application(application, didFinishLaunchingWithOptions:options) label = UILabel.new label.text = "Hello World!" label.sizeToFit! viewController = UIViewController.new viewController.view.backgroundColor = UIColor.whiteColor label.center = viewController.view.center viewController.view.addSubview(label)! frame = UIScreen.mainScreen.applicationFrame @window = UIWindow.alloc.initWithFrame(frame) @window.rootViewController = viewController @window.makeKeyAndVisible! true endend

Page 75: Bringing the Ruby language into the mobile world

Android向けの

Rubyの実装Implementation of Ruby for Android

Page 76: Bringing the Ruby language into the mobile world

RubyMotion

Java

Dalvik / ART

Android

Java Native Interface

Page 77: Bringing the Ruby language into the mobile world

Android APIをネイティブに呼び出します

Call into the native Android APIs natively

Page 78: Bringing the Ruby language into the mobile world

ブリッジでは ありません

Not a bridge

Page 79: Bringing the Ruby language into the mobile world

Android Hello Worldclass MainActivity < Android::App::Activity def onCreate(savedInstanceState) super! text = Android::Widget::TextView.new(self) text.text = 'Hello RubyMotion!' self.contentView = text endend

Page 80: Bringing the Ruby language into the mobile world

Android Hello Worldclass MainActivity < Android::App::Activity def onCreate(savedInstanceState) super! text = Android::Widget::TextView.new(self) text.text = 'Hello RubyMotion!' self.contentView = text endend

Page 81: Bringing the Ruby language into the mobile world

RubyMotionは、アプリを静的コンパイルします

RubyMotion apps are statically compiled

Page 82: Bringing the Ruby language into the mobile world
Page 83: Bringing the Ruby language into the mobile world

Com

pila

tion

Machine Code

Assembly

LLVM IR

AST

Ruby File

Page 84: Bringing the Ruby language into the mobile world

アプリは機械語に変換されたバイナリになります

RubyMotion apps are machine-code binaries

Page 85: Bringing the Ruby language into the mobile world

インタプリタでは ありません

No interpreter

Page 86: Bringing the Ruby language into the mobile world

RubyMotionは成功したエコシステムです

RubyMotion is a successful ecosystem

Page 87: Bringing the Ruby language into the mobile world

チームで開発していますDeveloped by a team of thought

leaders

Page 88: Bringing the Ruby language into the mobile world

Team

Page 89: Bringing the Ruby language into the mobile world

Team

Page 90: Bringing the Ruby language into the mobile world

2012年に着手しましたLaunched in 2012

Page 91: Bringing the Ruby language into the mobile world

数千の顧客Thousands of customers

Page 92: Bringing the Ruby language into the mobile world

多くのRubyMotion 製のアプリがリリースされています

Lots of RubyMotion apps in production

Page 93: Bringing the Ruby language into the mobile world

Bandcamp

RubyMotion lets us write the Bandcamp app without that

dirty feeling you get from fooling around with Xcode.

!Like the best tools, it makes the

hard things easy. !

Daniel Dickison

Page 94: Bringing the Ruby language into the mobile world

Frontback

With RubyMotion, it’s easier to get on board. Every line you write is needed application logic, nothing more.The fact you don’t have to use XCode is a big win. !Melvyn Hills

Page 95: Bringing the Ruby language into the mobile world

A Dark Room

Idiomatic Ruby wrappers on top of iOS, frictionless workflows, and

the “it just works” culture that Ruby fosters, trumps any

hesitation I once had with RubyMotion.

!Amir Rajan

Page 96: Bringing the Ruby language into the mobile world

今後のRubyMotionアプリ開発について少し紹介します

Let’s have a glimpse of the future of RubyMotion app development

Page 97: Bringing the Ruby language into the mobile world

ハイブリッドな プロジェクトになります

The future is hybrid projects

Page 98: Bringing the Ruby language into the mobile world

アプリのプロジェクトはiOSとAndroid両方を対象

Projects that work on both iOS and Android

Page 99: Bringing the Ruby language into the mobile world

ひとつのコードベースOne codebase

Page 100: Bringing the Ruby language into the mobile world

プラットフォームに依存したコードをなくします

Isolate platform-specific code

Page 101: Bringing the Ruby language into the mobile world

ポータブルに抽象化したDSLを使用します

Use portable high-level abstractions (DSLs)

Page 102: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS

Ruby Your favorite editor

iOS SDK

Android Android SDK

Page 103: Bringing the Ruby language into the mobile world

Language IDE APIs

iOS

Ruby Your favorite editor

Community DSLs

Android

Page 104: Bringing the Ruby language into the mobile world

Demo

Page 105: Bringing the Ruby language into the mobile world

まとめConclusion

Page 106: Bringing the Ruby language into the mobile world

ネイティブなモバイルアプリ開発は分断化されていますMobile development is fragmented

Page 107: Bringing the Ruby language into the mobile world

RubyMotionは独自の技術を提供し、開発をより簡単にします

RubyMotion makes it easier by providing a unique experience

Page 108: Bringing the Ruby language into the mobile world

開発言語はひとつですOne language

Page 109: Bringing the Ruby language into the mobile world
Page 110: Bringing the Ruby language into the mobile world

開発環境はひとつですOne development environment

Page 111: Bringing the Ruby language into the mobile world
Page 112: Bringing the Ruby language into the mobile world

ポータブルに抽象化したDSL

Portable high-level abstractions (DSLs)

Page 113: Bringing the Ruby language into the mobile world

Complex → Simple

Page 114: Bringing the Ruby language into the mobile world

Programmers → Happy

Page 115: Bringing the Ruby language into the mobile world

ありがとうございます@rubymotion

[email protected] rubymotion.com

Thank you!