9 ms·
Why I'm Not Using RubyMotion in Production
- zachgersh 13y agoI have been waiting for a post like this for a long time. There seems to be a distinct lack of "I use rubymotion and here are my thoughts" type posts that provide concrete details. Really appreciate the article and I am interested to see where this leads for RubyMotion.
- spartango 13y agoIf you're curious to hear more perspectives on using RubyMotion in production, you might check out Clay Allsopp's blog posts (e.g. http://clayallsopp.com/posts/rubymotion-year-one/ http://clayallsopp.com/posts/rubymotion-year-one/). His startup has been using RubyMotion for a while and he's written tutorial and a book for it as well.
- zachgersh 13y agoVery interesting! Thanks a ton for the tip.
- stephenheron 13y agoI just bought a RubyMotion license and I really enjoyed creating my first iPhone App but I don't think I would have started if I knew about this issue. I really hope that they get around to fixing this problem, it does make me a bit concerned that they are pushing big new features while such a serious issue seems to exists.
- rubyn00bie 13y agoThis is exactly how I'm feeling now. I've been prototyping and loving it, but I almost don't even want to try releasing an application if the support burden is going to be that high... Now it's like, well, why not just use Objective-C? I sort of just wish I had my $200 back.
- DenisM 13y agoThink of the bright side - becoming aware of the perils of third-party platform toolchain you are likely saving a huge number of hours and frustration for yourself in the future. For example, I still regret using Google Web Toolkit, and for a few years now, but I'm sort of stuck with it. $200 is small potatoes.
- rdouble 13y agoYou can get a refund within 30 days.
- dmarkow 13y agoWhile RM-3 itself is only 4 months old, the bug's been around and discussed since RubyMotion first came out (e.g. http://blog.blazingcloud.net/2012/07/16/rubymotion-block-scope-bug/ http://blog.blazingcloud.net/2012/07/16/rubymotion-block-sco...). They used a bug tracker that wasn't publicly viewable until they migrated everything to YouTrack earlier this year (I reported it last August).
- crusso 13y agoWe must be able to expect that critical flaws in our toolchains will be fixed promptly At some point, Borland disabused me of the notion that serious toolchain providers fixed their critical flaws promptly... or at all.
- pkulak 13y agoAm I the only one who thinks that ARC in a language like Ruby is probably impossible? Even with Objective C they had to add 4 new variable qualifiers, and put that burden on the programmer to use them properly.
- coldtea 13y agoRuby already has garbage collection, so clearly GC is not impossible at all. And there have been successful bridges from Python/Ruby to Obj-C that had GC too. Now, ARC, or something similar for RubyMotion, is a different take on the matter. I don't know why they want that way instead of an actual GC.
- mikeash 13y agoARC in a language like ruby is trivial. ARC is probably the first kind of garbage collection ever implemented. It's only complicated in Objective-C because of all the C.
- jimbokun 13y agoDo you have any thoughts, then, on why Laurent is having such a hard time fixing this in Ruby Motion? (Looking at your web site, seems like you would have a good understanding of the underlying issues.)
- mikeash 13y agoThat's a good question. I'm not really sure, but I'm almost positive it's related to Ruby or RubyMotion internals, not ARC in general. As best I can tell from the article and the filed bug, it comes down to not retaining captured variables in blocks. In Objective-C, there's some automatic memory management that happens for you when you capture a variable in a block: id x = ...; ^{ NSLog(@"%@", x); }; Because the block depends on x, the lifetime of that object needs to be tied to the lifetime of the block. As such, the compiler emits code so that if and when you copy the block onto the heap, it automatically retains x. When the block object is destroyed, it automatically releases x. Note that, while definitely "automatic reference counting", this isn't, strictly speaking, ARC. Because this is so critical to being able to use blocks without going completely insane, this bit of cleverness was introduced with blocks on 10.6, even though ARC didn't exist yet. The note in the bug says that it's complicated because they don't want to introduce a performance regression. This suggests that they're not having trouble with retaining objects referenced by the block per se, but rather with being smart about it, so that it's only retained when necessary. The Objective-C compiler does this by constructing blocks on the stack, and requiring an explicit copy to move them to the heap. Only when explicitly copied do they retain the variables they capture, so simple inline cases remain fast. Perhaps Ruby or RubyMotion have something that makes this harder to do. If that's correct, then I can't say I find the excuse a very good one. Performance regressions are bad, but generating incorrect code is much worse. They need to fix it immediately, take the speed hit, then see about ways to improve performance while maintaining correctness. However, I certainly could be wrong.
- 1123581321 13y agoApologies for the basic question, but why would this 'analog' (is that another system? An abstraction?) have this issue if it is using ARC? Isn't ARC just a flag in XCode's compiler? If RubyMotion turns it on, wouldn't XCode make all the necessary arrangements? Again, I simply want to understand; I'm not trying to make a point.
- coldtea 13y agoIt's NOT using ARC. It's using an "analog" (in the original post's words). With which he means "a substitute", "a similar tech", "their own implementation of the same concept", "something analogous to ARC" (hence the "analog"). (Most people know "analog" only as in "analog vs digital", but it was immediately obvious to me, because I know the etymology of the word from the original language it was adopted from. Btw, the english dictionary definition that's closer for such a use of the word is: 1. An organ or structure that is similar in function to one in another kind of organism but is of dissimilar evolutionary origin. The wings of birds and the wings of insects are analogs.).
- 1123581321 13y agoThanks to you and Veraticus. My assumptions were completely off.
- munificent 13y agoPersonally, I use "analog" to mean "not digital" and "analogue" to mean "something similar to". I think that's a little clearer, at least to some US readers.
- coldtea 13y agoCould be. I thought analogue was just the british variant of the spelling.
- bobwaycott 13y agoWas going to say the same thing. I employ the same usage to mitigate confusion.
- carterschonwald 13y agothe relevant issue ticket is here: http://hipbyte.myjetbrains.com/youtrack/issue/RM-3 http://hipbyte.myjetbrains.com/youtrack/issue/RM-3
- ef4 13y agoI'm happy that the RubyMotion guys can charge money for what they're doing. But if you're going to stay closed source, you're asking me to just trust you that important (to me) bugs are going to get fixed fast enough. That is very hard to do. That is the real value of open source. It's not about the money -- an extra $200 is nothing in a development budget. It's about being able to fix the bugs myself when they matter enough.
- scribu 13y ago... or at least hire someone to fix the bugs for you. I wonder if there are any closed-source software shops that have a "pays us a premium to fix bug X first" option. Doesn't seem like it would work too well.
- x0x0 13y agoI worked for one and it works very well. They build one of the most common electronic medical record systems plus a bunch of associated software. Any large client, in this case a hospital, hospital chain, or large ambulatory clinic, pays a $mm annual fee for the right to call and notify of a breaking bug and get engineers to issue a fix asap.
- hboon 13y agoHas it ever led to a pseudo-ransom situation if only a single client is affected by a showstopper bug? If not, how is this mitigated?
- x0x0 13y agoWell, I believe two ways. First, I'm sure the contracts have penalties, plus hospitals have lawyers. Second, when companies spend tens of millions of dollars per year or more, they certainly talk to a bunch of current clients. If word gets around that your company screws customers it will throw a wrench in sales. There aren't that many hospitals, particularly if you view chains like kaiser as a single customer, in the US.
- 13y ago
- od2m 13y agoI've always been suspscious of RubyMotion for having no trial. Now I know.
- easyd 13y agoThey offer a "30 days money back guarantee".
- stashpro 13y agoThat's a lot of fuzz for an active bug with a very easy workaround.
- jevinskie 13y agoI didn't see a workaround, can you elaborate?
- stashpro 13y agoI understood that using an instance variable is a viable workaround. Or maybe just code around the issue?
- bobwaycott 13y agoThe author states that even using this method has produced indeterminate crashes.
- Legion 13y agoRead the paragraph that starts with the sentence, "Of course, there's a workaround."
- masukomi 13y agoyou mean the paragraph that includes "...will correct the crashing error – sometimes. I’ve used instance variables and have still experienced crashes in blocks" ? That one? Or was there a paragraph I missed that included a workaround that actually solved the problem rather than minimizing it?
- hboon 13y agoSee https://news.ycombinator.com/item?id=5950675 https://news.ycombinator.com/item?id=5950675
- gfodor 13y agoThe fact that there is a workaround is irrelevant for two reasons. First, said workaround would completely change the entire structure of your ruby code. Basically, kill blocks. This is inferior to Objective-C itself structure-wise. Second, and most importantly, this bug is not something that jumps out at you. It only causes crashes in some small % of runs. So, the result is your apps look fine, you are writing idiomatic ruby, but once you release to production, you start getting crash reports because you closed over a local variable that ends up being released. This is the kiss of death for production apps: un-reproducible bugs due to magic in the compiler not working as expected. In other words, even if you know about the bug, and even if you understand the workaround, if you write code naturally, you are going to introduce crashing bugs that are not reproducible that affect some small but measurable percentage of your users. A true nightmare.
- sjtgraham 13y agoI've been using Ruby for some years now, and let me tell you something: just learn Obj-C. It's not hard to learn, is actually a pleasure to write, and will surprise you with it's elegance sometimes, e.g. KVC collection operators (http://nshipster.com/kvc-collection-operators/ http://nshipster.com/kvc-collection-operators/). RubyMotion would have been awesome a few years ago, but now that Obj-C has ARC, literals for dictionaries and arrays, and blocks (yes!), I can't help but think that RubyMotion has missed the boat. Learn Obj-C. Go to iTunes U, get Stanford CS193P, and have a bunch of fun.
- deleted 13y ago[deleted]
- easyd 13y agoI agree, Obj-C has improved a lot. But it's not just Obj-C vs. Ruby: - you can use the editor of your choice and the terminal instead of Xcode - you can use the interactive console to debug your app or to live test new code - you get all the great wrapper gems like BubbleWrap which are heavily influenced by the "rails way" of doing things
- sjtgraham 13y agoDo you know these to be facts or are you just regurgitating something you've read or heard elsewhere? Because: > you can use the editor of your choice and the terminal instead of Xcode. This is possible with Obj-C, but using Xcode is a far superior experience to RubyMotion and any editor. > you can use the interactive console to debug your app or to live test new code Ditto for lldb in Xcode > you get all the great wrapper gems like BubbleWrap which are heavily influenced by the "rails way" of doing things There are plenty of powerful 3rd party Obj-C abstractions too.
- adriand 13y ago> using Xcode is a far superior experience to RubyMotion and any editor. XCode is not ideal for people accustomed to, say, vim. I love the static code analysis and the autocomplete and storyboards are pretty cool too. But having to edit text like a normal human instead of using vim sucks and the split pane handling is garbage. I would rather do all my dev in vim.
- gfodor 13y agoHah, I was thinking "what a coincidence" since I started that thread in the group. Thanks a bunch for writing this up -- I hope it gets fixed soon!
- jimbokun 13y agoThis puts in question Ruby Motion's entire premise for existence. Ruby Motion is supposed to make iOS and Mac OS X app development simpler than Objective C. If there are lots of complex rules and corner cases to learn about and work around, it becomes easier to just write Objective C, where at least the rules about memory are well understood by the community. Will be interesting to see how HipByte addresses this. They at least need to get in front of the issue with a blog entry or article about how they plan to address it.
- hawkw 13y agoSometimes I doubt your commitment to RubyMotion.
- bobwaycott 13y agoThis article is quite the breath of fresh air where constant, pointless battles over languages are concerned. Not only does the author have the courage to admit there are problems with RubyMotion that make it unfit for production use--and seriously, noticeable unexpected and difficult-to-reproduce-and-fix memory errors make any language unfit for production--but he also offers a dispassionate and technical explanation. I love Obj-C and have eyed RubyMotion and other Ruby-related projects like it (MacRuby, etc.), and it is nice to hear from an unapologetic supporter of a project that it is not production ready, despite the hype and fanfare. Thank you.
- flyingbeaver 13y agoRubyMotion's creator answer : https://groups.google.com/forum/#!topic/rubymotion/x6-9c__IHH0 https://groups.google.com/forum/#!topic/rubymotion/x6-9c__IH...
- cpr 13y agotl;dr: They had a well-known workaround for the known bug involving block variables [apparently not well-enough], so they were focusing on other things. As of right now, they're going drop everything and fix it in RM 2.4.
- jasonlotito 13y agoEvery time I heard the phrase "well-known workaround" I interpret it as "tribal knowledge."
- GantMan 13y agolrz promises fix by next version https://groups.google.com/d/msg/rubymotion/x6-9c__IHH0/J7jYdoMz85cJ https://groups.google.com/d/msg/rubymotion/x6-9c__IHH0/J7jYd...