Take the 2-minute tour ×
Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. It's 100% free, no registration required.

I'm a C# dev and I have plans of starting to develop apps targeting Android, which of course means Java. I have heard good things about Mono for Android and the idea of reusing my skill set is appealing, however the licensing cost (for now) is a bit prohibitive to me. On the other hand, from what I can see, Java is very similar to C#, so I'm predicting that shifting my skills to it will be more or less easy (easier than shifting to Obj-C I guess).

Am I wrong in assuming that?

Are there any hidden costs I'm blind to?

share|improve this question

closed as off-topic by gnat, MichaelT, Bart van Ingen Schenau, GlenH7, Kilian Foth Nov 26 '13 at 13:44

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Questions seeking career or education advice are off topic on Programmers. They are only meaningful to the asker and do not generate lasting value for the broader programming community. Furthermore, in most cases, any answer is going to be a subjective opinion that may not take into account all the nuances of a (your) particular circumstance." – gnat, MichaelT, Bart van Ingen Schenau, Kilian Foth
If this question can be reworded to fit the rules in the help center, please edit the question.

8  
Learning more languages is essential for a long-term career. Languages come and go. In the long run, C# will not be the only language you ever use. Given the chance to learn a new language, why ask? Why not charge forward? –  S.Lott Apr 22 '11 at 15:46
    
I am told, although I have not used it myself, that you can develop on Mono in C# using SharpDevelop and target Android. Might be worth considering if you wanted to stick with C#. –  Steve Haigh Apr 22 '11 at 16:54
    
Do you have Visual Studio Professional (or better) already? –  Jetti Apr 22 '11 at 19:30
    
@Jetti. Yes I do. VS2010 Pro. –  System Down Apr 22 '11 at 20:18
    
well that's good. When I first looked into MonoDroid I was upset because it requires VS2010 Pro or higher. So that would still be an option for you. –  Jetti Apr 22 '11 at 20:30

7 Answers 7

up vote 9 down vote accepted

Java as a language is similar to a subset of C#, because by choice, Java has quite a minimal amount of language features (which is also why it is often used as introductory language in university). Learning the Java language is a matter of an hour for an experienced C# programmer.

However, the Java platform comes with a lot of things you will have to learn. For example, how to do event based programming and GUI programming in general with different frameworks. How to do data bindings. And so on, and so forth. This is actually quite a lot of stuff to learn and it might take some time for you to feel as comfortable with Java as you do with .NET.

There is nothing that the Java language has, that C# doesn't have, and nothing that the Java platform has, that .NET doesn't have. So I see no benefit in switching. Especially since C# is the richer language of both.

share|improve this answer
3  
Android doesn't use the Java Platform but rather has its own platform that by default has Java as the programming language. So whether you choose Java or C#, you'll be learning the Android Platform. Therefore I don't see notable benefits for C# here. –  dancek Apr 22 '11 at 19:57
    
@dancek: We reuse entire libraries between web apps, desktop utility apps, iPhone apps, and soon to be Droid apps. But, ya, you're probably right .. there's no notable benefit to being able to simply add a reference and leverage thousands of lines of already developed and tested code without so much as a recompile ... There's also not really any notable benefit to already knowing all the API's for making web calls, serializing JSON, parsing XML, etc, etc, etc that comes with using a large ecosystem like Java or .Net that one already knows ... –  qes Apr 22 '11 at 20:38
    
@dancek: also, I would classify what you call Android's "own platform" simply an additional set of API's, since you still have the standard Java libraries at your disposal (and those cover a heck of a lot more than just the Java language). –  qes Apr 22 '11 at 20:43
    
@qes: You make some quite valid points. I didn't mean to be rude or anything (as I feel you are to me), what I meant was that as a language I see no reason to prefer C# over Java since Java is the standard for Android developement. The OP only asked about utilizing an existing skill set, not about using existing libraries. –  dancek Apr 22 '11 at 21:19
2  
sorry just being sarcastic. –  qes Apr 22 '11 at 21:24

You are right, Java and C# are very similar. The biggest cost will be learning the Android framework and maybe the tools (Eclipse), but it's probably worth it.

share|improve this answer
2  
underline the framework - picking up a new IDE is rarely The One Big Risk in a project. Learning how to work in the Android environment would be an issue whether or not Java were the only supported platform. –  Bob Cross Apr 22 '11 at 17:08

I'm a C# guy myself and have recently been forced into Java (due to school) and found that I really enjoy it. The one thing that I miss (which to me would be a cost) is Visual Studio. I really like that IDE and to me, nothing comes close in the Java world. For school we need to use BlueJ but for personal Java I use IntelliJ IDEA Community Edition. Other than that, I have found Java very enjoyable and I hope you do too.

share|improve this answer
2  
Netbeans I think is closer to Visual Studio (lots of wizards, very intuitive GUI). But I agree; I use C# and wish I used Java because honestly, I find it fosters better architecture. Maybe that's just my experience that most .NET developers are ignorant of design patterns and proper software engineer practices, while Java guys embrace it (sometimes too much i.e. architecture astronauts). –  Wayne M Apr 22 '11 at 20:45
    
