SlideShare una empresa de Scribd logo
1 de 65
Descargar para leer sin conexión
Put Your Dreams in
Motion
with Ruby
Vitaly Kushner
@vkushner
Monday, June 24, 13
Vitaly Kushner
programming since middle 80s
professionally since early 90s
Rails since 2005
founded Astrails in 2008
Monday, June 24, 13
Hello everybody, my name is Vitaly Kushner. I'm a co-founder of Astrails. A Ruby on Rails consulting company.
For the last 8 years we’ve been building web applications using Ruby on Rails, but this is not what I’m going to talk about
today.
For a while I didn't know what to talk about.
Rails
Monday, June 24, 13
Yet another Rails introduction?
http://www.flickr.com/photos/52462679@N06/5913851944
Monday, June 24, 13
Nah, everybody knows already that for most web applications Rails is the best tool for the job.
I wanted something more interesting.
So instead I decided to choose a topic that I'm much less of an expert in, actually not an expert at all, but
rather something that I'm currently learning and very excited about.
Rails
blog in 5 minutes
Monday, June 24, 13
In fact I’m as excited as I was back in 2005 when I saw for the first time the legendary "blog in
5 min" Rails screencast.
I remember when I saw it for the first time I decided right there that Rails will be the
framework for my next web project.
New Toy
shiny
Monday, June 24, 13
Recently I had a similar experience, and now I have a new shiny toy to play with.
http://www.flickr.com/photos/joriel/2839872192/sizes/l/
Monday, June 24, 13
So.. What am I going to talk about today?
Those of you that payed attention to the conference program already know, for the rest it will
be a pleasant surprise ;)
RubyMotion
Monday, June 24, 13
We are going to talk about RubyMotion. What is it, why and when would you want to use it
and when not, and how it compares to alternatives.
Purpose?
Monday, June 24, 13
But first I'd like to talk about the purpose of this talk.
We don't have much time, so we are not going to go into much technical details. But I'll be
very glad if at least some of you will come back to work or home and decide to try
RubyMotion for your next great app.
so…
I hate IDEs
seriously, they are all crap
Monday, June 24, 13
For a long time I wanted to develop for iOS and OS X, and I even started to go through the
tutorials a couple of times, but I got frustrated every time. I got spoiled by the ruby
ecosystem, toolset and development process. To the point that dealing with the archaic  
IDE was too much of a pain and  in some ways reminded me of the bad days of my Windows
GUI programming.
Google for 'Xcode sucks' and you will find tens of thousands of people that agree with me.
Whenever I tried to follow Xcode tutorials, at some stage Xcode would just freeze and refuse
to continue. There is no need to bash Apple here though, the same shit happens with Eclipse
and any other IDS  there is. They are just too big and complex to reliably work and allow me
to understand exactly what they do. They impose workflow on you that you can't change to
suit your needs.
So, frustrated, I've put away the iOS tutorials for a while.
And then I saw the RubyMotion screencast and I immediately felt the excitement that
reminded me of my first days of Rails.
What is RubyMotion?
Monday, June 24, 13
What is RubyMotion?
"RubyMotion is a revolutionary toolchain
that lets you quickly develop and test
native iOS and OS X applications for
iPhone, iPad and Mac, all using the
awesome Ruby language you know and
love."
Monday, June 24, 13
"RubyMotion is a revolutionary toolchain that lets you quickly develop and test native iOS and
OS X applications for iPhone, iPad and Mac, all using the awesome Ruby language you know
and love."
Why RubyMotion?
Monday, June 24, 13
So why would you want to use RubyMotion instead of Objective C?
There are several reasons, but there is no a single killer feature. Instead the whole approach
to development and workflow is what makes RubyMotion so special. Its not the features, its
how it feels to build stuff with RubyMotion that makes the difference.
That being said, there are features too:
Ruby
Monday, June 24, 13
First of all it uses Ruby, which is a language that I love very much. The syntax is great and
very readable. the language is very powerful and allows you to do some very impressive feats.
Looking at Cocoa documentation and Objective C tutorials, you will find a lot of boilerplate
verbose code and archaic interfaces.
And if there is something Ruby community is allergic to its unnecessary boilerplate. So, as you
would expect, many of the Cocoa APIs have idiomatic Ruby wrappers. They reduce the amount
of code you need to write to use them by a whole lot.
Simple
and readable
Monday, June 24, 13
Another thing is that Ruby code is simpler and more readable as a whole. Objective C is a very
old language that also descends from C, so there is a lot of 'cruft' that was accumulated.
Apple is doing a great job of modernizing it lately, removing quite a bit of boilerplate code
that is no longer needed, but still, Objective C code is much less readable then Ruby, and
there is more of it. For example, in Objective C you need to declare interface for every class,
even if you only use it in a single place. in Ruby you just write your class.
REPL
Read Eval Print Loop
Monday, June 24, 13
Its hard to overstate the importance of Read-Eval-Print-Loop console (REPL). Its utility is
immediately obvious to anyone that programmed in a language that has it.
When you use RubyMotion you get a REPL with tab completion just like regular ruby's IRB. You
can poke inside your running application and call methods on your running application
objects while application is running. This is very very cool and improves the speed of
development quite a bit. Instead of recompiling for every simple change you can tweak things
from the console while the app is running until you are satisfied. Then you can incorporate
the changes into the source code.
There is a special REPL feature in RubyMotion that allows you to Command-click any UI
element in the emulator and have it’s context made available in the running console, I’m
going to show it to you later.
One of the biggest thing about RubyMotion is that it achieves all those cool things without
sacrificing performance. It compiles your application to the native code that runs as fast as if
you were writing it in Objective C (with one caveat I’ll mention later).
workflow
Monday, June 24, 13
Another very important thing is the workflow.
As I already said I hate IDEs. I spent quite a bit of time configuring my command line tools
and editor. RubyMotion allows me to continue to use the same tools I use for writing web
applications with Rails to develop applications for OS X and iOS. There are no configuration
dialogs for the application, all is done through simple ruby configuration files just like in
Rails. There are no big xml files to sift through. And its trivial to see the difference between
versions in source control.
rake
Monday, June 24, 13
The whole workflow is built around Rake - ruby's excellent build management tool.
To compile and run app on the emulator you just type 'rake' and it does the rest.
rubygems
Monday, June 24, 13
Oh, and I can use Rubygems to manage your application libraries.
testing
Monday, June 24, 13
For various reasons most iOS developers do not use automated tests much. The tools exist,
but they are not as pervasive and advanced as in the Ruby land. And RubyMotion comes with
an Rspec like testing and UI automation framework that you can use to test your applications.
No more mindless clicking to test the most basic flows. You will of course still need to
actually use the app, but a lot of functionality can be tested by the framework, without human
intervention.
community
Monday, June 24, 13
In addition to already huge Objective C community, there is a new and growing RubyMotion
community. And Ruby developers are known to produce some pretty innovative libraries and
tools.
JoyBox
http://joybox.io
Monday, June 24, 13
For example, there is a library called JoyBox (http://joybox.io), which is a game wrapper for
RubyMotion. I suggest you find a JoyBox REPL demo video on Vimeo. its amazing how you can
do very impressive things with just a line of ruby.
• write less code
• use better tools
• have more fun
Monday, June 24, 13
Did I mention that its actually a lot of fun programming in RybyMotion? ;)
downsides?
Monday, June 24, 13
Are there any downsides to this?
YES
of course
Monday, June 24, 13
Yes, of course. Just as with most everything in life, there are tradeoffs.
expensive shit
$200
Monday, June 24, 13
First of all this shit is expensive. $200 a piece expensive.
http://www.flickr.com/photos/68751915@N05/6355811869
Monday, June 24, 13
Its a commercial product. While most of the toolchain and workflow tools are open source the
compiler itself is the 'secret souse' and it costs money.
So this kind of puts it out of the 'I just want to fool with it' category. On the other hand Apple
developers already pay to $100 to Apple for the access to the development platform, so this
isn't a big deal. In any kind of commercial environment, the benefits of RubyMotion will pay
for its price many times over.
downsides?
• expensive
• no low level data access
• no static checks during compilation
Monday, June 24, 13
Second, Ruby doesn't give you low level bit access to the native memory, like C does. so if you
are writing a 3D game with lots of graphics processing, RubyMotion might not be a good fit.
2D games are perfectly OK though (see JoyBox).
That being said, RubyMotion can call any function available from Objective-C. So you can
localize your hard-core data processing into a simple Objective-C lib, then drive it with the
rest of the UI from RubyMotion.
Also, as with all dynamic languages, you loose static type checks by compiler. if you have a
typo in a variable name you will find out at runtime, not during compilation.
Alternatives
Phonegap, Titanium
Monday, June 24, 13
We of course can't ignore the alternatives, so I'd like to dedicate a bit of time to discuss them.
There were other solutions available, like Phonegap and Titanium.
multi-platform
Monday, June 24, 13
The big selling point for those is that they are multi platform. So that you can theoretically
reuse a lot of the code to support both iOS and Android platforms
HTML/JS
Monday, June 24, 13
Another thing is that you can use simple HTML and Javascript to develop your applications.
slow
Monday, June 24, 13
No native API access
Monday, June 24, 13
But those very same benefits are also the biggest downside. You do not talk directly to your
runtime, you talk to the library which in turns talks to the OS. So if some API call is not
supported by the wrapper, you don't get to call it. Also, while HTML/JS is a viable solution for
many applications, it is very limiting in what you can do. Where RubyMotion can accommodate
all but the most graphics and data intensive applications like 3D games, html/js apps simply
can't deliver the same slick UI you might want to implement for your native application.
Its really easy to develop applications for those platforms because the APIs are much simpler
then the native ones, but it just means that you have much less APIs to work with. Lots of
things are impossible to do.
RubyMotion is Native
Monday, June 24, 13
RubyMotion on the other hand has all the native APIs.
While it wraps some of the API's into idiomatic Ruby interfaces It also makes all of Apple's
APIs available.
For example, if Apple releases NFC API tomorrow you can start using it the same day, you
don't need to wait until some 3rd party provides you with a wrapper. You can wrap it with
idiomatic Ruby yourself, or just go and use the API directly. Your choice.
RubyMotion is FAST
Monday, June 24, 13
As I already mentioned RubyMotion is fast. Almost as fast as Objective C. IT compiles your
Ruby code to native executable.
How does it do it? Its quite ingenious in fact. And its only possible because Objective C and
Ruby are very similar in many respects. They both descend from Smalltalk and it shows.
smalltalk
Monday, June 24, 13
The message dispatch is quite similar in semantics, so that RubyMotion implements Ruby
syntax by using native ObjectiveC internals.
RubyMotion != Ruby
Monday, June 24, 13
Its important to understand though that RubyMotion is not Ruby.
no eval
Monday, June 24, 13
Some parts of ruby are made unavailable. For example, there is no 'eval', but that has more to
do with Apple's AppStore guidelines then with technical limitations. Also there is no 'require',
but we'll get to this a bit later.
named parameters
Monday, June 24, 13
Some of the syntax was changed to support platform features. For example, Objective C code
uses named parameters. And in Ruby they are only available since Ruby 2.0. RubyMotion
changed ruby syntax to support named parameters from the beginning.
## Objective C
NSError *error = nil;
NSData *data = [[NSData alloc]
initWithContentsOfFile: answerFile,
options: NSDataReadingUncached,
error: &error];
# Same in Ruby
error = Pointer.new(:object)
data = NSData.alloc.initWithContentsOfFile(answerFile,
options:NSDataReadingUncached,
error: error)
# Dereferencing error
do_something_with_error error[0]
Monday, June 24, 13
To show you an example, here is a typical Objective C call that constructs an NSData object
from a content of a file:
Two things to note here: use of error pointer and named arguments.
To support this frequently used ObjectiveC idiom of error pointer RubyMotion introduces
Pointer class, which encapsulates the functionality, and lets you de-reference the pointer
using ruby array syntax.
we can dereference the error pointer using array syntax.
blocks
Monday, June 24, 13
It is actually quite remarkable how little changes had to be done to Ruby syntax to allow
native Objective C interface support. There is another cool Objective C feature that directly
maps into ruby: blocks.
# block in Objective C
[UIView animateWithDuration: 1.0
animations: ^{
@label.alpha = 1
}];
# block in Ruby
UIView.animateWithDuration(1.0,
animations: ->{
@label.alpha = 1
})
Monday, June 24, 13
Lets see another typical Objective C code snippet. This time we 'animate' a text label:
This is very similar to Ruby blocks, just a bit different syntax.
As you can see it is quite trivial to translate Objective C code into Ruby. 
Thats why you don't need special adopted documentation. You can just use the regular API
docs and translate the syntax to ruby on the fly.
That being said, RubyMotion comes with lots of Apple API docs translated and accessible to
RubyMotion version of Ruby "ri" documentation reader.
magic
Monday, June 24, 13
But enough of talking, lets see how the magic happens.
We will create a very simple iOS application. Creating a hello world is trivial, but that would be
too boring, so we will do something a little more interesting. We will create an app that finds
out your current GPS location, and then requests weather information about the location.
Monday, June 24, 13
This is the screenshot of its running.
> motion create weather
Create weather
Create weather/.gitignore
Create weather/app/app_delegate.rb
Create weather/Rakefile
Create weather/resources/Default-568h@2x.png
Create weather/spec/main_spec.rb
Monday, June 24, 13
Note: since we don't have much time I won't explain every little detail.
When you install RubyMotion you get the 'motion' command line tool that does most of the
work.
To create a new application you just write 'motion create AppName'.
As you can see, just like Rails, RubyMotion creates a skeleton application with some basic
tests.
Lets review the files.
> cat Rakefile
# -*- coding: utf-8 -*-
$:.unshift("/Library/RubyMotion/lib")
require 'motion/project/template/ios'
Motion::Project::App.setup do |app|
# Use `rake config' to see complete project settings.
app.name = 'weather'
end
Monday, June 24, 13
Rakefile contains the application configuration block. You can see what configuration options
are available by running 'rake config'.
> rake config
background_modes : []
build_dir : "./build"
codesign_certificate : "Error"
delegate_class : "AppDelegate"
deployment_target : "6.1"
device_family : :iphone
entitlements : {}
files : ["./app/app_delegate.rb"]
fonts : []
framework_search_paths : []
frameworks : ["UIKit", "Foundation", "CoreGraphics"]
icons : []
identifier : "com.yourcompany.weather"
interface_orientations : [:portrait, :landscape_left, :landscape_right]
libs : []
...
Monday, June 24, 13
> rake -T
rake archive # Create an .ipa archive
rake archive:distribution # Create an .ipa archive for distribution (AppStore)
rake build # Build everything
rake build:device # Build the device version
rake build:simulator # Build the simulator version
rake clean # Clear build objects
rake config # Show project config
rake ctags # Generate ctags
rake default # Build the project, then run the simulator
rake device # Deploy on the device
rake simulator # Run the simulator
rake spec # Same as 'spec:simulator'
rake spec:device # Run the test/spec suite on the device
rake spec:simulator # Run the test/spec suite on the simulator
rake static # Create a .a static library
Monday, June 24, 13
You can see other commands by running rake -T:
I suggest you always run 'rake crags' to build tags database.
to run the app you just run rake.
> rake config
background_modes : []
build_dir : "./build"
codesign_certificate : "Error"
delegate_class : "AppDelegate"
deployment_target : "6.1"
device_family : :iphone
entitlements : {}
files : ["./app/app_delegate.rb"]
fonts : []
framework_search_paths : []
frameworks : ["UIKit", "Foundation", "CoreGraphics"]
icons : []
identifier : "com.yourcompany.weather"
interface_orientations : [:portrait, :landscape_left, :landscape_right]
libs : []
...
Monday, June 24, 13
“delegate_class” config is site to “AppDelegate” by default. This is the name of the class that
will be instantiated by the environment and receive lifecycle callbacks.
# app/app_delegate.rb
class AppDelegate
def application(application, didFinishLaunchingWithOptions:launchOptions)
true
end
end
Monday, June 24, 13
Lets check out the AppDelagate class. It is placed in “app/app_delegate.rb”.
As you can see it doesn't do anything yet.
> rake config
background_modes : []
build_dir : "./build"
codesign_certificate : "Error"
delegate_class : "AppDelegate"
deployment_target : "6.1"
device_family : :iphone
entitlements : {}
files : ["./app/app_delegate.rb"]
fonts : []
framework_search_paths : []
frameworks : ["UIKit", "Foundation", "CoreGraphics"]
icons : []
identifier : "com.yourcompany.weather"
interface_orientations : [:portrait, :landscape_left, :landscape_right]
libs : []
...
Monday, June 24, 13
Another thing in config is “icons”. It is blank by default. Lets change it.
# copy icon file into resources directory
> cp ../icon.png resources
# add icon filename to app.icons in Rakefile
app.icons << 'icon.png'
Monday, June 24, 13
We need to copy the icon png file into the resources directory.
Monday, June 24, 13
As you can see our app has a custom icon now.
def application(application,
didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.backgroundColor = UIColor.lightGrayColor
@window.makeKeyAndVisible
true
end
Monday, June 24, 13
Now lets change the applicaiton’s background color to light gray.
class AppDelegate
def application(application,
didFinishLaunchingWithOptions:launchOptions)
@window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds)
@window.backgroundColor = UIColor.lightGrayColor
@window.rootViewController = WeatherController.alloc.init
@window.makeKeyAndVisible
true
end
end
# app/weather_controller.rb
class WeatherController < UIViewController
def viewDidLoad
@label = UILabel.alloc.initWithFrame([[10, 10], [300, 50]])
@label.text = "DevCon 2013"
@label.textColor = UIColor.darkGrayColor
@label.backgroundColor = UIColor.orangeColor
@label.textAlignment = UITextAlignmentCenter
view.addSubview @label
end
end
Monday, June 24, 13
Cocoa is an MVC framework, so now we need a controller. we will put it into app/
weather_controller.rb:
We inherit from UIViewController. It will create a view for us by default, and viewDidLoad
method will be called once the view is loaded.
Here we can initialize the rest of the application. Lets add a tex label.
def viewDidLoad
@label = setup_label [[10, 10], [300, 50]], UIColor.orangeColor
@label.text = "DevCon 2013"
end
def setup_label frame, bgcolor
label = UILabel.alloc.initWithFrame(frame)
label.textColor = UIColor.darkGrayColor
label.backgroundColor = bgcolor
label.textAlignment = UITextAlignmentCenter
view.addSubview label
label
end
Monday, June 24, 13
Lets refactor it a bit to prepare for multiple labels that we need.
@name_label = setup_label [[10, 10], [300, 50]], UIColor.orangeColor
@place_label = setup_label [[10, 80], [300, 50]], UIColor.yellowColor
@temp_label = setup_label [[10, 150], [300, 50]], UIColor.greenColor
Monday, June 24, 13
Here you can see we created 3 labels of different colors.
Bubble Wrap
http://bubblewrap.io
http://rubymotion-wrappers.com
Monday, June 24, 13
So far we used Objective-C API as is, which is not very ruby like. Lets see how better can it be
by using idiomatic Ruby.
RubyMotion has quite a bit of “wrappers” available. Ruby libraries that provide a more ruby-
like interface to common APIs.
You can find many wrappers on http://rubymotion-wrappers.com and simply on github.
BubbleWrap (http://bubblewrap.io) is one of the basic ones. it wraps Cocoa Touch into nice
ruby APIs.
# Gemfile
source 'https://rubygems.org'
gem 'rake'
gem 'bubble-wrap'
# Rakefile
require 'bundler'
Bundler.require
require 'bubble-wrap/all'
Monday, June 24, 13
As mentioned before, RubyMotion doesn’t have “require” support.
So instead of requiring your libraries from your RubyMotion code, you do it in your Rakefile,
where it becomes the part of the build.
We will of course use Rubygems and Bundler to manage our libraries.
@name_label = setup_label [[10, 10], [300, 50]], 'orange'
@place_label = setup_label [[10, 80], [300, 50]], 'yellow'
@temp_label = setup_label [[10, 150], [300, 50]], 'green'
label.textColor = 'dark_gray'.to_color
label.backgroundColor = bgcolor.to_color
Monday, June 24, 13
Now we can use some ruby goodies. First lest try something simple, like String#to_color.
def viewDidLoad
...
get_location
end
def get_location
BW::Location.get_once do |loc|
puts loc.inspect
end
end
Monday, June 24, 13
But that is not what we added BubbleWrap for.
Lets try the Location services. Using natie API that would be a screenful of code. Using
BubbleWrap its a one liner.
You can see that the application now asks for permission to access location data.
def get_location
BW::Location.get_once do |loc|
get_weather loc.latitude, loc.longitude
end
end
def get_weather lat, lon
BW::HTTP.get(
"http://api.openweathermap.org/data/2.5/weather?lat=#{lat}
&lon=#{lon}"
) do |res|
puts res.inspect
end
end
Monday, June 24, 13
Now that we have location we can fetch weather information. We will use
openweathermap.org API for that.
And we will use bubble-wrap HTTP wrapper to fetch it.
def get_weather lat, lon
...
update_weather res.body.to_str
...
end
def update_weather json
res = BW::JSON.parse(json)
name = res['name']
weather = res['weather'][0]['description']
temp = res['main']['temp'] - 273.15
@place_label.text = name
@weather_label.text = weather
@temp_label.text = "%f.2" % temp
end
Monday, June 24, 13
Now that we have the weather json response, lets parse it and update our labels with the
information.
Note that even such a simple thing as JSON parse would be much more verbose without
BubbleWrap.
• http://blog.rubymotion.com
• http://rubymotion-tutorial.com
• https://learn.thoughtbot.com/rubymotion
Monday, June 24, 13
For the end a couple of useful resources for you to learn RubyMotion.
The official blog is something that you will want to follow http://blog.rubymotion.com when
developing with RubyMotion.
http://rubymotion-tutorial.com is a nice place to start.
https://learn.thoughtbot.com/rubymotion is the “things to do/read to lean” list for
RubyMotion from ThoughtBot.
Thank you!
Slides and video will be published at
http://astrails.com/blog
Vitaly Kushner
@vkushner
Monday, June 24, 13
As mentioned before the slides and the video will be posted on our blog at http://
astrails.com/blog
Follow me on twitter (@vkusher) to be notified about new presentations, updates to “The Rails
4 Way” book that I co-authored with Obie Fernandez and our open source libraries.

Más contenido relacionado

La actualidad más candente

How did you use new media technologies in the construction and research, plan...
How did you use new media technologies in the construction and research, plan...How did you use new media technologies in the construction and research, plan...
How did you use new media technologies in the construction and research, plan...JamiePink
 
Einmal Dschungel und zurück! Geschichten über Leadership in der IT
Einmal Dschungel und zurück! Geschichten über Leadership in der ITEinmal Dschungel und zurück! Geschichten über Leadership in der IT
Einmal Dschungel und zurück! Geschichten über Leadership in der ITCosima Laube
 
What have you learnt about technologies from the process of constructing this...
What have you learnt about technologies from the process of constructing this...What have you learnt about technologies from the process of constructing this...
What have you learnt about technologies from the process of constructing this...Victoria Elkin
 
Evaluation question 6
Evaluation question 6Evaluation question 6
Evaluation question 6sam wood
 
Evaluation question 6
Evaluation question 6Evaluation question 6
Evaluation question 6lewisharland
 
UX Super Powers with #ProjectComet
UX Super Powers with #ProjectCometUX Super Powers with #ProjectComet
UX Super Powers with #ProjectCometDemian Borba
 

La actualidad más candente (8)

How did you use new media technologies in the construction and research, plan...
How did you use new media technologies in the construction and research, plan...How did you use new media technologies in the construction and research, plan...
How did you use new media technologies in the construction and research, plan...
 
Einmal Dschungel und zurück! Geschichten über Leadership in der IT
Einmal Dschungel und zurück! Geschichten über Leadership in der ITEinmal Dschungel und zurück! Geschichten über Leadership in der IT
Einmal Dschungel und zurück! Geschichten über Leadership in der IT
 
What have you learnt about technologies from the process of constructing this...
What have you learnt about technologies from the process of constructing this...What have you learnt about technologies from the process of constructing this...
What have you learnt about technologies from the process of constructing this...
 
Question 4
Question 4Question 4
Question 4
 
Eval 4
Eval 4Eval 4
Eval 4
 
Evaluation question 6
Evaluation question 6Evaluation question 6
Evaluation question 6
 
Evaluation question 6
Evaluation question 6Evaluation question 6
Evaluation question 6
 
UX Super Powers with #ProjectComet
UX Super Powers with #ProjectCometUX Super Powers with #ProjectComet
UX Super Powers with #ProjectComet
 

Similar a RubyMotion: Put your Dreams in Motion with Ruby

Rubymotion inspect 2014_review
Rubymotion inspect 2014_reviewRubymotion inspect 2014_review
Rubymotion inspect 2014_reviewBob Firestone
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsMake your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsNataly Tkachuk
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overviewThomas Asikis
 
Real World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web DevelopersReal World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web Developersprshant navgrha
 
Welcome To Ruby On Rails
Welcome To Ruby On RailsWelcome To Ruby On Rails
Welcome To Ruby On RailsKevin Lawver
 
Keynote- We're going wrong: Choosing the web's future. Peter Paul Koch
Keynote- We're going wrong: Choosing the web's future. Peter Paul KochKeynote- We're going wrong: Choosing the web's future. Peter Paul Koch
Keynote- We're going wrong: Choosing the web's future. Peter Paul KochFuture Insights
 
Languages used by web app development services remotestac x
Languages used by web app development services  remotestac xLanguages used by web app development services  remotestac x
Languages used by web app development services remotestac xRemote Stacx
 
9 reasons why programmers should learn react native
9 reasons why programmers should learn react native9 reasons why programmers should learn react native
9 reasons why programmers should learn react nativeReact Sharing
 
Beyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in ProductionBeyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in ProductionC4Media
 
Becoming an IBM Connections Developer
Becoming an IBM Connections DeveloperBecoming an IBM Connections Developer
Becoming an IBM Connections DeveloperRob Novak
 
Most common mistakes in ruby on rails development (and how to avoid making them)
Most common mistakes in ruby on rails development (and how to avoid making them)Most common mistakes in ruby on rails development (and how to avoid making them)
Most common mistakes in ruby on rails development (and how to avoid making them)Katy Slemon
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorialknoppix
 
RubyMotion Inspect Conference - 2013. (Without speaker notes.)
RubyMotion Inspect Conference - 2013. (Without speaker notes.)RubyMotion Inspect Conference - 2013. (Without speaker notes.)
RubyMotion Inspect Conference - 2013. (Without speaker notes.)alloy020
 
Ruby And Ruby On Rails
Ruby And Ruby On RailsRuby And Ruby On Rails
Ruby And Ruby On RailsAkNirojan
 
RubyMotion Inspect Conference - 2013. (With speaker notes.)
RubyMotion Inspect Conference - 2013. (With speaker notes.)RubyMotion Inspect Conference - 2013. (With speaker notes.)
RubyMotion Inspect Conference - 2013. (With speaker notes.)alloy020
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdfAyesha Siddika
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails PresentationPaul Pajo
 
Enterprise ipad Development with notes
Enterprise ipad Development with notesEnterprise ipad Development with notes
Enterprise ipad Development with notesjaxarcsig
 

Similar a RubyMotion: Put your Dreams in Motion with Ruby (20)

Rubymotion inspect 2014_review
Rubymotion inspect 2014_reviewRubymotion inspect 2014_review
Rubymotion inspect 2014_review
 
Make your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On RailsMake your app idea a reality with Ruby On Rails
Make your app idea a reality with Ruby On Rails
 
Ruby on Rails - An overview
Ruby on Rails -  An overviewRuby on Rails -  An overview
Ruby on Rails - An overview
 
Real World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web DevelopersReal World Rails 5 Programming for Web Developers
Real World Rails 5 Programming for Web Developers
 
Welcome To Ruby On Rails
Welcome To Ruby On RailsWelcome To Ruby On Rails
Welcome To Ruby On Rails
 
Keynote- We're going wrong: Choosing the web's future. Peter Paul Koch
Keynote- We're going wrong: Choosing the web's future. Peter Paul KochKeynote- We're going wrong: Choosing the web's future. Peter Paul Koch
Keynote- We're going wrong: Choosing the web's future. Peter Paul Koch
 
Languages used by web app development services remotestac x
Languages used by web app development services  remotestac xLanguages used by web app development services  remotestac x
Languages used by web app development services remotestac x
 
9 reasons why programmers should learn react native
9 reasons why programmers should learn react native9 reasons why programmers should learn react native
9 reasons why programmers should learn react native
 
Gaasdm
GaasdmGaasdm
Gaasdm
 
Beyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in ProductionBeyond the Hype: 4 Years of Go in Production
Beyond the Hype: 4 Years of Go in Production
 
Becoming an IBM Connections Developer
Becoming an IBM Connections DeveloperBecoming an IBM Connections Developer
Becoming an IBM Connections Developer
 
Most common mistakes in ruby on rails development (and how to avoid making them)
Most common mistakes in ruby on rails development (and how to avoid making them)Most common mistakes in ruby on rails development (and how to avoid making them)
Most common mistakes in ruby on rails development (and how to avoid making them)
 
Ruby tutorial
Ruby tutorialRuby tutorial
Ruby tutorial
 
RubyMotion Inspect Conference - 2013. (Without speaker notes.)
RubyMotion Inspect Conference - 2013. (Without speaker notes.)RubyMotion Inspect Conference - 2013. (Without speaker notes.)
RubyMotion Inspect Conference - 2013. (Without speaker notes.)
 
Ruby And Ruby On Rails
Ruby And Ruby On RailsRuby And Ruby On Rails
Ruby And Ruby On Rails
 
RubyMotion Inspect Conference - 2013. (With speaker notes.)
RubyMotion Inspect Conference - 2013. (With speaker notes.)RubyMotion Inspect Conference - 2013. (With speaker notes.)
RubyMotion Inspect Conference - 2013. (With speaker notes.)
 
ruby pentest
ruby pentestruby pentest
ruby pentest
 
Ruby Rails Web Development.pdf
Ruby Rails Web Development.pdfRuby Rails Web Development.pdf
Ruby Rails Web Development.pdf
 
Ruby On Rails Presentation
Ruby On Rails PresentationRuby On Rails Presentation
Ruby On Rails Presentation
 
Enterprise ipad Development with notes
Enterprise ipad Development with notesEnterprise ipad Development with notes
Enterprise ipad Development with notes
 

Más de Astrails

Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applicationsAstrails
 
Accounting For Hackers
Accounting For HackersAccounting For Hackers
Accounting For HackersAstrails
 
Machine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code SmarterMachine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code SmarterAstrails
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Astrails
 
Engineering esthetics
Engineering estheticsEngineering esthetics
Engineering estheticsAstrails
 
Lean Software Development
Lean Software DevelopmentLean Software Development
Lean Software DevelopmentAstrails
 
WTF is NoSQL
WTF is NoSQLWTF is NoSQL
WTF is NoSQLAstrails
 
Cassandra intro
Cassandra introCassandra intro
Cassandra introAstrails
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable LispAstrails
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is AwesomeAstrails
 
Rails missing features
Rails missing featuresRails missing features
Rails missing featuresAstrails
 
Performance - When, What and How
Performance - When, What and HowPerformance - When, What and How
Performance - When, What and HowAstrails
 

Más de Astrails (12)

Building and deploying React applications
Building and deploying React applicationsBuilding and deploying React applications
Building and deploying React applications
 
Accounting For Hackers
Accounting For HackersAccounting For Hackers
Accounting For Hackers
 
Machine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code SmarterMachine Learning: Make Your Ruby Code Smarter
Machine Learning: Make Your Ruby Code Smarter
 
Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.Migrating from Flux to Redux. Why and how.
Migrating from Flux to Redux. Why and how.
 
Engineering esthetics
Engineering estheticsEngineering esthetics
Engineering esthetics
 
Lean Software Development
Lean Software DevelopmentLean Software Development
Lean Software Development
 
WTF is NoSQL
WTF is NoSQLWTF is NoSQL
WTF is NoSQL
 
Cassandra intro
Cassandra introCassandra intro
Cassandra intro
 
Ruby is an Acceptable Lisp
Ruby is an Acceptable LispRuby is an Acceptable Lisp
Ruby is an Acceptable Lisp
 
Ruby is Awesome
Ruby is AwesomeRuby is Awesome
Ruby is Awesome
 
Rails missing features
Rails missing featuresRails missing features
Rails missing features
 
Performance - When, What and How
Performance - When, What and HowPerformance - When, What and How
Performance - When, What and How
 

Último

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfNeo4j
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Strongerpanagenda
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...panagenda
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Scott Andery
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024BookNet Canada
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsSergiu Bodiu
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfMounikaPolabathina
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch TuesdayIvanti
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityIES VE
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersNicole Novielli
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsRavi Sanghani
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Farhan Tariq
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesKari Kakkonen
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Alkin Tezuysal
 

Último (20)

The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
Connecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdfConnecting the Dots for Information Discovery.pdf
Connecting the Dots for Information Discovery.pdf
 
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better StrongerModern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
Modern Roaming for Notes and Nomad – Cheaper Faster Better Stronger
 
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
Transcript: New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
Why device, WIFI, and ISP insights are crucial to supporting remote Microsoft...
 
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
Enhancing User Experience - Exploring the Latest Features of Tallyman Axis Lo...
 
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
New from BookNet Canada for 2024: Loan Stars - Tech Forum 2024
 
DevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platformsDevEX - reference for building teams, processes, and platforms
DevEX - reference for building teams, processes, and platforms
 
What is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdfWhat is DBT - The Ultimate Data Build Tool.pdf
What is DBT - The Ultimate Data Build Tool.pdf
 
2024 April Patch Tuesday
2024 April Patch Tuesday2024 April Patch Tuesday
2024 April Patch Tuesday
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Decarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a realityDecarbonising Buildings: Making a net-zero built environment a reality
Decarbonising Buildings: Making a net-zero built environment a reality
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
A Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software DevelopersA Journey Into the Emotions of Software Developers
A Journey Into the Emotions of Software Developers
 
Potential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and InsightsPotential of AI (Generative AI) in Business: Learnings and Insights
Potential of AI (Generative AI) in Business: Learnings and Insights
 
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...Genislab builds better products and faster go-to-market with Lean project man...
Genislab builds better products and faster go-to-market with Lean project man...
 
Testing tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examplesTesting tools and AI - ideas what to try with some tool examples
Testing tools and AI - ideas what to try with some tool examples
 
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
Unleashing Real-time Insights with ClickHouse_ Navigating the Landscape in 20...
 

RubyMotion: Put your Dreams in Motion with Ruby

  • 1. Put Your Dreams in Motion with Ruby Vitaly Kushner @vkushner Monday, June 24, 13
  • 2. Vitaly Kushner programming since middle 80s professionally since early 90s Rails since 2005 founded Astrails in 2008 Monday, June 24, 13 Hello everybody, my name is Vitaly Kushner. I'm a co-founder of Astrails. A Ruby on Rails consulting company. For the last 8 years we’ve been building web applications using Ruby on Rails, but this is not what I’m going to talk about today. For a while I didn't know what to talk about.
  • 3. Rails Monday, June 24, 13 Yet another Rails introduction?
  • 4. http://www.flickr.com/photos/52462679@N06/5913851944 Monday, June 24, 13 Nah, everybody knows already that for most web applications Rails is the best tool for the job. I wanted something more interesting. So instead I decided to choose a topic that I'm much less of an expert in, actually not an expert at all, but rather something that I'm currently learning and very excited about.
  • 5. Rails blog in 5 minutes Monday, June 24, 13 In fact I’m as excited as I was back in 2005 when I saw for the first time the legendary "blog in 5 min" Rails screencast. I remember when I saw it for the first time I decided right there that Rails will be the framework for my next web project.
  • 6. New Toy shiny Monday, June 24, 13 Recently I had a similar experience, and now I have a new shiny toy to play with.
  • 7. http://www.flickr.com/photos/joriel/2839872192/sizes/l/ Monday, June 24, 13 So.. What am I going to talk about today? Those of you that payed attention to the conference program already know, for the rest it will be a pleasant surprise ;)
  • 8. RubyMotion Monday, June 24, 13 We are going to talk about RubyMotion. What is it, why and when would you want to use it and when not, and how it compares to alternatives.
  • 9. Purpose? Monday, June 24, 13 But first I'd like to talk about the purpose of this talk. We don't have much time, so we are not going to go into much technical details. But I'll be very glad if at least some of you will come back to work or home and decide to try RubyMotion for your next great app. so…
  • 10. I hate IDEs seriously, they are all crap Monday, June 24, 13 For a long time I wanted to develop for iOS and OS X, and I even started to go through the tutorials a couple of times, but I got frustrated every time. I got spoiled by the ruby ecosystem, toolset and development process. To the point that dealing with the archaic   IDE was too much of a pain and  in some ways reminded me of the bad days of my Windows GUI programming. Google for 'Xcode sucks' and you will find tens of thousands of people that agree with me. Whenever I tried to follow Xcode tutorials, at some stage Xcode would just freeze and refuse to continue. There is no need to bash Apple here though, the same shit happens with Eclipse and any other IDS  there is. They are just too big and complex to reliably work and allow me to understand exactly what they do. They impose workflow on you that you can't change to suit your needs. So, frustrated, I've put away the iOS tutorials for a while. And then I saw the RubyMotion screencast and I immediately felt the excitement that reminded me of my first days of Rails.
  • 11. What is RubyMotion? Monday, June 24, 13 What is RubyMotion?
  • 12. "RubyMotion is a revolutionary toolchain that lets you quickly develop and test native iOS and OS X applications for iPhone, iPad and Mac, all using the awesome Ruby language you know and love." Monday, June 24, 13 "RubyMotion is a revolutionary toolchain that lets you quickly develop and test native iOS and OS X applications for iPhone, iPad and Mac, all using the awesome Ruby language you know and love."
  • 13. Why RubyMotion? Monday, June 24, 13 So why would you want to use RubyMotion instead of Objective C? There are several reasons, but there is no a single killer feature. Instead the whole approach to development and workflow is what makes RubyMotion so special. Its not the features, its how it feels to build stuff with RubyMotion that makes the difference. That being said, there are features too:
  • 14. Ruby Monday, June 24, 13 First of all it uses Ruby, which is a language that I love very much. The syntax is great and very readable. the language is very powerful and allows you to do some very impressive feats. Looking at Cocoa documentation and Objective C tutorials, you will find a lot of boilerplate verbose code and archaic interfaces. And if there is something Ruby community is allergic to its unnecessary boilerplate. So, as you would expect, many of the Cocoa APIs have idiomatic Ruby wrappers. They reduce the amount of code you need to write to use them by a whole lot.
  • 15. Simple and readable Monday, June 24, 13 Another thing is that Ruby code is simpler and more readable as a whole. Objective C is a very old language that also descends from C, so there is a lot of 'cruft' that was accumulated. Apple is doing a great job of modernizing it lately, removing quite a bit of boilerplate code that is no longer needed, but still, Objective C code is much less readable then Ruby, and there is more of it. For example, in Objective C you need to declare interface for every class, even if you only use it in a single place. in Ruby you just write your class.
  • 16. REPL Read Eval Print Loop Monday, June 24, 13 Its hard to overstate the importance of Read-Eval-Print-Loop console (REPL). Its utility is immediately obvious to anyone that programmed in a language that has it. When you use RubyMotion you get a REPL with tab completion just like regular ruby's IRB. You can poke inside your running application and call methods on your running application objects while application is running. This is very very cool and improves the speed of development quite a bit. Instead of recompiling for every simple change you can tweak things from the console while the app is running until you are satisfied. Then you can incorporate the changes into the source code. There is a special REPL feature in RubyMotion that allows you to Command-click any UI element in the emulator and have it’s context made available in the running console, I’m going to show it to you later. One of the biggest thing about RubyMotion is that it achieves all those cool things without sacrificing performance. It compiles your application to the native code that runs as fast as if you were writing it in Objective C (with one caveat I’ll mention later).
  • 17. workflow Monday, June 24, 13 Another very important thing is the workflow. As I already said I hate IDEs. I spent quite a bit of time configuring my command line tools and editor. RubyMotion allows me to continue to use the same tools I use for writing web applications with Rails to develop applications for OS X and iOS. There are no configuration dialogs for the application, all is done through simple ruby configuration files just like in Rails. There are no big xml files to sift through. And its trivial to see the difference between versions in source control.
  • 18. rake Monday, June 24, 13 The whole workflow is built around Rake - ruby's excellent build management tool. To compile and run app on the emulator you just type 'rake' and it does the rest.
  • 19. rubygems Monday, June 24, 13 Oh, and I can use Rubygems to manage your application libraries.
  • 20. testing Monday, June 24, 13 For various reasons most iOS developers do not use automated tests much. The tools exist, but they are not as pervasive and advanced as in the Ruby land. And RubyMotion comes with an Rspec like testing and UI automation framework that you can use to test your applications. No more mindless clicking to test the most basic flows. You will of course still need to actually use the app, but a lot of functionality can be tested by the framework, without human intervention.
  • 21. community Monday, June 24, 13 In addition to already huge Objective C community, there is a new and growing RubyMotion community. And Ruby developers are known to produce some pretty innovative libraries and tools.
  • 22. JoyBox http://joybox.io Monday, June 24, 13 For example, there is a library called JoyBox (http://joybox.io), which is a game wrapper for RubyMotion. I suggest you find a JoyBox REPL demo video on Vimeo. its amazing how you can do very impressive things with just a line of ruby.
  • 23. • write less code • use better tools • have more fun Monday, June 24, 13 Did I mention that its actually a lot of fun programming in RybyMotion? ;)
  • 24. downsides? Monday, June 24, 13 Are there any downsides to this?
  • 25. YES of course Monday, June 24, 13 Yes, of course. Just as with most everything in life, there are tradeoffs.
  • 26. expensive shit $200 Monday, June 24, 13 First of all this shit is expensive. $200 a piece expensive.
  • 27. http://www.flickr.com/photos/68751915@N05/6355811869 Monday, June 24, 13 Its a commercial product. While most of the toolchain and workflow tools are open source the compiler itself is the 'secret souse' and it costs money. So this kind of puts it out of the 'I just want to fool with it' category. On the other hand Apple developers already pay to $100 to Apple for the access to the development platform, so this isn't a big deal. In any kind of commercial environment, the benefits of RubyMotion will pay for its price many times over.
  • 28. downsides? • expensive • no low level data access • no static checks during compilation Monday, June 24, 13 Second, Ruby doesn't give you low level bit access to the native memory, like C does. so if you are writing a 3D game with lots of graphics processing, RubyMotion might not be a good fit. 2D games are perfectly OK though (see JoyBox). That being said, RubyMotion can call any function available from Objective-C. So you can localize your hard-core data processing into a simple Objective-C lib, then drive it with the rest of the UI from RubyMotion. Also, as with all dynamic languages, you loose static type checks by compiler. if you have a typo in a variable name you will find out at runtime, not during compilation.
  • 29. Alternatives Phonegap, Titanium Monday, June 24, 13 We of course can't ignore the alternatives, so I'd like to dedicate a bit of time to discuss them. There were other solutions available, like Phonegap and Titanium.
  • 30. multi-platform Monday, June 24, 13 The big selling point for those is that they are multi platform. So that you can theoretically reuse a lot of the code to support both iOS and Android platforms
  • 31. HTML/JS Monday, June 24, 13 Another thing is that you can use simple HTML and Javascript to develop your applications.
  • 33. No native API access Monday, June 24, 13 But those very same benefits are also the biggest downside. You do not talk directly to your runtime, you talk to the library which in turns talks to the OS. So if some API call is not supported by the wrapper, you don't get to call it. Also, while HTML/JS is a viable solution for many applications, it is very limiting in what you can do. Where RubyMotion can accommodate all but the most graphics and data intensive applications like 3D games, html/js apps simply can't deliver the same slick UI you might want to implement for your native application. Its really easy to develop applications for those platforms because the APIs are much simpler then the native ones, but it just means that you have much less APIs to work with. Lots of things are impossible to do.
  • 34. RubyMotion is Native Monday, June 24, 13 RubyMotion on the other hand has all the native APIs. While it wraps some of the API's into idiomatic Ruby interfaces It also makes all of Apple's APIs available. For example, if Apple releases NFC API tomorrow you can start using it the same day, you don't need to wait until some 3rd party provides you with a wrapper. You can wrap it with idiomatic Ruby yourself, or just go and use the API directly. Your choice.
  • 35. RubyMotion is FAST Monday, June 24, 13 As I already mentioned RubyMotion is fast. Almost as fast as Objective C. IT compiles your Ruby code to native executable. How does it do it? Its quite ingenious in fact. And its only possible because Objective C and Ruby are very similar in many respects. They both descend from Smalltalk and it shows.
  • 36. smalltalk Monday, June 24, 13 The message dispatch is quite similar in semantics, so that RubyMotion implements Ruby syntax by using native ObjectiveC internals.
  • 37. RubyMotion != Ruby Monday, June 24, 13 Its important to understand though that RubyMotion is not Ruby.
  • 38. no eval Monday, June 24, 13 Some parts of ruby are made unavailable. For example, there is no 'eval', but that has more to do with Apple's AppStore guidelines then with technical limitations. Also there is no 'require', but we'll get to this a bit later.
  • 39. named parameters Monday, June 24, 13 Some of the syntax was changed to support platform features. For example, Objective C code uses named parameters. And in Ruby they are only available since Ruby 2.0. RubyMotion changed ruby syntax to support named parameters from the beginning.
  • 40. ## Objective C NSError *error = nil; NSData *data = [[NSData alloc] initWithContentsOfFile: answerFile, options: NSDataReadingUncached, error: &error]; # Same in Ruby error = Pointer.new(:object) data = NSData.alloc.initWithContentsOfFile(answerFile, options:NSDataReadingUncached, error: error) # Dereferencing error do_something_with_error error[0] Monday, June 24, 13 To show you an example, here is a typical Objective C call that constructs an NSData object from a content of a file: Two things to note here: use of error pointer and named arguments. To support this frequently used ObjectiveC idiom of error pointer RubyMotion introduces Pointer class, which encapsulates the functionality, and lets you de-reference the pointer using ruby array syntax. we can dereference the error pointer using array syntax.
  • 41. blocks Monday, June 24, 13 It is actually quite remarkable how little changes had to be done to Ruby syntax to allow native Objective C interface support. There is another cool Objective C feature that directly maps into ruby: blocks.
  • 42. # block in Objective C [UIView animateWithDuration: 1.0 animations: ^{ @label.alpha = 1 }]; # block in Ruby UIView.animateWithDuration(1.0, animations: ->{ @label.alpha = 1 }) Monday, June 24, 13 Lets see another typical Objective C code snippet. This time we 'animate' a text label: This is very similar to Ruby blocks, just a bit different syntax. As you can see it is quite trivial to translate Objective C code into Ruby.  Thats why you don't need special adopted documentation. You can just use the regular API docs and translate the syntax to ruby on the fly. That being said, RubyMotion comes with lots of Apple API docs translated and accessible to RubyMotion version of Ruby "ri" documentation reader.
  • 43. magic Monday, June 24, 13 But enough of talking, lets see how the magic happens. We will create a very simple iOS application. Creating a hello world is trivial, but that would be too boring, so we will do something a little more interesting. We will create an app that finds out your current GPS location, and then requests weather information about the location.
  • 44. Monday, June 24, 13 This is the screenshot of its running.
  • 45. > motion create weather Create weather Create weather/.gitignore Create weather/app/app_delegate.rb Create weather/Rakefile Create weather/resources/Default-568h@2x.png Create weather/spec/main_spec.rb Monday, June 24, 13 Note: since we don't have much time I won't explain every little detail. When you install RubyMotion you get the 'motion' command line tool that does most of the work. To create a new application you just write 'motion create AppName'. As you can see, just like Rails, RubyMotion creates a skeleton application with some basic tests. Lets review the files.
  • 46. > cat Rakefile # -*- coding: utf-8 -*- $:.unshift("/Library/RubyMotion/lib") require 'motion/project/template/ios' Motion::Project::App.setup do |app| # Use `rake config' to see complete project settings. app.name = 'weather' end Monday, June 24, 13 Rakefile contains the application configuration block. You can see what configuration options are available by running 'rake config'.
  • 47. > rake config background_modes : [] build_dir : "./build" codesign_certificate : "Error" delegate_class : "AppDelegate" deployment_target : "6.1" device_family : :iphone entitlements : {} files : ["./app/app_delegate.rb"] fonts : [] framework_search_paths : [] frameworks : ["UIKit", "Foundation", "CoreGraphics"] icons : [] identifier : "com.yourcompany.weather" interface_orientations : [:portrait, :landscape_left, :landscape_right] libs : [] ... Monday, June 24, 13
  • 48. > rake -T rake archive # Create an .ipa archive rake archive:distribution # Create an .ipa archive for distribution (AppStore) rake build # Build everything rake build:device # Build the device version rake build:simulator # Build the simulator version rake clean # Clear build objects rake config # Show project config rake ctags # Generate ctags rake default # Build the project, then run the simulator rake device # Deploy on the device rake simulator # Run the simulator rake spec # Same as 'spec:simulator' rake spec:device # Run the test/spec suite on the device rake spec:simulator # Run the test/spec suite on the simulator rake static # Create a .a static library Monday, June 24, 13 You can see other commands by running rake -T: I suggest you always run 'rake crags' to build tags database. to run the app you just run rake.
  • 49. > rake config background_modes : [] build_dir : "./build" codesign_certificate : "Error" delegate_class : "AppDelegate" deployment_target : "6.1" device_family : :iphone entitlements : {} files : ["./app/app_delegate.rb"] fonts : [] framework_search_paths : [] frameworks : ["UIKit", "Foundation", "CoreGraphics"] icons : [] identifier : "com.yourcompany.weather" interface_orientations : [:portrait, :landscape_left, :landscape_right] libs : [] ... Monday, June 24, 13 “delegate_class” config is site to “AppDelegate” by default. This is the name of the class that will be instantiated by the environment and receive lifecycle callbacks.
  • 50. # app/app_delegate.rb class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) true end end Monday, June 24, 13 Lets check out the AppDelagate class. It is placed in “app/app_delegate.rb”. As you can see it doesn't do anything yet.
  • 51. > rake config background_modes : [] build_dir : "./build" codesign_certificate : "Error" delegate_class : "AppDelegate" deployment_target : "6.1" device_family : :iphone entitlements : {} files : ["./app/app_delegate.rb"] fonts : [] framework_search_paths : [] frameworks : ["UIKit", "Foundation", "CoreGraphics"] icons : [] identifier : "com.yourcompany.weather" interface_orientations : [:portrait, :landscape_left, :landscape_right] libs : [] ... Monday, June 24, 13 Another thing in config is “icons”. It is blank by default. Lets change it.
  • 52. # copy icon file into resources directory > cp ../icon.png resources # add icon filename to app.icons in Rakefile app.icons << 'icon.png' Monday, June 24, 13 We need to copy the icon png file into the resources directory.
  • 53. Monday, June 24, 13 As you can see our app has a custom icon now.
  • 54. def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.backgroundColor = UIColor.lightGrayColor @window.makeKeyAndVisible true end Monday, June 24, 13 Now lets change the applicaiton’s background color to light gray.
  • 55. class AppDelegate def application(application, didFinishLaunchingWithOptions:launchOptions) @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.backgroundColor = UIColor.lightGrayColor @window.rootViewController = WeatherController.alloc.init @window.makeKeyAndVisible true end end # app/weather_controller.rb class WeatherController < UIViewController def viewDidLoad @label = UILabel.alloc.initWithFrame([[10, 10], [300, 50]]) @label.text = "DevCon 2013" @label.textColor = UIColor.darkGrayColor @label.backgroundColor = UIColor.orangeColor @label.textAlignment = UITextAlignmentCenter view.addSubview @label end end Monday, June 24, 13 Cocoa is an MVC framework, so now we need a controller. we will put it into app/ weather_controller.rb: We inherit from UIViewController. It will create a view for us by default, and viewDidLoad method will be called once the view is loaded. Here we can initialize the rest of the application. Lets add a tex label.
  • 56. def viewDidLoad @label = setup_label [[10, 10], [300, 50]], UIColor.orangeColor @label.text = "DevCon 2013" end def setup_label frame, bgcolor label = UILabel.alloc.initWithFrame(frame) label.textColor = UIColor.darkGrayColor label.backgroundColor = bgcolor label.textAlignment = UITextAlignmentCenter view.addSubview label label end Monday, June 24, 13 Lets refactor it a bit to prepare for multiple labels that we need.
  • 57. @name_label = setup_label [[10, 10], [300, 50]], UIColor.orangeColor @place_label = setup_label [[10, 80], [300, 50]], UIColor.yellowColor @temp_label = setup_label [[10, 150], [300, 50]], UIColor.greenColor Monday, June 24, 13 Here you can see we created 3 labels of different colors.
  • 58. Bubble Wrap http://bubblewrap.io http://rubymotion-wrappers.com Monday, June 24, 13 So far we used Objective-C API as is, which is not very ruby like. Lets see how better can it be by using idiomatic Ruby. RubyMotion has quite a bit of “wrappers” available. Ruby libraries that provide a more ruby- like interface to common APIs. You can find many wrappers on http://rubymotion-wrappers.com and simply on github. BubbleWrap (http://bubblewrap.io) is one of the basic ones. it wraps Cocoa Touch into nice ruby APIs.
  • 59. # Gemfile source 'https://rubygems.org' gem 'rake' gem 'bubble-wrap' # Rakefile require 'bundler' Bundler.require require 'bubble-wrap/all' Monday, June 24, 13 As mentioned before, RubyMotion doesn’t have “require” support. So instead of requiring your libraries from your RubyMotion code, you do it in your Rakefile, where it becomes the part of the build. We will of course use Rubygems and Bundler to manage our libraries.
  • 60. @name_label = setup_label [[10, 10], [300, 50]], 'orange' @place_label = setup_label [[10, 80], [300, 50]], 'yellow' @temp_label = setup_label [[10, 150], [300, 50]], 'green' label.textColor = 'dark_gray'.to_color label.backgroundColor = bgcolor.to_color Monday, June 24, 13 Now we can use some ruby goodies. First lest try something simple, like String#to_color.
  • 61. def viewDidLoad ... get_location end def get_location BW::Location.get_once do |loc| puts loc.inspect end end Monday, June 24, 13 But that is not what we added BubbleWrap for. Lets try the Location services. Using natie API that would be a screenful of code. Using BubbleWrap its a one liner. You can see that the application now asks for permission to access location data.
  • 62. def get_location BW::Location.get_once do |loc| get_weather loc.latitude, loc.longitude end end def get_weather lat, lon BW::HTTP.get( "http://api.openweathermap.org/data/2.5/weather?lat=#{lat} &lon=#{lon}" ) do |res| puts res.inspect end end Monday, June 24, 13 Now that we have location we can fetch weather information. We will use openweathermap.org API for that. And we will use bubble-wrap HTTP wrapper to fetch it.
  • 63. def get_weather lat, lon ... update_weather res.body.to_str ... end def update_weather json res = BW::JSON.parse(json) name = res['name'] weather = res['weather'][0]['description'] temp = res['main']['temp'] - 273.15 @place_label.text = name @weather_label.text = weather @temp_label.text = "%f.2" % temp end Monday, June 24, 13 Now that we have the weather json response, lets parse it and update our labels with the information. Note that even such a simple thing as JSON parse would be much more verbose without BubbleWrap.
  • 64. • http://blog.rubymotion.com • http://rubymotion-tutorial.com • https://learn.thoughtbot.com/rubymotion Monday, June 24, 13 For the end a couple of useful resources for you to learn RubyMotion. The official blog is something that you will want to follow http://blog.rubymotion.com when developing with RubyMotion. http://rubymotion-tutorial.com is a nice place to start. https://learn.thoughtbot.com/rubymotion is the “things to do/read to lean” list for RubyMotion from ThoughtBot.
  • 65. Thank you! Slides and video will be published at http://astrails.com/blog Vitaly Kushner @vkushner Monday, June 24, 13 As mentioned before the slides and the video will be posted on our blog at http:// astrails.com/blog Follow me on twitter (@vkusher) to be notified about new presentations, updates to “The Rails 4 Way” book that I co-authored with Obie Fernandez and our open source libraries.