Welcome to the Treehouse Community
Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community!
Looking to learn something new?
Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.Start your free trial
Laurence Bowe6,221 Points
What's androids preferred language?
Hi, I was just wondering whether java was the most preferred as I read that it was a rather old, slow language and that google had made its own, which lead to think well apple whats us to use swift now instead, WHATS ANDROIDS OPINION? THANKS HEAPS IN ADVANCE SORRY IF THIS IS A COMPLETE BEGINNER QUESTION!!! :)
Daniel Hartin18,106 Points
Java is the language used as default in android development however various plug ins have been developed to use other languages although these are usually slower and generally unsupported. Java is a fairly recent language I believe developed in 1995! There or there abouts. It was not created by Google. Apple/ios use a variation of C, as far as I am aware C is one of if not the fastest language however it only really comes into its own it extremely performance critical code such as high end game development (they only use C). In my opnion Java is fast enough for the vast majority of apps and mobile game development what c gives with speed it takes in difficulty (java is easier to learn in general than c or objective C). I have no experience with the new swift language made by Apple whatsoever so can't comment on that but most apps on the market now will of been designed in java for Android and objective c for ios.
Iskandar Fendi5,700 Points
It is a little bit of pain to do programming in C or C++. As far as I know (Not guarantee it's correct), Both of these languages don't have Garbage Collection automatically handled like Java. Basically, in Java, you can declare: Robots aRobots = new Robots(); and that's it!
But in C or C++: You should do something regarding freeing up a memory because it can cause memory leaks. However, if you do it correctly, you program could be wicked fast because it is so Native and it can directly communicate with the machine.
In conclusion, I would prefer Java.
I believe it has already been very well explained to you, through the comments above. However, I just wanted to point out a few things.
- The reason why Java is so popular is simply owing to the fact that it was built with an aim to be platform independent (can run on any platform) and encompasses the need for the web as well. Not taken care by C or C++.
- Its present everywhere. From embedded systems, to mobile phones to financial applications. Though I've heard in the past Microsoft went foul mouth about the language, but they forget where did their C# evolve out of. JAVA!
- I am not sure what you mean by slow language per se. I've been working with Java for almost 5 years now and as Ben Jakuben mentioned, I too, haven't faced any such problem up until now. Using good programming practice, in terms of code design really makes a difference no matter which programming language you opt. For e.g. in Java, when there is a situation where you have to compare a variable to a number of cases, its better to use a switch statement rather than a chained if else. Reason being Java will use less computing overheads for the former. There are many practices like these that helps you make quicker programs and thus applications. I believe the same would apply for Android and Swift.
- The thing with any object oriented programming is, if you code well it will reflect in your final application, if you code bad it will show too.
Hope it helps.