After two years in Kotlin, I have something to say

I have been using Kotlin for two years and it has become my second most used programming language after Java. During this period, many people also talked about some of their own feelings. But I think I have the most say. So far, I have used Kotlin in three production applications. Therefore, I hope these thoughts of mine can give you some inspiration.

Q: What made you decide to use Kotlin?

If I remember correctly, I suddenly received a push from Bugly in March 2016, which introduced the Kotlin language. After reading this article, I found that Kotlin is very similar to the Swift language, and it happened that I was obsessed with Swift at that time. What is even more surprising is that the Kotlin language can be used to develop Android. Therefore, suddenly there is a feeling of blood boiling. Quickly spent a few days browsing the official documentation and started using Kotlin in code.

Q: Do you use Kotlin mainly for production environments or just for normal testing?

I use Kotlin almost exclusively in production, and the first application that added Kotlin code was at a financial company. The final product is half Kotlin, half Java. The second project is a P2P application, in this project, as the project leader. I strictly limit the use of Kotlin in the script of the project, otherwise the compilation will fail. Therefore, this P2P application is my first all-Kotlin project, which is still running online. The last project also uses the full Kotlin language and is a social application, which is currently running online. In fact, in addition to these, in some of my open source projects, Kotlin language is also widely used. At present, there are still a large number of projects developed using the Kotlin language in the code cloud private library that have not been announced to the public.

Q: Did you encounter any problems while using the Kotlin language?

It would be a lie to say that there were no problems at all! Because I am an early user of the Kotlin language, when I was using the Kotlin language, the Kotlin plugin for Android Studio was immature and often crashed. Once there is a crash, the code prompt is tragic, and you have to knock it by hand, and then look at the problem after compiling. In addition, I also encountered a problem at that time: when Kotlin is used in conjunction with the Realm database, it always reports an error. As for other problems, it seems that I have not encountered them.

Q: Some people say that Kotlin is a new language, and there are inevitably some bugs? What do you think of this statement?

First of all, it is not denied that there may be some unknown bugs in the Kotlin language. But I think people who say this are more of a lack of self-confidence in themselves. He is afraid of new things, he is worried, and suddenly he has to learn a new language, what should he do? What if I can't learn it in a short time? In fact, Kotlin's bugs are almost negligible. I think it's about the same as your odds of winning five million in the lottery. Why do you say that? I'll give you an example. You must know Linux, but do you know the version number of the first version of Linux? is 0.01. The first version was developed by Linus alone, and it just displayed a line of Hello world on the screen. Linus believed that this version of Linux was far from the official release, so he named it 0.01. This is indeed the case. I don't know how many versions have gone through, and finally Linux 1.0 version was finally released in 1994. This is a historic moment! But what I want to say is, do you know what 1.0 means for a huge system? The answer in two words is: stable! It has gone through the hard work of countless people day and night, as well as countless internal and public tests, which means that almost 99% of the bugs have been eliminated for you, and you can use it with complete confidence. The same is true for Kotlin. The Kotlin language project started in 2010. Imagine a 6 or 7 year project, and it is still a product developed by the most rigorous group of programmers in the world. What reason do you have for not believing? Therefore, I think the so-called bug theory is just a synonym for fear and fear!

Q: Some people say that because of the cost of Kotlin language access, the company will restrict programmers from using Kotlin. What do you think?

It makes sense! In China, the follow-up of technology is always slower than other countries. Therefore, you can see that most iOS programmers in China are still developing in OC language. In fact, the Swift language has been released for four years. One of the reasons may be that company leaders restrict team usage, because the Swift language does have a lot of syntax changes. After upgrading, you need to use Xcode to help you automatically convert, which is probably the most troublesome problem for most iOS programmers. There's nothing we can do about corporate restrictions. But this limitation, I think, is not entirely justified. As I said above, since Apple officials are confident enough to use Xcode to help you automatically convert, it proves that this method is very easy to use. I know someone will retort: ​​nonsense, I have had some problems with several conversions! But I want to say that there is a certain problem. Just like the automatic conversion of Java to Kotlin code, there will be some problems, but as long as you manually fix these problems, it will be normal, often only a few lines of code work. Therefore, I think the reason for the slow follow-up of this technology is not only the company's restrictions, but also the "timidity" of the Chinese people.

Q: Has using the Kotlin language made some changes in your life?

In fact, there is no change in life at the moment. But it helps a lot in my work, saving me at least about 30% of my time in daily development. Moreover, the probability of exceptions in the production environment is also reduced a lot. If that counts as a change, it does make a difference in my life.

Q: Do you have any special feelings about using the Kotlin language?

If I have to say something special, there is one thing I am particularly proud of. I used Kotlin long before Google officially announced Kotlin as the official language. I predicted that Kotlin might become the official programming language of Android. And when the Google IO conference ended, when I woke up, Kotlin suddenly became the official language of Android. I am proud that I, who never won a lottery ticket, actually predicted a language for the first time.

Q: Do you have anything to say to the new Kotlin students?

First of all, be fearless, learning a new language will give you a temporary discomfort. It's like running. The first part is always hard, and then it becomes easier and easier, and slowly it starts to become enjoyable. So if you run into a problem along the way, don't be afraid, there are countless Kotlin programmers around the world who will help you out. If you want to solve the problem in time, you can join my Kotlin technical exchange group: 329673958. Finally, I wish you an early completion of Kotlin.

Q: If you could only say one thing to Kotlin, what would you most like to say?

I love you <<<

Welcome to the Kotlin Exchange Group

About Kotlin, if you have any questions, welcome to join my Kotlin communication group: 329673958. The current group communication is active, and the question answering speed is very fast. I look forward to your joining.

Scan the QR code below on WeChat, follow Ouyang Feng's studio, and walk with Feng

Ouyang Feng Studio

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325340336&siteId=291194637