I use Netbeans sometimes too and it is similar to Visual Studio, but the intellisense is terrible (lag wise). It isn't as bad as Eclipse but it is pretty bad. It gets to a point where I just want to give up! –  Jetti Apr 22 '11 at 20:57

Speaking out of my rear but with some confidence that this guesstimation is more or less right, here it goes:

The total cost C (in terms of time only) of switching to Java is proportional to the avg. cost avgC (time) of getting over the language/toolchain learning curve multiplied by the maximum number of edges in a network of n programmer (the burden of communication and collaboration), not amortized by each individual's familiarity with the new language (otherwise, we'll have to play with weighted graphs and get rid of avgC)

C = avgC * n(n-1)/2

If it is only you, then n=1 :)

If terms of risk, you take that and multiply by a risk factor R specific to the size and business importance of the application.

C = avgC * n(n-1)/2 * R

If it is a pet/exploratory project to learn the skills, we can say that R approximates 1 (but it is not one because there is still a risk of failing or doing poorly and thus not getting the desire skills.) If it is a real, production system, then depending on the size, R increases (possibly exponentially).

Putting all that for-fun-but-not-really puzzle aside, the cost of trying Java (or any other language) on an exploratory project with minimal risk should be minimal to you. And it should only involve learning the language and the toolchain (which are very similar to what you know already.)

Go for it ;)

share|improve this answer

Are there any hidden costs I'm blind to?

The cost of later also needing to learn Objective-C when you want to target iPhone's.

I wouldn't dismiss MonoDroid/MonoTouch so quickly, that licensing cost can save you a lot of time in the end.

share|improve this answer
    
downvoter care to comment? –  qes Apr 22 '11 at 17:39
    
Good point. I was thinking of that earlier. No plans yet for iOS, but it pays to be prepared guess. –  System Down Apr 22 '11 at 18:36
    
leveraging your existing knowledge is smart business. Learn Java if you want to for the sake of learning Java, but that will be a time investment. Not that there won't still be time investment if you use MonoDroid, but it's likely to be less. –  qes Apr 22 '11 at 18:38
2  
Is MonoDroid even production ready yet? I know I'm on the mailing list and last time I checked it was in beta status. –  Jetti Apr 22 '11 at 19:12
    
@Jetti: Yes, MonoDroid is officially released: tirania.org/blog/archive/2011/Apr-06.html "we ... provide a complete set of tools that ... assist developers from creating their first Android application, to distributing the application to the market place, to guides, tutorials, API documentation and samples" –  qes Apr 22 '11 at 19:27

When we write programs, what we call the "programming language" is really only the articles, prepositions, and punctuation of the language. The nouns, verbs, and adjectives all come from the libraries and the rest of your code base, which is the real meat of your software.

Learning the language is insignificant compared to learning the libraries. Additionally, trying to learn Android without learning Java is probably going to be more difficult than learning both, because of all the resources that will be inaccessible to you. You're also adding one more level of risk. What happens if you need to upgrade Android platforms but the C# infrastructure is too slow in following?

share|improve this answer

You should look a bit closer at MonoDroid or MonoTouch before you dive in and pay the fees.
Some people here seem to be spruiking it as a bit of a silver bullet, without telling you about the details.

One thing you'll want to look at is the fact that your user interface code and any code that controls the phone, will not be portable, only your "business rules" code will be. Have a look at the Xamarin FAQ
I have a MonoTouch or WindowsPhone 7 application, can I just rebuild it with Mono for Android and target Android?
Although you can write the user interface and phone controlling code in C#, you will still have to do this according to the platform specifics and so this code is not portable across platforms. This means you still have to learn the platform specifics for each platform whether it be through C# using MonoDroid, or the native Java calls for Android.

Here are a few things to consider:

  • C# syntax is almost identical to Java.
  • You will have to learn, and code for, the Android platform specifics (UI and phone control) whether you use C# through MonoDroid, or using the native Java API. Doing this through Java should not be a big jump for you because of the similarities in syntax with C#.
  • How much of your code can you decouple cleanly from your UI and phone control code, to pure 'business rules'? That is the code that will be portable across Mono projects and is where you will get your productivity benefits.
  • Although you'll have access to some of the advanced language features of C# that Java doesn't have, when developing for Android, you will still not be able to do more than you can with the native Java API.
  • In reference to the previous point you'll have to consider the possibility of the converse. That is the possibility that MonoDroid will not implement some of the native features of Android, or that there will be a delay between new Android releases and the implementation in MonoDroid, and how important those sorts of delays or missing implementation will be to you.
  • MonoDroid will add about 4.4MB to your application size. That is not such an issue for Android 2.2 and higher, because you can install apps to the memory card and the market share of Android 2.1 and below is getting smaller, (although I still have a 2.1 phone). 4.4MB + is not such a big deal over wi-fi, but could be slow over some phone networks.

Don't get me wrong, I'm not criticising Mono, MonoDroid or MonoTouch here, or saying don't go that route. I think they are brilliant projects and some people are obviously finding them useful. I felt compelled to answer though because there are some very one-sided opinions here that fail to point out a number of things you might want to consider.

share|improve this answer

Not the answer you're looking for? Browse other questions tagged or ask your own question.