如何科特林可以解决Java开发人员的痛点?

Kotlin Vs Java

科特林和Java

Kotlin 是一款高性能的语言 (由开发 JetBrains), 运行在JVM并使用现有的Java库和工具. On the other hand, Java也可以科特林组件无缝交互. 科特林的主要目标是使实际现实生活中的项目有用, 所以它已经从无到有,并提出有吸引力的对现有的Java开发人员. 这也很容易比其他基于JVM的语言,如Scala的学习. 从Java有一个科特林深的互操作性, Java开发人员更吸引到学习和测试. 科特林具有很强的商业支持和稳定的商业模式, 所以不会有可能在不久的将来得到抛弃. 从开发人员的角度来看,, 科特林是非常有前途的,它会在未来的日子里带来更多的机遇. 所以我们可以有把握地预测,科特林将是Java社区的下一件大事.

解决Java开发问题

JetBrains did not intend to do anything revolutionary with Kotlin. It wanted to provide a useful language that solves existing problems. 科特林有以下目标,这将有助于解决或避免在Java中存在的问题,并有更好的表现.

  • Provide an intuitive language that can infer from codes written by developers and do a lot of work on behalf of developers.
  • Improve productivity by reducing the effort needed to write code. For example, 一 50 线 (约。) 用Java编写的代码可以减少到 2/3 (约。) 在科特林线.
  • Prevent null pointer exceptions.
  • Provide quick code compilation.
  • Reduce learning time for developers by providing documentation and support.
  • 科特林代码语法是很容易理解, 因此,代码审查很简单,即使是新来的.
  • 运行时开销也低,标准库是小型和紧凑型.

除了上述主要优势, 科特林还提供了很多其他的支持,如Java和科特林之间轻松转码, 简单的IDE集成, 完全调试, 重新分解和剖析等. So, 总共, 科特林肯定是要减少所面临的Java开发人员的痛点.

爱科特林功能

科特林的显着特点介绍如下的Java开发者应该爱用.

No more null pointer exceptions

This is probably the most important feature. The null pointer exception is one of the most dreaded, unsolved issues developers face. Kotlin’s type system does not compile code that assigns or returns null. See the below example.

val name: String = null // tries to assign null, won’t compile

stephen getName() : String = null // tries to return null, won’t compile

Since every method call on a nullable type can potentially cause a null pointer exception, the Kotlin compiler forces the developer to use the Elvis operator whenever the call result is assigned to a non-null type.

Lesser coding

Kotlin compiler can infer or understand from the code written by a developer and can develop or write the remaining code unlike in Java. Java requires the developer to explicitly write everything which consumes a lot of time and effort. Kotlin saves effort and time and improves productivity. For example, Kotlin compiler can infer types in variable declarations as well as compiler-generated getters/setters/equals/hashCode. On the other hand, the Java compiler does not infer as much and requires the developer to explicitly write code.

易于学习和使用Java开发人员

Since Kotlin is nothing revolutionary, any software developer can learn and start to use it especially the Java and Scala developers. The main reason is Kotlin is dependent on Java in a lot of ways and extensively uses the Java library, 例如. Also, Kotlin was inspired by Scala and according to many; it looks a lot like Scala. 该代码使用JVM和javac的, the primary Java compiler. The learning curve for Java developers is not steep and they can leverage the Kotlin documentation and get started quickly with coding.

向下兼容

Kotlin offers backward compatibility for Java versions 6 和 7. It states in its blog that over the next few releases, it is going to speed up development workflow, reduce the size of the runtime library and provide more tooling support. Kotlin will be introducing a feature known as incremental compilation in its Gradle build plug-in. This will enable Kotlin to compile and build only the changes in the code and not the whole code over. This is going to save a lot of time.

IDE互操作性

科特林对提高生产力很多的支持. 它与IDE的高度互操作性, 因此重构, 调试, 搜索, 单元测试是很容易执行.

实施和使用上述功能真的很有趣, 因此,Java开发人员应该给它一个尝试和品味科特林之美. 也许, Java开发人员可以将他的Java代码的一部分入科特林,看看它如何执行. 无论路我们按照, 科特林肯定是要给你一个好印象.

让我们得出结论:

Its evolving state notwithstanding, Kotlin already looks like a tool that is going to improve productivity significantly. Many developers are positive about Kotlin enabling them to achieve a breakthrough in their productivity. A discussion on Hacker News website which hosts a discussion on Kotlin reveals that Kotlin solves many Java pain points without really reinventing how coding should be done. What are the challenges ahead? To find huge acceptance, it needs to be able to impress firms like Google which is a huge Java user and has been working on other alternatives to Java. It will be interesting to watch how Kotlin goes about its plans and how it faces the challenges ahead.

 

Tagged on:
============================================= ============================================== 在亚马逊上购买最佳技术书籍,en,电工CT Chestnutelectric,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share