As Kotlin has matured and stabilized, I’ve started using it in production environments. Considering the lack of materials available in China, I recently started planning to record a series of video tutorials to make Kotlin popular in China.
My personal level is limited. If you have any deficiencies, please email to [email protected]. Thank you!
Release plan
Follow wechat official account: Kotlin to get the latest video updates
Starting from the beginning of October, each video will be limited to 10-20 minutes. The update interval depends on the situation. Try to update at least one video per week.
-
Oct 14: On reflection, I decided to change the content of the video to a few cases rather than the traditional dogmatic presentation because.. I found myself sleepy when I recorded it haha
Watch all videos online (Tencent Video)
Download all videos (Baidu Cloud)
-
November 6th: If you have any technical points you care about, you can also send them out in the “issue” and discuss them together. I will also arrange the following content according to your needs.
- November 28: A friend asked me why I “gave up”… Well, this is a self-deprecating meme. Search “Java from inception to abandonment” 🙂
- December 2: some friends say the content is too little, not enough to see! The first thing I want to say thank you, thank you for you attention and support to this video is I recorded this time after the work, although a video only 10 minutes, but not too want to content spots, usually a video I will try to prepare a few points, the final choice a suitable recording, so the update speed not too fast, however, I will try to update it every Monday, and frankly I am a bit anxious. Haha, the other thing is that the programming language itself is not difficult, but it has a whole family of ecology behind it. Kotlin’s legacy is the Java ecology that has accumulated over the years. Feel free to email or directly open an issue to discuss with me, I can also consider recording some “extras” to answer these questions, thank you for your support!
directory
01 Kotlin profile
Just a quick introduction to what Kotlin is, there are so many new languages, why do you want to get into Kotlin? Because it doesn’t look much like Java
02 Hello World
A journey of a thousand miles begins with Hello World!
03 Introduction to Writing Programs with Gradle (Optional)
Writing Java code these days, I don’t know how to Gradle line?
04 Set Traversal map
Drop i++, don’t you know map has taken over the world? I used to think map-reduce was awesome until I realized it was just iterative data processing.
05 Flat the flatMap
This is an enhanced version of map, which still returns an iterable collection, depending on your needs
06 Enumeration types and When expressions
Kotlin ditched switch and introduced WHEN, which looks remarkably similar, but is much more powerful. As for enumerations, Java enumerations are just the same.
07 Uses Lambda in RxJava
This installment further demonstrates the power of Lambda with a small program that counts the number of characters in articles and shows you how to use RxJava gracefully in Kotlin. I don’t do textbooks, so if you’re interested in the concept, you can just read the official API
RxJava is a very popular Java Reactive framework, and the functional manipulation of data makes Lambda expressions work to their advantage. Compared to Java’s verboten, you will see a very nice and concise piece of code. It is recommended that you first read the official RxJava article to get a basic understanding of it.
08 Use Retrofit to send GET requests
Retrofit is Square’s Jake open Source RESTful Web request framework that makes sending requests feel like hell. I have a few more articles here, as well as a branch of my hack called HackRetrofit, for those interested in children’s shoes to discuss
-
Android Afternoon Tea: Hack Retrofit enhanced parameters.
-
Android Afternoon Tea: Hack Retrofit (2) Mock Server
-
Why don’t you take a look at Retrofit?
09 Tail recursive optimization
Tail recursion, as the name implies, is the part of the recursion that calls itself in the last line of the function body. As we know, recursive calls are very big for stack size and often cause StackOverflow, so tail recursive optimization is a topic of concern. Kotlin supports syntactic level tail-recursive optimization, which is rare in other languages.
10 the singleton
Singleton we are certainly not unfamiliar, as long as you start to write a program, it is inevitable to design some global existence and the only object, they are suitable for singleton mode. In Java, the singleton pattern is written in several common ways, although simple but also covered some interesting topics, so in Kotlin how to design a singleton?
11 Sealed Class
Enumeration types can limit the number of instances of a type. For example, the State enumeration has two types: IDLE and BUSY. Enumeration is the most suitable description. However, if you want to design a data structure with a limited number of subclasses, such as an instruction, the type of the instruction is usually determined, but it is not appropriate to use the same instance every time for some instructions that have parameters, then you may need Sealed Class.
12 Json data caused by the murder
Json data is really popular, it is too easy to understand, with the popularity of Js it is even more “brazen” up. We often use the Gson library when parsing it in Java/Kotlin. What are the problems we encounter when parsing data with it? This installment focuses on a few small examples of Json parsing to show you the problems with Java/Kotlin’s pseudo-generic design and the impact of incomplete data parsing on the language’s own features.
13 Kapt and its friends
First of all, thanks to @codingpapi for his advice.
Kotiln has made great achievements in supporting annotations this year (2016). Except for the insufficient support for @Inherited, I tried it and found no big problems. About KAPT, the official article is listed, which
-
Kapt: Annotation Processing for Kotlin is out of date, and you can read on to see three of them
-
Better Annotation Processing: Supporting Stubs in Kapt the implementation mentioned is basically the official version now
-
Kotlin 1.0.4 is here to introduce the official release of kapt. Note that the use of kapt has changed a bit. The apply plugin: ‘kotlin-kapt’
This issue focuses on a simple Dagger2 example to show you how to use annotations in Kotlin. It doesn’t look very different from using annotations in Java. The generated source code is Java code for the time being, but that doesn’t matter.
The source code for Dagger2 and ButterKnife has also been briefly analyzed. If you are interested, you can also check out my article on the ButterKnife. It’s actually very easy to implement an annotation processor yourself. Androidannotations represent a similar framework for annotations.
Through this example, we actually found that Kapt still has some imperfections, mainly:
- Does not support @ Inherited
- The generated source code needs to be manually added to SourceSets
- When compiling, you need to manually manipulate gradle builds to generate the source code.
But generally speaking, kapt’s current situation is good, I believe that in the near future these problems will not be a problem.
The second part uses Kotlin for Android development
It really takes time and effort to record such a video. If you think it is helpful to you, you can send rewards through wechat and Alipay. I will try my best to make the video the best! Thank you very much!