Introduction and Kotlin Big Picture

Dave Ford
A free video tutorial from Dave Ford
Developer and Trainer for Smart Soft
4.4 instructor rating • 1 course • 1,955 students

Lecture description

General overview of Kotlin, without delving into language details.

Learn more from the full course

Kotlin Quick Start for Java Developers

A tutorial for Java developers who want to quickly get up to speed with Kotlin.

03:07:23 of on-demand video • Updated September 2017

  • Key concepts/syntax of the Kotlin language
  • Kotlin in the context of the IntelliJ IDE
  • Object-oriented programming with Kotlin
  • Functional programming with Kotlin
  • Kotlin standard library (highlights)
  • Kotlin-Java interop and migration strategies
  • IntelliJ tips and tricks
  • Setting up Gradle for Kotlin
English [Auto] Hi there and welcome to Katlin QuickStart for Java developers on day 4 your instructor. Here's a little bit about what to expect in this course. We're going to start with a brief Koplin overview and the remainder of the Course is going to be hands on coding. So I'm going to show you lots of cool stuff in code and that's how we're going to learn all the features of Cartland. So I'll start with a few small examples to introduce some cotton basics and then we're going to jump right into our project which is going to be a blackjack game. Kind of a non-trivial project that that really represents something you might do in the real world. All right. Cutline overview. So this review is going to give you a bird's eye view of all of the interesting things about Cartland but it's not going to give you all the syntax and code stuff we're going to save some of that for the hands on coding section. So let's talk about the the non code stuff first Scottland started out as an invention by Jepp brains. They were working with lots of tools that they had built in Java. Basically they are telling the idea and all their other ID projects and they wanted something that was a little bit more modern and they looked around. They didn't see anything that met their needs and that's why they created Cotman. So Cartland is a programming language designed by a company for their own use and it's meant to be practical right from the get go. And I think it's interesting to note that they've already ported large portions of all of their products to Cartland So they're really eating their own dog food. One of the interesting things about Cartland is that they target lots of different platforms. For one they target the Java virtual machine. That means you can write Katlin and compile it down into a Java class and run it the same way you would run any java class. Secondly it compiles the Android to Android so you can write Katlin applications that run on a mobile phone. Thirdly you can write Kollin apps that compile to javascript and run in a browser. And finally you can write Colonie apps that compile into native code and create a native executable that runs for example on a tiny embedded device in from the get go is designed to be safe. That's one of our major brains is primary goals. So just like Java it's a safe language that means it's it's fully static typed. That means the type of every variable of every function return type and every expression is known and checked at compile time. That means you're much more likely to get errors sooner when you're developing as opposed to later when the app is running and something that's interesting is that they've actually gone out of their way to make Katlin even more safe than Java. So they have some things regarding safety the Java didn't have. For example some things regarding some number conversions and especially things rely on a null pointer exception that will learn all about. Now this is what's really neat. So in addition to being safe. Cantlin is is more concise. Normally the safe language meaning meaning the statically typed language is like Java. What they do is they compromise conciseness. So Java is not considered a concise language but it is considered a safe language. Javascript on the other hand is a dynamic language and has no static typing. And as a result it's a little bit more concise but I didn't experiment the Blancher example which is kind of my standard Teju an example. I rewrote it in both thone java javascript and Katlin and the Cartland version had 83 percent the number of lines of code as JavaScript. In other words a statically type safe language Koplin has fewer lines of code than that for the same program as a dynamic language Javascript. So I think that's pretty interesting. And as you can see it's even mortars it's 34 percent is concise. Is Java. Now this isn't a super scientific example just an example I wrote but I think it's at least representative. So what I'm saying is that Cartland has all of this safety and ideally friendliness of a statically typed language like Java. But it's very beautiful and concise. More like like a Python type of language. Another nice thing about Cartland is they really try to be pragmatic. It's not an experimental or research language. There's no new cutting edge features. But if you if you some if you take a look at all of the modern languages out there Ruby and Python and Skala and rust et cetera you'll find that the Cartland has most of the new features from all those languages so it's got all of the modern features that new language would expect. But nothing really experimental. So it's got the latest and greatest but it's not really so bleeding edge that it's experimental. It's also it's a little bit less complex style and it compiles much faster in Scala. In short it's really designed to be practical and used in industry K Another nice thing about Cartland is it's both object oriented and functional. If you already know Java you're familiar with Object-Oriented in Java 8:9 they're becoming more functional but Cartland has all of the functionality needed to create functional program. If you don't know much about functional programming that's OK at this point. It's kind of old has been around says Lisp and it's kind of becoming more popular because functional programming sometimes makes your programs a little bit easier. Understand that will little easier to test and also it makes your programs a little bit easier to scale on a multi-threaded or more like process environment. All right this is one of the great things about Katlin. So having experiment with lots of new languages I'm kind of a language geek to be honest. I've screwed with Ruby and Python and Scala and Java F X and groovy and just about every language under the sun. But I always kind of come back to my Java and the one of the reasons is is is migrating from the old language to a new language is really really difficult and really really disruptive. And so that's one of the things that kind of interesting about Cartland they really went out of their way to focus on interop. In other words it's very easy to write a program that's all Java and gradually port one class at a time to Cartland Katlin classes can easily call Java code in Java code can easily call Cartland code. So having worked with a lot of languages that work with other languages like JVM languages like Scala enclosure and groovey I think Katlin gets this right. Mostly it really does a good job with interrupt and interop is really important. If you ever want to migrate old apps to new apps it's also important if you want to make use of existing libraries. It's also important if you want to create libraries that are consumed by people who don't use cotland for example if you want to create libraries that are consumed by people who use Java and that the same is true for javascript. As I mentioned earlier Katlin compiles into javascript and could be run in the browser just like a javascript that would. So I have written apps that both a compiler javascript and then call other javascript programs and also I've written programs in Cartland the compiled javascript and are consumed by other javascript programs so that interop in both directions is really really a big deal. It makes migration a lot less risky and a lot less costly. One of the fears of people who adopt a new programming language is that it's not going to be supported for very long and it's going to fade out and go out of fashion basically. So with CANTLIN let me give you a few things to maybe ease some of those fears. For one it's supported by jet brains and they're heavily invested in it and they've all reported a large percentage of their own products to to Collen. So they are one of the most important and popular ID vendors you know in the development landscape and if they if they're betting the farm on it that's kind of a big deal. But even more importantly Google at the 2016 Google IPO announced official support for Koplin specifically for their Android platform. So that's kind of the big deal. We really haven't had Google announce official support for a language that they didn't invent themselves in about 10 years. So Google officially supporting it is really a good sign it's going to be around and there's lots of other companies that are also using Kollin. Here's some end user companies Amazon Netflix Pinterest uber Foursquare Trello capital one Coursera and base camp and also companies companies that make products for developers are also being used. For example on spring all Virtex that an app server SPARC Java that's also kind of a micro container service code name one. So lots of companies are really investing and buying into Colonne as already mentioned Cotman is back and made by an I.T. company. So in my opinion jet brains and specifically intelligence is one of the best ideas ever made. I've as I mentioned I experienced lots of programming languages and I really got deep in the skull for a while and I eventually went back to Java and it kind of dawned on me that I'm not all that loyal to Java and really loyal to jet brains. I really love jet brain. It's a super productive tool. I use it to its fullest. I know all the keyboard shortcuts and it's really the key to my productivity and Java of course helps because Java is a language that is very ideal as opposed to languages like Python or Ruby or javascript which because they're not statically typed they really can't be helped that much by a good idea but statically typed languages like Java and Cartland Candy. So in my opinion the one two punch loops the one two punch between Katlin and in Caligiuri is a really really powerful combination. And so having a language that is developed by an I.T. company really makes a lot of sense. In fact my very first programming language visual basic was also made by I.T. company Microsoft. The idea and the language kind of came together. So having the very close connection between IEEE and language really makes for a super productive environment. I kind of like to think of Cartland is Java 15. It's a very similar job. It's kind of easy to learn if you're a Java programmer and I just look at it as the next step in Java development. In my opinion I might be wrong on this but I kind of predict that in a few years Katlin will probably be the most popular language to run on the Java virtual machine except for maybe Java itself language features in this overview I'm not going to get into all the language features because I'm going to save those for the coding portion and it's hard to explain them in a PowerPoint slide. But Collen has lots of new language features no one of them is amazing or outstanding in and of itself. But what really makes Cartland special is it's the sum of the parts when you put them all together. Katlin just really creates a very concise elegant and beautiful programming environment. Finally I think you're going to find once you start programming in cotland that programming is going to start to become fun again. If you've been programming in Java for the last number of years you're going to really enjoy Cartland because it's just plain fun. It's productive. It's practical it's useful and I think you're going to really like it. Also this course includes the ability to ask questions of me as you progress through the course material. There's two ways to do that. One is through the Demy site. So what you can do is arm while you're viewing a video on that is the lecture player. You can go to the bottom there's a button that says browse Kuban and click on that. Alternately there is a queue and a tab in the main course for the web page if you want something more private you can shoot me an email directly at D4 at Smart dash sauf dot com. Either way I'll try to answer your questions as promptly and as best as I can. OK and that's it for our overview. As I mentioned our overview didn't include some of the most interesting parts of Cartland which are really some of the language features because we're going to save that for the coding part. But then it's time to start coding. So if you want to follow along you can go ahead and download intelligence from the jet brains Web site community or ultimate edition. Either one will work. And with that said let's get started with a start on the proverbial Hello world.