Eight reasons to choose Java to write iOS and Android apps

[Editor's note] The author of this article is Henric Müller, CEO and co-founder of RoboVM, and mainly introduces eight reasons for choosing  Java  to write mobile applications.  The article is compiled and presented by OneAPM , the domestic  ITOM  management platform  .

Java has been on fire for the past decade. In 2015, it was once again proved to be the backbone of the industry - occupying an absolute advantage in the TIOBE language index . Although there are some problems with the calculation method of the TIOBE ranking, the popularity of the Java language is obvious when combined with other popular rankings such as RedMonk and PYPL .

As a leading player in the industry, the pace of growth of the Java language has been relatively stable. But how to explain its recent surge? Oracle 's  use of Java 8 to  write Lambdas and Streams is obviously a big reason why. In addition, Java is even more powerful as a lingua franca on a fast-growing mobile platform. With the recent move of Android to OpenJDK and the approach of Java 9, I believe that Java's activity will continue to grow.

The many benefits of the Java language obviously attract new blood, but as veterans, we know that the proven platform prowess is what really attracts developers to Java. Listed below are 8 reasons why you should program in Java:

 

1. Static typing

With the ever-increasing complexity of backend and mobile applications, having a codebase that is easy to maintain and refactor is critical. Static typing ensures that developers remain sane throughout the development cycle of a project, it can detect a large number of program errors at compile time, ensure code optimization, and ensure Java's absolute leading position in the tooling ecosystem.

 

2. Runtime management

JVM的垃圾回收器有效降低了编写内存安全应用的复杂度,消除了手动内存管理时容易出现的大多数错误。而并发,作为在Java早期就已出现的重要属性,提供了线程安全回收,原始类型同步和简单易用的多线程API。反射(reflection)是运行时管理的最后一招,它确保了依赖注入(dependency injection)或面向方面(aspect oriented)编程等高级理念的实现。

 

3. 性能

考虑服务端应用的性能时,HotSpot JVM 的 JIT(Just-in-Time)编译器和它多种多样的垃圾回收器几乎让人毫不犹豫地选择Java。而提前(Ahead-of-Time)编译是移动平台上的主导机制。在安卓上,ART 为计算型重负荷提供了几乎原生的性能。而在 iOS 平台上,RoboVM 使用了 LLVM( C/C++/Objective-C/Swift编译所用的相同后端),从而达到与Objective-C和Swift相当或更好的性能表现。

 

4. 工具

如果不管理论上的益处,围绕语言的工具数量与质量才是真正决定语言成败的关键。Eclipse,IntelliJ和NetBeans之类的IDE(集成开发环境)是其他可比平台工具的优质对比标准。代码导航,重整,完善和模板使得书写和维护项目代码变得更为高效。代码热调换(hot-swapping),调试,性能分析和单元测试让你很轻易找到问题根源。源码控制、应用服务器管理以及编译和依赖管理的集成环境为你的项目部署提供了基础。

 

5. 庞大的社区

世界上大概有超过九百万Java程序员。这一数字进而催生了大量的Java会议,书籍,在线资源,论坛和培训计划。Java开发者可以从中选择来提高技能。相比于Java人才资源库,其他语言平台的资源显得微不足道。此外,由于Java语言同时应用于服务器端和移动应用端,Java开发者能更灵活地全栈中放光发热。

 

6. 第三方生态系统

不管你正尝试解决什么难题,几乎可以确认的是Java社区中已经有人提出了解决方案。你的后端需要大数据分析?没问题,你可以在众多方案中选择,如Hadoop,Spark或是Elasticsearch。不想亲自为手机应用写分析代码?Twitter FabricParse,你拿来用就行。需要JSON在后端和移动应用上同时实现序列化?简单,添加Gson,然后在全站分享你的POJO和序列逻辑。有了Maven和Grable的帮忙,添加第三方库就像在编译文件里添加一段代码那样简单。

 

7. 备选语言

虽然Java语言一直都是Java虚拟机里面的首要语言,而且正变得更具表现力。但是平台架构同时也欢迎其他语言。最近几年, Kotlin,Scala或Clojure等语言的采纳率正不断提升,这不仅仅是因为它们的语言特性,更是因为它们与现有的Java生态系统具有互通性。

 

8. 代码分享

我们将最为重要的问题放在了最后。Java在后端运行,不管是安卓还是iOS,它覆盖了几乎所有的大型平台。它的可移植性使你能够跨平台共享大量代码,进而节省应用部署所需的成本与资源。使用那些免费且有用的资源,将精力放在你真正的产品上,以此获得用户的青睐!

2015年对Java来说是辉煌的一年。或许,借助这个契机,使用Java编写跨平台移动应用会给你的2016带来事业上的成功。

OneAPM 能为您提供端到端的 Java 应用性能解决方案,我们支持所有常见的 Java 框架及应用服务器,助您快速发现系统瓶颈,定位异常根本原因。分钟级部署,即刻体验,Java 监控从来没有如此简单。想阅读更多技术文章,请访问 OneAPM 官方技术博客

本文转自 OneAPM 官方博客

原文链接: https://dzone.com/articles/8-reasons-your-next-mobile-ios-and-android-app-sho

 

 

Guess you like

Origin http://10.200.1.11:23101/article/api/json?id=326776888&siteId=291194637