Which is easier to learn coming from a C# background: Objective C or Java?
I've used C# quite a lot, it was my main programming language during University and I wondered which of the two languages for developing for Android or iPhone are easiest to learn bearing that in mind.
I'm interested in people's opinions on the two languages, I've dabbled a little in both 开发者_如何学Gobut nothing more than a couple of hours. I'm also interested in people's opinions on Windows Phone 7 as an app/game platform, as this uses C# so would be an obvious choice for transitioning into that area.
Opinions?
That would be Java but you will miss LINQ a lot.
You can develop in C# for the iPhone with MonoTouch but it's not free and you'll never know if Apple sends them out in the cold (unlikely). Soon you can even use C# for Android development with MonoDroid but I kind of feel that that's a smaller win for a C# programmer than not having to learn Objective-C. Java and C# are so close that the transition most probably will be smooth.
As a C# programmer I think that the Windows Phone 7 development platform looks very promising but my experience tells me to wait and see. Microsoft has a terrible track record in the mobile business and they also have a tendency to make big changes between early releases.
Java I think. The semantic model for C# is closer, and ObjectiveC for iPhone apparently is not garbage collected. You will probably miss some of the features of C#, but most people get over it.
Your choice of language will depend on your motives. If you intend to write commercial software that you want to sell, it's probably best to go for Objective-C and aim at the iPhone/iPod Touch/iPad. Objective-C is a steeper learning curve for a C# programmer than Java but that is as nothing compared with actually thinking up an app that people will want to buy and getting it to commercial quality. And people who own iDevices are still more numerous than people with Android devices and they probably have more expectation of having to pay for apps.
If you are doing it as a hobby then you will want to choose whichever platform your current smartphone/tablet or whatever supports. You are going to be the primary user of your apps. It makes sense to develop apps that you can use. Another consideration, if you are a hobbyist: to develop an iPhone app you need an Intel Macintosh and a $99 Apple electronic certificate to deploy apps to an iPhone even for testing.
The actual language is a relatively minor consideration. A reasonably competent programmer can pick up Objective-C in a couple of weeks. The frameworks will take a little longer, but if you are doing it as a learning experience, it will be a more rewarding experience than learning Java which is nearly the same as C# by comparison.
I have a co-worker who made an attempt to learn Objective C to do I-phone development. We are both .Net developers working mostly in C#. He had a very long learning curve and finally abandoned trying to learn Objective C not only because of the language barrier but also because of the setup. Coming from a C# background, expect a long haul getting your arms around Objective C. Java on the other hand is more like C# and might be better to start with. I am in the same boat as you and actually decided on Windows Phone 7 development first because it is C#. I would go after the droid market next as I think it would be easier to learn.
I know this has been said before, I figured I would point out a fact, C# came about because of the law suit surrouding Microsoft's Java Virtual Machine. I would describe C# as the son of Java and C++, at least in early versions. C# 4.0 has added features neither of them have, its really matured into its own language.
So if you come from a C# background then you should be able to pick up Java effortlessly. Of course Objective-C is C++ on crack, so it should still be possible, what you will miss is Visual Studio and all the features it brings. The reason C# is so easy to develop for is all the features in Visual Studio and most of the features of the language are supported.
As you can see, C# is partially based on Java, so that step would be a lot easier. I'm also familiar with Java, C# and ObjC and started out with C#, then did Java and now use Objective-C..
And the C# -> Java part was because my education did it that way.. ;-)
And because WEBAPPS are a thing that is HOT right now.. i would say.. Java is a safer choice, because you could base a webapp on that.. although ObjC might also have those possibilities, i just don't know about it..
I switched from C# to Java because I needed to code a lot of systems integration. C# was just not powerful enough / limited to .NET systems. I agree that LINQ is a nice feature, and that generics in C# are a lot more straightforward, but if you start looking at the whole Java ecosystem, I guess these are just minor losses.
Just to sum up some great things you get when switching to Java: Eclipse IDE, maven build system, Spring dependency injection and aspect oriented programming framework + OSGi, GlassFish application server, Grizzly, Jetty, Hadoop, the apache commons libraries, ... . All these things come in Java, and are very useful when you start programming services.
I don't know about Objective-C
Hope this helps, J.
Have you considered using MonoTouch?
精彩评论