From the course: Build Spring Boot Apps with the Kotlin Programming Language

What is Kotlin?

- [Instructor] I'm going to say very little about where Kotlin comes from and why you might want to consider it instead of Java for your next project. So here's the minimum, if you'd like, that you need to know about Kotlin before we start learning. Kotlin is an opensource programming language developed by JetBrains. JetBrains are the people who provide the IntelliJ IDE. In fact, they develop the language partly to build IntelliJ. Now, although it's opensource, JetBrains have been very open about the fact that they hope it will help them sell more copies of the IntelliJ IDE. Now, I've got on screen right now the Kotlin website and I want to just point out where you'll find the documentation for Kotlin. I think the documentation is pretty good. It doesn't look exactly like typical Java docs, but it's very navigable and you tend to find a clear explanation for anything that you're looking for. But how to get to it is not obvious. So, the first thing to do is to click on Learn at the top here and then you want to click on this link here to standard library. And this is the entry point to the documentation. There's a search function up here. So for example if we were to search for println, and we don't even need to press Enter, it'll give us a link to the most relevant page, we can click on that, and here's the documentation for the println function. Now, println does exactly what you'd expect it to do. So in fact, the documentation here is just actually this one line here prints the given message and a new line to the standard output stream, but as we get into some of the more detailed functions in Kotlin, we'll find there's some clear documentation here that's worth looking at. So, Kotlin was developed by the same people who built the IntelliJ IDE, and so it will be no surprise that you can write Kotlin code in IntelliJ. You can also use Eclipse, or in fact, just your favorite text editor, but as you probably guessed, IntelliJ has the best support for Kotlin right now, and in fact, we're going to use IntelliJ in this course. Also Google have adopted Kotlin as an official development language for Android apps. So Android's studio, which is also based on IntelliJ, has full support for Kotlin. However, we're not going to be building Android apps in this course, so we'll be sticking to the regular IntelliJ. Don't worry if you've not used IntelliJ before, as we will be installing and configuring it in just a moment. Before we do that, however, I just want to mention a little about the features that make Kotlin a compelling alternative to Java. Firstly, one of the features of Kotlin is that the way the language is designed means that it's very difficult to get a null pointer exception. It's not completely impossible, but you do have to actually write some quite specific code to get one. We'll be understanding how Kotlin avoids the null pointer exception as we progress through this course, but I hope you'll agree, this is a useful feature. Null pointer exceptions are a common cause of software crashes. So hopefully avoiding them at compile time, which is exactly what Kotlin does, will make your code more robust. Secondly, Kotlin is far less verbose than Java. You can often write the equivalent code in far fewer characters and a lot of the boilerplate code that we write again and again in Java, such as getters and setters, hashcode and equals method for our classes, well, these will be written for us. Thirdly, Kotlin provides immutable variables. That is variables who's values cannot be changed. And in fact, more than that, there are immutable collection types as well. These are really important for functional programming and of course, even an object all into programming, using immutable variables can make your code safer. And finally, Kotlin provides genuine functional programming, far better than the Lambda's approach that was introduced in Java 8. And we're going to be covering all of these features as we progress through the course. The final thing I want to say before we get started is just a little about how this course is structured. We're going to start learning about the Kotlin syntax and how to write code in Kotlin that would be a replacement for Java code. Now this is going to be about the first two-thirds of the course, because we need to get a really good grounding in Kotlin basics. So at this point, we're going to be writing console-based applications, really object-oriented code, not production standard, but just enough for us to be able to explore the syntax and the Kotlin libraries. Along the way, there will be a couple of exercises for you to have a go at as well. Once we've got through that, I'm then going to introduce how you would use Kotlin with a Java framework. In this case, Spring Boot. And in fact, by the end of the course, we'll have built a fully functional web application with a database using Spring MVC and Hibernate. After we've introduced Spring Boot, we're going to then take a look at functional programming in Kotlin and we'll figure the course with a few extra topics, which I couldn't really fit in anywhere else. So that's a long way to go. And to get started, in this chapter, I'd like to just install and configure IntelliJ. Now, if you're already an IntelliJ user, then you don't need to watch the rest of this first video. You can skip straight ahead to chapter two, where we'll start learning about Kotlin. But if you have not used IntelliJ before, if like me, you're primarily an Eclipse user, then do follow along, because we'll install IntelliJ together.

Contents