What is kotlin?

 So Kotlin is a modern programming language,  and it has been inspired off of the languages that  came before it--  Java, C#, Python.  The creators of the language really tried  to take the best of those languages  and really put it into a single language that  makes it really easy for developers to use  and helps them be really productive.  


So it is a general purpose language.  It supports functional programming, as well as  object-oriented programming paradigms.  It's also statically typed.  So the type of the data is determined at compile time,  so that helps catch a lot of errors  in your code ahead of time.  But it also has a powerful type inference system.  So when you're defining your variables and things like that,  if it can infer what the type of data it is-- like for example,  it's going to be an integer--  then you don't have to explicitly say  that it's going to be an int.  And so by being smart about it and knowing what type that you  want to use, it actually cuts down the amount of code  that you need to write, making it faster for you to develop.  And Kotlin is also open source.  It was created first by JetBrains,  and there's a whole community of contributors contributing to it  and also JetBrains and Google have formed the Kotlin  Foundation as a partnership to really  promote, protect, and advance the Kotlin programming  language.  So there's a lot of investment in this language  to move it forward.  All right.  So let's talk about a little bit of the history.  So this project, the Kotlin project, started in 2010.  And then Kotlin 1.0 was actually released in 2016,  and then it just kept picking up steam.  In 2017, Google announced that it was officially  supported language for Android.  And that was huge news because before,  when building Android apps, you had to use Java.  But now, you can write them in Kotlin.  So both are equally supported now.  You can use Java or Kotlin, but Kotlin is rapidly  gaining popularity.  And in recent years, in 2019, at Google I/O,  Google announced that Android would become Kotlin first.  So some of the new features, like the Jetpack features  and API, some of those new things  are going to be Kotlin first.  So as a developer, in order to take advantage of the latest  and greatest on the Android platform,  you really want to start investing in learning Kotlin  so you can take advantage of those.  And I also wanted to add that Kotlin, as a language,  has also been improving over time.  So as recently as March of this year,  Kotlin 1.4 preview has been announced.  So they're just adding features to improve the language  on a continuous basis.  Can we go to the next slide?  Great.  Thanks.  So now let's talk about why Kotlin?  When we as developers, what they enjoy using about Kotlin,  there is some top reasons about why developers love Kotlin.  


And first of all, it's a very expressive language.  And when I say expressive, it means  that you can express the concepts  that you want in your code with very few lines of code.  So you'll see example later that [? Lalit ?] will show you  where if you have a lot of boilerplate code in Java,  you can actually reduce it to very few lines of Kotlin code.  And so it's kind of a magical moment there.  And there's so many different little things  that Kotlin does to help you write shorter code-- like I was  saying earlier, type inference.  So that's a great thing to help us become more productive.  Also, code safety with type system.  It really tries to help you catch your mistakes ahead  of time or prevent you from even making mistakes  in the first place.  So there's something called null safety  where Kotlin really tries to prevent null pointer  exceptions, and [? Lalit ?] will also be giving you  some examples about that.  Another huge feature is that Kotlin is  100% interoperable with Java.  So for those of you who already have projects in Java,  you can add Kotlin to it.  And it will work seamlessly.  So if you already have an Android app in Java,  you can perhaps add unit tests in Kotlin.  Or you can add as little or as much Kotlin as you want.  And so over time, then more of your code base  can become more Kotlin.  So that's a great feature.  It's not like you have to commit right away.  You could slowly add new features in Kotlin to your app.  Next is tool-friendly.  


That was one of the huge--  one of the things that the creators of the language  really wanted to get right.  They wanted to make sure that it works with existing  tools and infrastructure.  So there's great tooling support.  You can use IntelliJ or Android Studio or Eclipse--  a number of popular tools.  Also, another big benefit of Kotlin  is structured concurrency.  In an Android app, typically you will  have a lot of background operations like network calls  or database operations.  And when you do those, your code can get kind of complicated.  There's a bunch of callbacks.  It could be hard to debug.  And so with coroutines and what's offered in Kotlin,  you can actually make your code more sequential so it's easier  to read.  Kotlin has actually grown to be the number four  most loved language among developers based on the Stack  Overflow Developer Survey in 2019,  so it is a language that a lot of developers  are very excited about.

Roy

I have lot of interest in collecting information and spreading it to everyone. and that is the actual reason why I'm here on this platform?

Post a Comment

Previous Post Next Post