Fundamental Kotlin, Second Edition by Milos Vasic by Milos Vasic - Read Online

Book Preview

Fundamental Kotlin, Second Edition - Milos Vasic

You've reached the end of this preview. Sign up to read more!
Page 1 of 1

www.fundamental-kotlin.com

About Fundamental Series

Fundamental Series is a serie of books with intention to bring readers quickly into book's subject and make it possible to relatively easy start working with matter.

Fundamental Kotlin is the first book in Fundamental Series. It is available only as the electronic publication.

What is different compared to the First Edition?

In the Second Edition a lot of it has been changed! Book keeps its structure but existing examples have been improved. First edition was my first book so in the second edition I wanted to improve it. Most of examples completely changed, replaced with better ones. Also, each section has been extended with additional explanations and covered with more examples.

Book has been extended with completely new chapters and added new Kotlin material that has not been covered in First Edition. Features that have been introduced to language after version 1.1 are covered too.

Keep reading and discover what is new inside!

About me

I am a software engineer from Belgrade, Serbia. I am passionate about software development and ways to make it better. I prefer to use my own software, so I am working constantly on it. When I am not developing, I am spending time learning and investigating new technologies. One such technology is Kotlin. I chose Kotlin as my primary development language. It gave me everything I need to achieve great flexibility and quality.

You can find me here:

- Linkedin: milos-vasic-53778682

- Xing: Milos_Vasic4

- Github: milos85vasic

- Email: milos.vasic@fundamental-kotlin.com

- Website: milosvasic.net

Preface

When Google announced Kotlin as first-class programming language for Android its popularity raised dramatically. Me and other Kotlin developers are witnesses of that! People who know me are asking about Kotlin. More people is coming to Kotlin workshops.

Since I started using it I realized how powerful it is. Kotlin can do anything! I called it Java on steroids!  But, it is not just that, Kotlin has to offer much more than Java!

I am aware that the most people interested in Kotlin are actually Android developers. That is nice, but i would like to encourage them to use Kotlin as a tool for everything! Use Kotlin as general-purpose first-class programming language! It is production ready!

Most of Kotlin code I wrote is not actually Android, even I have already several Android projects written in Kotlin completely and successfully published to production. What I got from Kotlin is less stress, less bugs and more joy while working the best job in the world!

I used Kotlin to develop my own web server, misc libraries or for example to write Gradle plugins. To get into Kotlin read this book carefully, use the internet and most important, write as much code as you can!

Hope you enjoy it!

What is this book about?

Fundamental Kotlin is a book focused on Kotlin programming language, on language’s most important features and aspects. Unlike in the first edition, here we will not be focused on it’s comparison to Java. If you need more about, you can read the first edition. All examples and the code for this book are located on GitHub repository:

https://github.com/milos85vasic/Fundamental-Kotlin/tree/releases/second_edition

The reason why I decided to write second edition is because i started using Kotlin as my first choice language. I released several projects into production and realized how much  everything was easier and for sure more fun!

This is the second edition of the book and my plans for the next edition are to cover more Kotlin, polish it and extend examples. Everybody is welcome to participate so if you have a better example (alternative) than the existing one please email me. I will be more than happy to include your examples.

I hope that you will find this book helpful and practical.

Regards, Miloš.

Who is this book for?

This book is for people who are willing to taste something new! Fundamental Kotlin second edition is imagined as guide to Kotlin for developers who experienced some other technologies but are still looking for first class tool. If you are not senior developer it should not be a problem, that can be even better! We are starting Kotlin journey from the beginning!

What is Kotlin?

Kotlin is new statically typed programming language running on Java Virtual Machine, Android, web browser or even native as a binary!

Kotlin is:

Concise - drastically reduced code boilerplate

Safe - (almost) impossible to get NullPointerException (NPE)

Versatile - it is general-purpose programming language

Interoperable - we can use existing JVM libs and frameworks in Kotlin or use Kotlin developed libraries in other JVM languages.

A team at JetBrains (creators of IntelliJ Idea) developed Kotlin, an OSS language with an army of external contributors.

Kotlin is OSS language licensed under Apache 2 OSS License.

Current version of Kotlin is 1.1.2. It is important to note that at this moment some of features are experimental, like coroutines for example. Until this edition is released it can happen that experimental status is removed from a feature.

Basic characteristics

Basic Kotlin characteristics are:

1. Running on JVM (Java Virtual Machine) meaning that it is cross-platform compatible (Kotlin native is in development phase, but it will be possible to compile Kotlin code as binary for any platform)

2. Statically typed, the type of a variable is known at compile time

3. Functional:

- First-class functions: You can store functions as a variables or pass as a parameters to other functions as a parameters

- Immutability: It is guaranteed that state of an immutable object can’t change over time

- No side effects: Using pure functions that return the same result