12

We want to develop an application for iOS and Android smartphones. We are mainly using Microsoft technologies for developing our applications. We thought that if we would use MonoTouch and Mono for Android we would only have to maintain one code base with only a different UI layer for each device.

Because currently nobody in our small team ever developed a smartphone application and we need it quickly we want to outsource it. We asked other companies whether they perfer MonoTouch or Objective C for iPhone development. Most of them said, that the would choose Objective C. They said that Objective C offers more functionality and possibilities, it's faster and for MonoTouch there is a chance that Apple will not support it anymore in the future. Is all of that true or are there other reasons to prefer Objective C? I know there are other threads like this around, but they did not answer my questions, especially the one regarding Apple's support for MonoTouch.

jscs
  • 63,694
  • 13
  • 151
  • 195
chrinetr
  • 205
  • 1
  • 3
  • 13
  • possible duplicate of [Is MonoTouch a viable platform for iPhone development?](http://stackoverflow.com/questions/1847274/is-monotouch-a-viable-platform-for-iphone-development) – Marc B Jun 27 '12 at 11:38
  • 2
    It's 2.5 years later -- I think enough things have changed that a new set of answers wouldn't be a bad idea. – Mike Lorenz Jun 27 '12 at 12:24
  • 12
    Sounds like none of the companies you talked to have any real MonoTouch experience. – miguel.de.icaza Jun 27 '12 at 14:31

6 Answers6

40

applications. We thought that if we would use MonoTouch and Mono for Android we would only have to maintain one code base with only a different UI layer for each device.

this is a possibility IF you structure your app right. If not: no.

If you use Java+ObjC+C# (for WP7 / Win8 metro etc) then this is not an option AT ALL

Because currently nobody in our small team ever developed a smartphone application and we need it quickly we want to outsource it. We asked other companies whether they perfer MonoTouch or Objective C for iPhone development. Most of them said, that the would choose Objective C.

If you are outsourcing it, you should dictate what you want it written in, surely? If you need to support it in-house, and you only have C# skills, then MonoTouch etc makes more sense for you, the people paying the bills!

They said that Objective C offers more functionality and possibilities,

FUD, and also incorrect. Monotouch has the full API available. If it's not there, as Xamarin to bind it (which they have done often before)

it's faster

I'd love to see the benchmark. Yes, technically, it can be faster in some circumstances, but in general use, MonoTouch the same or quicker.

Programmer error is a more common cause of iOS app performance problems. eg not getting things off the UI thread (which is easier to do in MonoTouch than in ObjC, tho blocks have helped that a lot), or taking too long to get out of FinishedLaunching (the "main" method, if you will, tho it's not really...)

Garbage collection and things like linq, xml/json parsing, generics and collections are also hugely valuable, and very quick.

and for MonoTouch there is a chance that Apple will not support it anymore in the future.

yes, there is a chance. There is also a chance that Tim Cook will run off with Apple's billions and buy all of Hawaii (rather than Larry Ellison's "I'll just have this island" purchase). But the chances are now rather slim.

Is all of that true or are there other reasons to prefer Objective C? I know there are other threads like this around, but they did not answer my questions, especially the one regarding Apple's support for MonoTouch.

Apple doesn't support MonoTouch. Xamarin does, and they do it exceptionally well. Apple doesn't support anything except XCode, which is their product.

Apple DOES allow MonoTouch apps (there are lots). Another way to look at it: usually, 95% of the top 100 games are written using Unity3D, which is based on the same techniques (ahead-of-time compilation of C# code and embedding a cutdown version of the Mono/.NET framework).

There ARE reasons to prefer ObjC which would be:

  • You already know ObjC and CocoaTouch and like it.
  • Your team already knows ObjC and CocoaTouch or you can easily hire people who do (note: currently, as far as I know, iOS developers are CRAZY expensive to hire, if you can get them)
  • You need to use the beta's the day they come out. Keep in mind that you can use the current MonoTouch and deploy to your iOS[REDACTED] device with the beta on it. You just can't use the new stuff in iOS6 YET (Xamarin said "around 2 weeks" which should be about now...). Also keep in mind that you can not deploy an app to the store which is built with the beta SDK, even if you don't use any of the stuff in it. You can't even mention iOS[REDACTED] in your product description (I've tried)
  • you love [squareBrackets andTheOccasional:@"strange syntax things"];

Now, will building a cross platform, shared code app be an easy undertaking? HELL NO. It's a very complex piece of development for a non-trivial application. But thats the fun part of software development: if it was easy, it'd be boring! Grab Greg Shackles book ( http://www.amazon.com/dp/1449320236 ) to get an idea of whats needed for iOS+WinPhone+Android style development.

Nic Wise
  • 8,061
  • 2
  • 31
  • 30
  • 1
    Thank you for your detailed answer. I also started reading the book you mentioned and so far it's pretty cool to get an overview. – chrinetr Jun 28 '12 at 09:28
  • Excellent, glad you found it interesting - I'm about 75% thru it now, it's good for seeing the terminology differences between the three platforms, too. – Nic Wise Jul 01 '12 at 13:27
11

My hunch is that the companies you talked to simply are used to using Objective-C. That's where their skills lie, and that's the biggest reason why they would prefer not to deviate from their path. The other reasons can be argued both ways.

It's true that no one can predict what Apple will do, but there's a very small likelihood that Apple will ban third-party toolkits & APIs like they did in the summer of 2010. That was only a short period of time, and they completely reversed that decision. Their current focus is on making app development easier, which means keeping the field open to alternative development methods. I think MonoTouch is safe.

As for speed, C# generally produces very fast executables. They may not be quite as fast as Objective-C, but I doubt you'd notice a difference. I remember seeing a website somewhere that showed C# outperforming C/C++ in some tests, but that was in the .NET environment, not Mono... and unfortunately I can't find the reference anymore. I'll keep looking. But the bottom line on speed is that C# speeds are very good. It's not like BASIC vs C. More like Java/JIT vs C.

C# gives you many, many(!) advantages over Objective-C, and they have been enumerated in other Stack Overflow answers, so I won't repeat them here. You can find them easily enough.

I'm an obvious fan of MonoTouch, but I do have to say one thing: I think it's a mistake for companies to think that because they are fluent in C#/.NET that they will easily be able to develop and/or maintain iOS apps using MonoTouch. It's just not true, because MonoTouch is basically a C# layer over the CocoaTouch API, meaning that you have to learn the Apple way of doing things. You have app delegates and view controllers and all the UIKit stuff. There's a real learning curve there. But if you're fluent in C#, MonoTouch will be a huge help.

UPDATE:
I found the article on C# speed: Head-to-head benchmark: C++ vs .NET

Mike Lorenz
  • 942
  • 6
  • 13
  • 1
    MonoTouch uses ahead of time compilation, so the comparison between Java (which is normally applicable) isn't in this case. It's running native ARM assembly, from the mono code generator, linked and built with gcc or llvm (same as all xcode/objc apps) – Nic Wise Jun 27 '12 at 15:22
  • True, but I was comparing overall execution speed, not underlying architecture. Thanks though, good clarification. (TBH, my Java comparison may be flawed too: C# is probably faster. But in any case, it's within the same order of magnitude.) – Mike Lorenz Jun 29 '12 at 19:57
8

I have actually used MonoTouch for every app I've ever developed. Performance has never been an issue, and I can't imagine how bad for me it would have been using Objective-C. I've had 2 top 10 apps in the US app store: "Draw A Stickman" and "Draw A Stickman: Episode 2" (don't worry we are working on more).

If you know C# and .Net your gains in productivity are going to be massive compared to what would happen trying to learn Objective-C. I was a C# .Net developer (Windows only) prior to iOS development and the transition to MonoTouch is great.

If you like Linq, parsing XML in fewer than 100 lines, garbage collection, generics, simple multi-threading, and no weird square brackets, MonoTouch is for you.

jonathanpeppers
  • 26,115
  • 21
  • 99
  • 182
6

I use both Objective-C and c# (MonoTouch & Droid), and I really like both. When I'm coding in c#, there are plenty of features such as Linq which I'd love in Obj-C, & when I'm coding in Obj-C there are plenty of things I'd love to have in c#, but I adapt to whatever I'm coding in quickly enough. Re performance, I've detected no difference at all, even for fairly graphic-intensive stuff, so I wouldn't use that as a reason not to use c#.

I think it's ultimately down to what you're comfortable coding in, though of course with a well designed cross-platform project, you CAN have fully cross-platform core code if you use Mono, and you'll only have to do the UI stuff in a platform-specific way - when it comes to this obviously you'll need to know the native stuff to get your UIs working in a way which is appropriate to the platform and familiar to its users.

SomaMan
  • 4,127
  • 1
  • 34
  • 45
3

We have a line of business app that uses MS SQL as a data store, and has WinForms and web UI's. It integrates with our windows mobile 6.5 and tablet apps with web services. All c#.

We've fully committed to MonoTouch after some experiments in Objective-C and HTML-5 (we had working prototypes): we get to re-use our business logic, and we're comfortable developing new code in c#.

Our business logic is constantly being enhanced, and these enhancements are immediately visible to the mobile app - without having to replicate the logic in Objective-C or C++.

Our main issue is finding a c# programmer who's comfortable with the iPhone and iPad UI's.

MonoTouch is stable and we've encountered no limitations (we're binding to the same iOS API that Objective-C binds to). During our learning curve, we've had question, bumped into bugs and have had some misunderstandings - but the support from Xamarin is superb.

Performance has been a non-issue - our app is snappy even though it's doing a lot behind the scenes.

eostarman
  • 56
  • 3
-2

No body can tell you for sure what will apple support and what it will not support in the future, however apple had some issues with mono in the past, and since history tends to repeat itself, then it may be a possibility of that to happen again

Having said that, always go with the native application development SDKS and environments, it will be more flexible, and it will be updated real time, and performance will always be better in the native

Omar Abdelhafith
  • 21,163
  • 5
  • 52
  • 56
  • 5
    Other than the "nothing at all but ObjC" thing when they were trying to kill Flash, Apple have never had an issue with Mono apps. Even when they were refusing "non ObjC apps" officially, they were still approving MonoTouch apps (including mine) – Nic Wise Jun 27 '12 at 15:20