Movatterモバイル変換


[0]ホーム

URL:


Skip to content
DEV Community
Log in Create account

DEV Community

Magda Miu
Magda Miu

Posted on • Originally published atMedium

     

Hello Kotlin

At this moment, in the world, there are more than 5000 programming languages available. Now, the first question asked by us, the developers, is why do we need another programming language like Kotlin?

Kotlin is a general-purpose language that supports both functional programming and object-oriented programming paradigms. It’s an open-source project developed mainly byJetBrains with the help of the community. Like Java, Kotlin is a statically typed language, however, in Kotlin we can skip the types.It’s an open-source (Apache 2.0) project developed mainly by JetBrains with the help of the community.

The Kotlin philosophy is to create amodern andpragmatic language for the industry, not an academic one. Pragmatic means getting things done, and in terms of programming represents the capability to easily transform an idea into software.

Kotlin is based on many programming languages like Java, Scala, C#, Groovy, Python and it tries to reuse what works better in those languages.

The name of the language represents the name of an island according toWikipedia: “Kotlin is a Russian island, located near the head of the Gulf of Finland, 32 kilometres (20 mi) west of Saint Petersburg in the Baltic Sea.”

Kotlin is a popular language: in the latest Stack Overflow developersurvey, it ranks as the4th most loved programming language and it is used to developer apps like Pinterest, Uber, Slack, Trello, etc

The Kotlin project was started in2010 and it took 6 years in order to validate all the design choices made. The community was involved in this project, because community it is not only about validation but also about inspiration.

In2017 Google officially announced at Google I/O that Kotlin is a first-class citizen in the Android world.

In2018 JetBrains launched the 1.3 version and this year they launched1.3.50 version.

✅ Conventions

  • The same conventions like on Java
  • Uppercase for types
  • Lower camelCase for methods and properties
  • Semicolons are optional
  • Reverse notation for packages
  • A file could contain multiple classes
  • The folder names not have to match the package name

🛠️Development & Build tools

  • Kotlin/JVM : JVM 1.6+
  • Kotlin/#"https://kotlinlang.org/docs/reference/using-gradle.html">Gradle,Maven,Ant, andKobalt. There are also some build tools available that target client-side JavaScript.

📌Main advantages of Kotlin

Readability:

It’s already known that developers spend more time reading existing code than writing new code. And we also know that a code is clean if it is easy to understand.

Imagine you’re a part of a team developing a big project, and you need to add a new feature or fix a bug. What are your first steps? You read a lot of code to find out what you have to do. This code might have been written recently by your colleagues, or by someone who no longer works on the project, or by you, but long ago. Only after understanding the surrounding code you can make the necessary modifications.

Interoperability

Regarding interoperability, our first concern probably is, “Can I use my existing libraries?” With Kotlin, the answer is, “Yes, absolutely!”

Safety

In general, when we speak about a programming language as being safe, we mean its design prevents some specific type of errors in a program. For example, in Kotlin, the designers of the language worked to eliminate the NPE.

Tooling

Kotlin is a compiled language. This means before we can run Kotlin code, we need to compile it. And in terms of tools, we have a lot of possibilities here.

🔖 Best practices

  1. Agree on a set ofconventions before you start to write code in Kotlin
  2. Don’t treat it as Java with a different syntax
  3. Use a linter (likektlint )
  4. Don’t hide too much info
  5. Choosereadable over short expressions

📚 Resources to learn Kotlin

  • Kotlinlang.org: The official Kotlin website. Includes everything from a guide tobasic syntax to theKotlin standard library reference.
  • Kotlin Koans Online: A collection of exercises in an online IDE to help you learn the Kotlin syntax.
  • Udacity course: “Kotlin Bootcamp for Programmers”. Essentials of the Kotlin programming language from Kotlin experts at Google. For programmers coming from Java or other object- oriented languages.
  • O’Reilly course: An 8-hour Kotlin course, “Introduction to Kotlin Programming,” by Hadi Hariri, a developer at JetBrains. Requires subscription; 10-day free trial available.
  • Treehouse course: “Kotlin for Java Developers” teaches Kotlin with an emphasis on Android. Requires subscription; 7-day free trial available.
  • @kotlin: The official Kotlin Twitter account.
  • Kotlin Community: A list of offline events and groups from kotlinlang.org.
  • Kotlin Slack: A Slack chat community for Kotlin users.
  • Talking Kotlin: A bi-monthly podcast on Kotlin and more.

Enjoy and feel free to leave a comment if something is not clear or if you have questions. And if you like it please 👏 and share !

Thank you for reading! 🙌🙏😍✌

Follow me on Twitter:Magda Miu

Top comments(1)

Subscribe
pic
Create template

Templates let you quickly answer FAQs or store snippets for re-use.

Dismiss
CollapseExpand
 
krysal profile image
Krystle Salazar
  • Location
    Venezuela
  • Work
    WebDev
  • Joined

Thanks for this introduction, very informative!

Are you sure you want to hide this comment? It will become hidden in your post, but will still be visible via the comment'spermalink.

For further actions, you may consider blocking this person and/orreporting abuse

Squad Lead Developer at Orange | Google Developer Expert for Android
  • Joined

More fromMagda Miu

DEV Community

We're a place where coders share, stay up-to-date and grow their careers.

Log in Create account

[8]ページ先頭

©2009-2025 Movatter.jp