Course info
Nov 1, 2016
2h 9m

Java as a programming language is almost 20 years old. Java hasn't changed a great deal over those 20 years, which is both a strength and a weakness. Java is very verbose, with lots of ceremony needed to do even the simplest thing. Enter Kotlin, a more modern version of Java. It adopts functional ideas such as immutability and first-class functions, out of the box, and it is also object-oriented. It aims to reduce the 'noise' that Java has and to make programs more concise and readable. This course, Getting Started with Kotlin, introduces you to Kotlin and will get you up to speed very quickly so that you can adopt this language in your projects. First, you'll learn how to install the Kotlin tools and set up the IDEs to use Kotlin, as well as learn some basic language syntax. Next, you'll learn how to start using the object-oriented features of Kotlin. You'll finish the course by learning how to use the programming features of Kotlin, and also how to write and run tests in Kotlin. By the end this course, you'll have a strong foundation of knowledge on basic syntax and features of Kotlin.

About the author
About the author

Kevin has spent way too many years in the software industry. Starting on PL/1 on IBM mainframes then graduating through dBase IV to Windows and eventually onto Java, .Net and now JavaScript where he finally thinks he has found a home until the next new shiny comes along.

More from the author
Java Web Fundamentals
3h 22m
Jun 5, 2019
Building Web Applications in Kotlin Using Ktor
2h 12m
May 31, 2019
Kotlin: Using Coroutines
3h 50m
Aug 10, 2018
More courses by Kevin Jones
Section Introduction Transcripts
Section Introduction Transcripts

Course Overview
Hi everyone, my name is Kevin Jones, and welcome to my course, Getting Started with Kotlin. I'm a developer and owner at Rock Solid Knowledge, a software development company based in the United Kingdom. Kotlin is a new language for writing applications on the JVM. It is a better Java than Java. This course is a quick introduction to developing Kotlin applications; no prior Kotlin knowledge is necessary. Some of the major topics we'll cover include, installing Kotlin tools and setting up the IDEs to use Kotlin, basic language syntax, using the object-oriented features of Kotlin, using the functional programming features us Kotlin, writing tests, and testing in Kotlin. By the end of this course, you'll know the basic syntax and features of Kotlin. Before beginning the course, you should be familiar with programming in Java. I hope you'll join me on this journey to learn Kotlin with the Getting Started with Kotlin course, at Pluralsight.

Programming with Objects
Hi, my name is Kevin Jones, and this is the Programming with Objects chapter from the Getting Started with Kotlin class from Pluralsight. In this chapter, we're going to take a look at classes and constructors, which might seem unusual. So obviously in Java, we define a class, within the class, we define a method with the same name as the class, and no return type, and that operates as a constructor. But the syntax in Kotlin is different. So we'll see what syntax is, and how we can use that syntax to generate a single constructor on multiple constructors for a class in Kotlin. Kotlin also supports interfaces. So the first thing we'll take a look at is how we define interfaces in Kotlin, and then how we can create a class that derives from that interface.

Working with the Java Ecosystem
Hi. My name is Kevin Jones, and this is the Working with the Java Ecosystem chapter from the Getting Started with Kotlin class. So, in this chapter, we'll investigate how the Kotlin language and the Java language can interoperate. Generally, we'll see that these two languages work together very, very well. However, there are going to be occasional differences. So, for example, Java has the concept of beans, we have properties with get methods and set methods, in Kotlin we don't do that, in Kotlin we just declare the variable. So we need to see how properties and beans interact across the two languages. Kotlin does not have any static methods. We saw we have the idea of companion objects. Suppose we create a variable inside that companion object. In Kotlin, that variable is essentially a singleton. So how do we expose that in Java? Similarly with methods, if we add a method to a companion object, how do we call that method from inside our Java code? We've also seen that Kotlin does not have checked exceptions, and Java does. So suppose you've got a Kotlin method that throws an exception, and in Java you want to ensure we catch that exception, how do we go about that? And there's also the concept of null safety. We've seen that within Kotlin, Kotlin cares greatly about nulls, and tries its best not to throw null pointer exceptions, and tries its best not to let you use nulls in the code. But if you are using nulls, at least to make sure that the code is explicit about those use of nulls.

Hi. My name is Kevin Jones, and this is the Testing chapter from the Getting Started with Kotlin class, by Pluralsight. So, in this chapter, we'll take a look at unit testing Kotlin code, although the real aim of the chapter is to show you how library writers can take advantage of certain features in Kotlin to make it easier to write libraries. We can write what's known as a DSL, a domain-specific language using Kotlin. And using that DSL is a much nicer experience when writing tests. So, we are going to write some unit tests, and we could use JUnit for this. So JUnit's a Java library, it's probably the best-known Java testing library, we can use JUnit to test both Java code and Kotlin code. However, we'll take a look at a library called Spek. So, Spek is a BDD-type library, a behavior-driven development-type library. And the idea behind BDD is that we describe the test, we describe the tests in a slightly less formal style, so in a more spoken style. That makes the test easier to read, it also makes it easier to pass those tests off to non-developers, so we can pass the test off to BAs for example, they can read the test, and check that their intent is correct. It's an open source library, and it's an open source library written by JetBrains, and you can find the library here, so it's on GitHub JetBrains/spek, they just released version 1. 0, there's also a plugin for the library for IntelliJ IDEA, and we'll use both the plugin and the library in this project.