如何科特林可以解決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.

 

標籤:
============================================= ============================================== 在亞馬遜上購買最佳技術書籍,en,電工CT Chestnutelectric,en
============================================== ---------------------------------------------------------------- electrician ct chestnutelectric
error

Enjoy this blog? Please spread the word :)

Follow by Email
LinkedIn
LinkedIn
Share