Live data from Hacker News

A review of RubyMotion

samsoff.es

1–10 of 31 posts

Re: A review of RubyMotion

#2
Objective C classes and methods are designed to be long and mostly typed by Xcode's autocomplete. With RubyMotion, I will end up typing out all those verbose methods, which I don't know if it's something I feel too big about.

The example author made here feels like I will end up typing about twice as much with RubyMotion than objective C.

Ruby: @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @window.makeKeyAndVisible

Objective C: self.window = [[UIWindow alloc] initWithFrame:[[UIScreen mainScreen] bounds]]; [self.window makeKeyAndVisible];

Re: A review of RubyMotion

#3
post #2

Objective C classes and methods are designed to be long and mostly typed by Xcode's autocomplete. With RubyMotion, I will end up typing out all those verbose methods, which I don't know if it's something I feel too big about. The example author made here feels like I will end up typing about twice as much with RubyMotion than objective C. Ruby: @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @windo…

I agree. With XCode's powerful autocomplete, I don't have to remember all the methods. In fact, you can guess the names a lot of the times due to their verbose and descriptive naming conventions, and XCode will help you along the way.

I'm a Rubyist, it's my primary language and I'd love to use it over Objective-c. But I'm also starting really like Obj-c, and right now it's the best thing out there for iOS because of XCode.

If you want to learn how to make iOS apps, learn Objective-c. Or at the very least learn it first. Trust me, you'll be glad you did.

Re: A review of RubyMotion

#4
post #2

Objective C classes and methods are designed to be long and mostly typed by Xcode's autocomplete. With RubyMotion, I will end up typing out all those verbose methods, which I don't know if it's something I feel too big about. The example author made here feels like I will end up typing about twice as much with RubyMotion than objective C. Ruby: @window = UIWindow.alloc.initWithFrame(UIScreen.mainScreen.bounds) @windo…

I wonder if IDEs like RubyMine will have a nice autocomplete for RubyMotion

Re: A review of RubyMotion

#5
One of the ObjC examples could be more concise. He writes:

  id navigationBar = [UINavigationBar appearance];
  [navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-background.png"] forBarMetrics:UIBarMetricsDefault];
  [navigationBar setTitleTextAttributes:[[NSDictionary alloc] initWithObjectsAndKeys:
    [UIFont cheddarFontWithSize:24.0f], UITextAttributeFont,
    [UIColor colorWithWhite:0.0f alpha:0.4f], UITextAttributeTextShadowColor,
    [UIColor whiteColor], UITextAttributeTextColor,
    nil]];
which could be

  id navigationBar = [UINavigationBar appearance];
  [navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-background.png"] forBarMetrics:UIBarMetricsDefault];
  [navigationBar setTitleTextAttributes:@{
    UITextAttributeFont : [UIFont cheddarFontWithSize:24],
    UITextAttributeTextShadowColor : [UIColor colorWithWhite:0 alpha:0.4],
    UITextAttributeTextColor : [UIColor whiteColor],
  }];
as compares to the Ruby,

  navigationBar = UINavigationBar.appearance
  navigationBar.setBackgroundImage(UIImage.imageNamed('nav-background.png'), forBarMetrics: UIBarMetricsDefault)
  navigationBar.setTitleTextAttributes({
    UITextAttributeFont: UIFont.cheddarFontWithSize(24.0),
    UITextAttributeTextShadowColor: UIColor.colorWithWhite(0.0, alpha:0.4),
    UITextAttributeTextColor: UIColor.whiteColor
  })
Also kind of wondering where he got "cheddarFont". :-)

Re: A review of RubyMotion

#6
What is the advantage? I'm neither an iOS or ruby developer, please enlighten me. It seems like this gives you a different language syntax to access the same libraries with no additional abstraction. It doesn't seem like it would speed up development much.

Re: A review of RubyMotion

#7
post #6

What is the advantage? I'm neither an iOS or ruby developer, please enlighten me. It seems like this gives you a different language syntax to access the same libraries with no additional abstraction. It doesn't seem like it would speed up development much.

I assume you get other benefits of working with Ruby, like it's functional programming aspects, (nicer) dynamic typing, data structures, etc. Plus if you were a ruby developer, like the author here seems to be, it would feel more familiar.

Re: A review of RubyMotion

#8
post #6

What is the advantage? I'm neither an iOS or ruby developer, please enlighten me. It seems like this gives you a different language syntax to access the same libraries with no additional abstraction. It doesn't seem like it would speed up development much.

The interactive REPL looks fantastic. It's one of the things I love about developing in ruby - you can try things without going through the compile or even save/execute process. There is a lot to be said for a short/instant feedback loop.

Re: A review of RubyMotion

#9
post #5

One of the ObjC examples could be more concise. He writes: id navigationBar = [UINavigationBar appearance]; [navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-background.png"] forBarMetrics:UIBarMetricsDefault]; [navigationBar setTitleTextAttributes:[[NSDictionary alloc] initWithObjectsAndKeys: [UIFont cheddarFontWithSize:24.0f], UITextAttributeFont, [UIColor colorWithWhite:0.0f alpha:0.4f], UITextAttributeT…

I didn't know about the new @{} syntax for dictionaries - http://blog.ablepear.com/2012/02/something-wonderful-new-obj... - very nice.

Re: A review of RubyMotion

#10
post #5

One of the ObjC examples could be more concise. He writes: id navigationBar = [UINavigationBar appearance]; [navigationBar setBackgroundImage:[UIImage imageNamed:@"nav-background.png"] forBarMetrics:UIBarMetricsDefault]; [navigationBar setTitleTextAttributes:[[NSDictionary alloc] initWithObjectsAndKeys: [UIFont cheddarFontWithSize:24.0f], UITextAttributeFont, [UIColor colorWithWhite:0.0f alpha:0.4f], UITextAttributeT…

Cheddar is the name of his app: https://cheddarapp.com/
Post reply on HN