I'm working with a small startup with the goal of creating an iPhone application. The programmers on our team all know both C and Java, but we've got no ObjC/C#/iPhone experience -- we'll be learning something no matter what. All the questions I've seen on this subject have been from the perspective of a C# programmer getting into iOS, so I don't have any information on the relative merits of learning one or the other.
So, what I want to know is the relative merits of C# and Objective-C for new programmers, with respect to these things:
Performance
Ease of use
Ease of learning
Reliability (i.e., will a new iOS version break a MonoTouch app?)
Also, would writing in MonoTouch have any benefits for cross-platform development with Android?
If the goal of your startup is to create an iPhone app, then obviously you should learn the language iOS applications are built with, Objective-C. Your team already has experience with C, so it should be very easy to get started. The Big Nerd Ranch books will get you up and running in a week or two (I'm not associated with Big Nerd Ranch, I just think they're awesome).
I don't understand why you bring up MonoTouch, considering your team doesn't have C#/.NET experience. There are tons of other frameworks like MonoTouch, including Titanium SDK (JavaScript), RubyMotion (Ruby), and so forth. All of these are great, but as I see it are primarily for those with experience with their respective languages. They allow you to write iOS applications using a language you're more familiar with, but have the following drawbacks:
Performance can be just as good, but usually a little (sometimes a lot) worse than an application written in Objective-C.
Resources for learning are not as plentiful as those for iOS SDK/Objective-C. There are tons of people who want to make iOS apps, and of those people some use these frameworks, and they are diluted amongst them. Only a small fraction of the resources available for iOS development will be devoted to any given framework.
These frameworks are based on the iOS SDK/Objective-C, so naturally development is always a step behind. If Apple rolls out radically new APIs in the next version of the iOS SDK, you'll have to wait for these frameworks to adapt (applications written in Objective-C might break, too, but it'll be easier to deal with based on point #2).
Most of these frameworks require a familiarity with the iOS SDK. You will still need to know that an application calls the - (BOOL)application:(UIApplication *)application didFinishLaunchingWithOptions:(NSDictionary *)launchOptions method on launch, but in addition you will need to remember how to translate that into the appropriate method for MonoTouch: public override bool FinishedLaunching (UIApplication app, NSDictionary options). The iOS SDK is massive, and most iOS developers rely on Apple's documentation for insight. So you will be looking at the API docs, written for Objective-C, and translating methods into the framework of your choice.
The Objective-C ecosystem is constantly evolving, with cool new projects like CocoaPods, bwoken, etc. These are primarily developed with Objective-C and Xcode in mind. Configuring them to work with your framework of choice will almost invariably cause you extra time and work.
The above points have generally kept me from delving too much into any of these other frameworks. They're all very cool, but their primary merit in adoption seems to be facilitating development for people with deep skill sets outside of Objective-C, or allowing cross-platform development for small teams lacking the resources to invest in Android and iOS (and Windows Phone) programmers. Hopefully the benefits outweigh the above costs for adopters.
Also, would writing in MonoTouch have any benefits for cross-platform development with Android?
I suppose it would. Indeed, the MonoTouch homepage touts that as a primary advantage of using the framework. I'm not so sure about view/controller classes, since those seem like they would be tied into UIKit, but the logic encapsulated in your models should be fairly easy to port.
Long story short, I think you and your team should stick with Objective-C for iOS development.
If you're just building an iPhone app, then by all means choose Objective C. But if you want a mobile app — which may include android, windows phone, windows rt, blackberry, webos, or other options — you might want to take a close look at a few of the alternative platforms, of which MonoTouch is one prominent option.
Objective C is a strict superset of C, so if you understand the performance characteristics of compiled C code on ARM, you can just use that C subset with which you are familiar, except for the iOS UI.
There seem to exist reports that experienced C programmers start getting up to speed with writing iOS apps in Objective C in on the order of 2 weeks. But, of course, learning extensive frameworks and APIs in an ongoing learning process, whatever the language.
For performance, the answer is Objective-C, all the way.
That said, take a look at doing this with HTML5. If you stick to accelerated transforms, HTML5 performance for an application front end is surprisingly good. It's also pretty easy to move your HTML5 app to Android.
The simple answer is Objective-C. It's not too hard to learn. If you're solid on C and solid on OOP, you'll be fine.
Related
This question is specifically related to a recommended architecture and people's previous experiences for cross-platform WP7, iOS, Android apps developed using C#, Monotouch and Monodroid respectively. I have researched previous questions here, here and here. They provide good answers but not quite what I'm looking for. I have also found this excellent question which does go into the cost benefit so there is some overlap.
I have a requirement to develop a cross-platform iPhone/iPad, WP7 and android app for a health & fitness company, which will integrate with their website. The app requires a small amount of local data storage for offline mode and synchronisation with the website when a network is available. I am a Windows (C#/C++) developer through and through and don't really want to go down the route of three Objective C, Java and C# apps, although I will if I have to. I will also be operating as tech lead and farming out some work to a team on this project.
I would like to know if anyone here has experience with cross-platform development using Monotouch, Monodroid and WP7 and to share their experience on application architecture to re-use as much code as possible. The architecture I am considering is as follows:
My question is as follows:
Has anyone here tried something like this?
Are these frameworks (Monotouch, monodroid) worth their salt for this sort of work?
Can I setup the entire project in Visual Studio 2010 with separate projects (dlls/exe) for the Monotouch, Monodroid and Wp7 target (but shared code using 'Add as Link')?
What sort of code-reuse can I realistically expect with this (or a similar) architecture? i.e. what strategies/patterns can I use to re-use local data access, webservices, and business logic?
You might want to look into the MonoCross project which is designed to help you reuse C# code with multiple presentation layers:
http://code.google.com/p/monocross/
The authors of MonoCross (ITR Mobility) have created multiple mobile cross platform solutions for a variety of customers and have written two books on the subject one is "iPad in the Enterprise" (http://amzn.to/zAhQK6) and the upcoming "Cross-Platform Mobile Development with C#" (http://amzn.to/wM6RsF).
In the meantime, you can watch Scott Olson's presentation that he did at Monospace 2011 that describes how to use MonoCross to target multiple mobile and desktop platforms at once reusing the business logic:
http://www.infoq.com/presentations/The-Rise-of-Mono-in-the-Enterprise
They enforce a strict MVC split in their code:
(source: tirania.org)
The biggest benefit of designing an application with this model is that you can run the same application with native user interfaces on each platform. You get native iOS, Android, Windows UI and they even have an ASP.NET front-end that allows you to publish Web versions of the same business logic.
This technology was used successfully by the Medtronic sample app that is showcased by Apple in their iPad business:
http://www.apple.com/ipad/business/profiles/medtronic/
I suggest you also check out Scott's blog where he posts regularly about his experiences with cross-platform architecture.
Based on your comments your requirements are for a cross-mobile platform that will integrate with their existing services, but also work offline. You are specifically interested in C# via Mono, however you have indicated that you are not discounting other approaches.
I feel that HTML / PhoneGap / JavaScript is a route that you should explore in some detail. The WP7 version of this framework has just been released, and I have had experience of releasing an application to the marketplace using this approach.
PhoneGap wraps your HTML / JavaScript code, in the case of WP7 this is loaded into local storage. This enables the application to work entirely offline. This is true for all versions (iOS, Android etc...)
Probably the biggest issue with PhoneGap / HTML5 is the same issue we have when developing complex web based applications for the browser. The tooling for JavaScript is not great and browser differences are a constant issue. However, it is a tried and tested solution.
Finally, it is possible to create an application UI that is entirely different for each platform. By using the MVVM pattern I have managed to share all my JavaScript business logic between WP7 and iOS applications whilst having a totally different UI:
Compare this to the WP7 screens:
NOTE: I plan to have the iOS version of Property Finder in the AppStore shortly, I just need to work out how to use PhoneGap Build!
Just adding another alternative to the mix - mvvmcross
This project was developed out of experiences with monocross, mvvmlight, and opennetcf.
It's quite an opinionated mvvm framework (with my opinions in it!), it includes data-binding support for Droid and Touch, and it really does encourage code reuse between the platforms.
The source is available from https://github.com/slodge/MvvmCross, it's been used in at least a couple of large projects already and it's still under active development.
There's an introductory presentation on it on slideshare: http://www.slideshare.net/cirrious/dev-evening-monotouch-monodroid-mvvm-mvvmcross-and-databinding
One of the more fully featured samples is a conference app:
The question is very hard to answer, yet I would like to share some thoughts.
The situation with the mobile development is very similar to the development at the first half of the 90s. Phone have limited resources as computers had, mobile OSes are making their baby steps, hence the ecosystem is relatively small. They have own philosophy, tools and even languages. And this is a good thing, but leads to a headache for cross-platform development. As a result, there are many attempts to clear this a bit. People build frameworks, wrappers etc. which is a kind of abstraction and abstractions are leaky. This is extremely important for mobile devices not only the performance as numbers of CPU cycles, but also the performance of the battery, which is far more important for the user.
If I were you I would build apps in a native environment especially if you have some performance considerations. Best support, tools, educational resources etc. pays for the duplicated business logic. All in all, it's not a OS or Database Management System, codebase won't be huge ;)
That being said. Regarding Monotouch and Monodroid I would be very careful since Apple blocks iPhone OS apps created by many third-party compilers and The King doesn't really care about developers. The case that mono will be flushed to the toiled by patent infringement or proprietary software vendors is very likely. This is sad for me cause C# is my favorite language.
PS. I don't believe that HTML5 for mobile will take over any time soon.
I like making music using mostly my computer and especially love using synthesisers. There is a wide range of synthesiser plugins available online which are quite awesome. I have downloaded the VST (Virtual Studio Technology) SDK which is the platform that most plugins I know of use.
I would like to know if you can use the SDK on the .Net framework to write plugins; the only documentation and tutorials I could find is for C++ and I'm not that trusted with C++. I could learn to use C++, I taught myself C# in a week, but to use an unknown language and to learn other new concepts don't seem like a good combination.
Could anyone just give me pointers in the right direction on how to get started and even if it is possible to program it using .Net?
Regards Charl
Many beginners find VST.NET the perfect choice to start off with. It comes with some samples and with VS2008/VS2010 project templates that yield working plugins. So its a great way to start.
VST.NET provides a framework that structures and groups the VST API into manageable pieces. Out of the box it provides support for common functionality such as plugin parameters and programs.
So drop by at the VST.NET codeplex site and we'll help you get started.
BTW: To my knowledge the noise project has been abandoned and although VST.NET might not appear to be very active, I still continue to react on the questions posted on its codeplex site.
I second obiwanjacobi's sentiment. VST.Net is about the only .Net VST bridge out there that I know of and the community is great. It's an excellent framework.
https://vstnet.codeplex.com/
As for the statement: "doubt .NET platform would be adequate concerning the raw performance that a VST plugin requires". This is entirely untrue. My tests have shown that on a decent computer, .Net can very easily handle basic synthesis without even raising the CPU level above a few percent. Of course, it's not going to match C++'s performance for very complex synthesis, but in cases like this, there's no reason why you can't fall back on C++ to do the more complex stuff. In fact that is where Vst.Net excels. It would allow you to build very complex synthesis as a VST, and then leverage that in .Net.
At the same time, I think you'd be hard pressed to say definitively that .Net couldn't do very complex synthesis as well. I haven't really tried, but there's no real obstacles when you pay attention to the performance of your code, which would go for any programming platform.
On top of all that, there is now .Net Native to add to the picture. .Net Native has the potential to be AS fast as C++.
I remember hearing of noisevst and VST.NET, two C# wrappers for the VST API but I don't know how stable they are. And I really doubt .NET platform would be adequate concerning the raw performance that a VST plugin requires.
So I would recommend learning a little bit of C++. Yes, C++ is so big and complex that nobody on earth knows every feature of it. But for plugin development purposes all you need to do is to implement a couple of methods. You can start from the provided samples in the VST API. Audio DSP code wouldn't look much different if you'd use C#, C++ or any other mainstream language anyway.
If you also want to implement a GUI for your plugin, that's where the things start getting hairy. VSTGUI is simple but lacks many features. I can recommend WDL's iPlug framework but that would require a little more than basic C++.
I want to know, is there any way to develop games for Android-based mobiles (and maybe iPhone) in C#? Yep, i know about "MonoDroid/Mono for Android", but well... it's not free. Java is great but Dalvik performance is far worse than Mono. And it lacks of some features that are very useful for game development such as operator overloading. Furthermore, there is OpenTK framework which is simply amazing.
So, is it possible to get running .NET/Mono on Android for free? Or am I sentenced to Java?
You would have to be able install unmanaged code on the device. I would recommend using Java, because I can foresee deployment being difficult with mono. Google might not let you sell your app on their marketplace with large quantities of unmanaged code. It would also tie you down to Android phones sporting a particular brand of processor, not much of a problem as all of the phones I can think of use ARM processors but there are some exceptions.
You could try http://www.mono-project.com/Mono:ARM if you are sure about this.
Operator overloading is simply syntactic sugar. I'm sure you are capable of writing applications without it. And Java can't be without its own suitable frameworks surely.
Android is overflowing with java and its most likely easier not to try and fight it.
If you don't want to use Java then you should use the NDK and C/C++; especially for games. An additional upside to that is if you think ahead a bit you can have a large chunck of code that works on Android and iPhone.
I am not normally a fan of offering something outside the limits of what you've set, but you should take this advice to heart:
If you are serious about Game Development I would invest time in learning Unity3D. The non Pro version is free and does not expire. They have iPhone and Android kits that allow you to deploy your game on both of those platforms. Yes they do cost money, but start calculating how much your time is worth.
If you are doing this as an exercise to learn how Game Engines work then that is awesome and you should pursue it. If you are more focused on developing an actual game, look into one of the existing kits. Unity3d is by far the easiest and cheapest kit for all the features it has.
I've been doing a lot of Windows Phone 7 games development and have started looking into porting my apps and games to iPhone and possibly Android at a later date.
From my understanding solutions such as MonoTouch are not worth the effort, so should I stear clear of such things?
I'm well versed in C++ coding and would like to do that on the iPhone if I can't use C# effectively, especially for performance critical situations which games have a lot of. I don't underestimate the power of C#, just C# on iPhone (and I think that's a fair thing to be afraid of).
Would there be any good reading material I should get into before building up code for iPhone? I'm already downloading x-code but don't know what to do beyond that, I odn't even know how to wrap C++ around objective-c but I feel that would be the best compromise given my situation.
I guess a broader question is how would I handle multiplatform programming? My currnet idea is to build three seperate development frameworks which share the same design principles as each other so porting apps between platforms is straight forward (but would still require re-writing code every time).
Is that a smart way to do it or am I just crazy?
C# on the iPhone not only works fine, but it works brilliantly. It is compiled AOT that is "Ahead of Time" (normally .NET code is compiled JIT - "Just in Time") down to machine code just like a normal compiler would produce. It's absolutely fast enough for game development and about 100 times easier to use.
I have two XNA games working on iOS and my own crowd-funded iOS port of XNA, which is also coming soon to Android (ExEn). So I can definately confirm that C# on iOS is fine for game development.
Now if you're doing a 3D game, I'd be looking into Unity. The cross-platform XNA solutions are all 2D-only - for the moment anyway. The other option is using OpenGL directly with the bindings in MonoTouch.
Basically you should do everything you possibly can to avoid having to write your game more than once. To that end, C# is an excellent choice.
You don' have to wrap c++ around objective-c. c++ compiles just fine on the iPhone. You can easily develop all your code for multiplatform games in c++. What I don't know is how c++ compiles on wp7, but that's another issue :)
From my understanding solutions such as MonoTouch are not worth the effort
I've just voted to close this on the grounds of it being subjective and argumentative...
... but while it's still open ...
In my experience, MonoTouch offers an excellent solution:
if you want to leverage a single code base and existing skills
if you want to take advantage of CLR memory management
if you can cope with the increased download size
if you don't need to link with existing Obj-C libraries (you can link to these in MT, but in my experience it's not always a straight-forward process to do so)
if you can budget for the MonoTouch license fee
For XNA in MonoTouch, see http://monogame.codeplex.com/ (latest now on GitHub)
For general iphone getting started advice, try: https://stackoverflow.com/questions/332039/getting-started-with-iphone-development
I am quite aware of both java and C# .Net .when i try to create a new windows application which are the factors that decide which technology should be opted?
I know of one thing ,for great and faster UI development Visual studio helps a lot.
There are several factors I would consider...
What are your programmers used to working with already? What third party libraries are you likely to need, what's available on both platforms?
Does platform independence matter to you?
Would LinQ be advantageous?
If you're starting from scratch, costs for the platforms?
Both platforms have strong communities around them...
Hope this helps...
Dotnet is pretty much native in Windows which obviously makes it more suited to writing Windows programs. Using Java in a Windows-only environment makes it much harder for you since it effectively just adds another unnecessary API layer.
You will soon realise that all integration points between your Java code and Windows are a bit problematic. For instance, creating installation programs, access file system, reading/writing the registry, starting/stopping services, task bar icons, using Windows GUI components (media player, IE...), help file system...
It all boils down to this imo: The Dotnet framework is much richer in terms of functionality than the Java dito, mainly becuase Java is cross-platform and thus needs a "one-size-fit-all" approach to its API. My experience is that you will only get frustrated trying to "emulate" a Windows native program in Java.
Choose the one with which you are most familiar. The two platforms are different enough that skills from one does not transfer easily to the other.
In any case, try making a trivial application in both your scenarios and see how it works for you. The initial impression is important as it is probably indicative of how well the rest of the work will be.
It also depends on what kind of windows application you want to build. If it's just a question of building a simple standalone application then, considering you know both languages equally well, I wouldn't hesitate and would go for a 100% microsoft solution, especially if you have to do specific things like accessing ActiveDirectory, the windows registry, etc.
Not that you can't do it in Java : you can always use AD through LDAP in Java for example, but the APIs are just "a bit" more complicated than the .Net ones (try to decode objectSIDs in Java without a few tricks).
Now if you have to build an enterprise app. I just feel that popular frameworks like Spring and Hibernate are always coming out after their Java counterparts (disclaimer : this is a personal opinion; I didn't do any research on this, thoroughly comparing frameworks in both languages, but that's just the feeling I have). I don't know how good the .Net implementations are though, so I don't have a point of view on that. I just remember writing .Net 2.0 apps and not liking ADO.Net at all.
My view is that the frameworks I like do exist in both languages, but they are first developed for Java, then ported to .Net.
Now I'm not the kind of developer trying to defend his favourite language over the others. If I don't have external constraints to develop, then I choose whatever language gets my app up and running faster and in the most efficient way.
...But with java you will have crossplatform application on scratch.
Also coding UI in java is not difficult - if you read some guides before and use some frameworks as swing application framework or SWT framework.
If its Exclusively for Windows then .Net is best bet.
Yeah for a pure cross platform application Java can't be beat, but if you can manage it Silverlight is a subset of WPF and a pretty compelling cross-platform proposition on its own.
Productivity-wise I think WPF has an edge as it has a nice XAML markup language that can be easily created with the built-in designer in VS.NET or integrates nicely with MS' suite of expression products.