Code

Must-read: 5 fresh articles about Kotlin

Must-read: 5 fresh articles about Kotlin

Free Python Course ➞ Mini-course for beginners and experienced coders. 4 cool projects in your portfolio, live communication with the speaker. Click and find out what you can learn in the course.

Learn more

Each week, we select five relevant and interesting materials from the English-language internet on one topic and explain why they are worth reading. In this issue, we will focus on Kotlin, a programming language developed by JetBrains in St. Petersburg. Kotlin has become the standard for Android app development due to its simplicity, expressiveness, and compatibility with Java. We will share key articles that will help you better understand this language and its advantages in modern programming.

Does Kotlin need a ternary operator?

Discussions about the Kotlin programming language can be found on specialized forums and the Stack Overflow platform. These resources offer the opportunity to get answers to questions, share experiences, and find solutions to various problems. Participating in such discussions helps deepen your knowledge of Kotlin and stay abreast of the latest trends and updates in the developer community.

Reading helps you gain a deeper understanding of the language's developers, as well as its architectural and design features. This knowledge allows you to better master the programming language, effectively use its features, and apply best practices in development. Understanding the fundamentals of the language contributes to higher-quality code writing and accelerates the learning process.

The ternary operator in Kotlin is one of the most discussed and controversial topics. In 2018, the official Kotlin forum closed the thread dedicated to this issue after members actively called for an end to discussion of the ternary operator. Despite this, discussions on this topic continue on Stack Overflow, but the most lively discussion still takes place on the Kotlin forum. It's important to note that the absence of a ternary operator in Kotlin stems from the language's philosophy, which emphasizes readability and code simplicity.

In November 2016, a user named edgeone left a comment requesting the addition of a ternary operator to the Kotlin programming language. This event became the starting point for discussion and further development of the language's capabilities, which has since continued to gain popularity among developers. Interest in Kotlin is growing due to its concise syntax and functionality, which makes it an ideal choice for developing applications on the Android platform and beyond.

That very opening message

The arguments of the parties in the dispute can be summarized as follows. Side A argues that its position is based on facts and scientific data, emphasizing the importance of evidence to support its point of view. It emphasizes the long-term consequences and benefits of its approach. Side B, on the other hand, relies on emotional arguments and personal experience, emphasizing the need to consider the human aspect. It emphasizes the risks and potential negative consequences associated with Side A's proposals. It is important to consider these arguments to develop a comprehensive understanding of the topic under discussion.

  • Cons: It doesn't add any new functionality (it's easily replaced by If-statements), it complicates the code when combining ternary chains or using long expressions, and it's difficult for newcomers to programming to understand.
  • Pros: It's concise, and users of other programming languages ​​expect and understand it.

Roman's Answer Elizarov, now the head of Kotlin at JetBrains: "Writing code with the fewest characters is definitely not the goal for Kotlin"

Why aren't server-side developers switching from Java to Kotlin?

You can check out the materials on the Medium platform. It's a convenient place to read articles, blogs, and research on a variety of topics. Medium offers high-quality content from authors all over the world, allowing you to delve into the topics you're interested in and discover new ideas.

Reading this material will help you learn why some developers don't trust the Kotlin programming language and whether these doubts are justified. You will be able to delve deeper into the issues surrounding Kotlin and understand what aspects cause particular concerns among specialists.

Kotlin has established itself as the standard programming language for Android development, but its position in server-side development remains weak. A Google Developers Experts columnist explored common concerns and myths surrounding the use of Kotlin in server-side development. This article will help dispel these doubts and demonstrate the language's capabilities that can be useful for server-side development.

A competent Java developer can master the basics of Kotlin in a short time. Interest in learning other programming languages ​​is an important indicator of a specialist's professional growth and development. Expanding skills in various languages ​​allows developers to be more flexible and adaptable in the rapidly changing world of technology.

Java is indeed an established programming language, but its development is gradual and in some respects it is inferior to the more modern Kotlin. Kotlin was created with modern requirements in mind and includes many innovative features that make development more convenient and efficient. Furthermore, developers often become accustomed to the quirks and shortcomings of their language, which can make it difficult to perceive the benefits of new technologies. As a result, despite Java's long history, many developers are beginning to recognize the benefits of using Kotlin for building modern applications.

A few years ago, the main argument against Kotlin came from skeptics, but over time, the popularity of this programming language has grown significantly. Official support from Google, as well as integration with frameworks such as Spring and Micronaut, only strengthen Kotlin's position in the development world. Given the growing interest of developers and companies, Kotlin is becoming an increasingly preferred choice for building modern applications.

Kotlin support in Eclipse really leaves much to be desired. JetBrains, as the language's developer, is primarily focused on promoting its own tools, and therefore working with Kotlin in IntelliJ is more comfortable and efficient. However, it is worth noting that Kotlin support in Eclipse has potential for improvement. IntelliJ continues to be a favorite choice for developers thanks to its intuitive IDE and a wide range of features specifically tailored to Kotlin.

Answer: Using Kotlin is often feared by those new to it. However, in practice, this doesn't pose any significant challenges. The key is for the team to understand that Java and Kotlin will coexist initially. Understanding the specifics of both technologies will help ensure a smooth transition and effective collaboration between them.

Impressions of the Jetpack Compose Framework

You can read it on the Kotlin Academy blog.

Reading this information will help you understand the advantages and disadvantages of working with Jetpack Compose, as well as discover new sources of knowledge on this topic. Jetpack Compose is a modern tool for developing user interfaces on Android, which offers many features to simplify the process of creating applications. Getting to know its features will allow you to make more informed development decisions and improve your skills.

Jetpack Compose is a modern tool for creating user interfaces on the Android platform. It offers an effective solution to the problems associated with using traditional Views and XML layouts, significantly accelerating the process of developing application interfaces. With its declarative approach and improved integration with Kotlin, Jetpack Compose allows developers to create complex interfaces more quickly and easily, making it indispensable in modern Android development.

Jetpack Compose offers many benefits for Android developers. First, it offers a modern and declarative approach to creating user interfaces, significantly simplifying the development process. Using Kotlin, code becomes more concise and readable, which contributes to increased productivity.

One of the key advantages of Jetpack Compose is its ability to quickly create responsive interfaces that easily adapt to different screen sizes and device orientations. This is especially important given the diversity of Android devices on the market.

Furthermore, Jetpack Compose provides integration with existing Android architectural components, such as ViewModel and LiveData, allowing developers to easily combine new and old approaches. This makes development more flexible and efficient.

Jetpack Compose also simplifies working with animations and transitions, allowing you to create more engaging and interactive interfaces. This, in turn, improves the user experience and can positively impact user retention.

Finally, Jetpack Compose is actively updated and maintained by the community, ensuring its relevance and development. This makes it an excellent choice for modern Android apps.

Compose inspires and makes the development process more enjoyable by eliminating routine tasks. Built on the Kotlin language, it provides high type safety, minimizing the likelihood of errors in code. The Compose API is integrated into Android Studio, making it easier for developers to create modern and efficient user interfaces for apps.

While Jetpack Compose offers many advantages for Android UI development, it also has its drawbacks. One of the main drawbacks is that it is still under active development, which can lead to instability and API changes. Additionally, it may take time for developers to learn the new declarative programming model, especially if they are accustomed to the traditional XML approach.

Another significant drawback is limited support for some older devices and Android versions, which may impact app availability for certain users. Also, despite the availability of many ready-made components, developers sometimes have to create their own solutions, which can increase development time.

It should be noted that Jetpack Compose performance can vary depending on the complexity of the interface and the amount of data, requiring careful optimization. Finally, integration with existing View-based projects can be challenging, making a smooth transition to the new framework difficult.

Overall, despite its shortcomings, Jetpack Compose is a powerful tool for developing modern interfaces, and its benefits may outweigh the drawbacks for many developers.

To work effectively with Compose, you must use the latest version of Android Studio, but it still has a number of drawbacks. Here are some of them:

  • The IDE preview feature sometimes doesn't load or update, making it useless.
  • The debugger doesn't connect to the emulator or the device itself.
  • Logcat doesn't show application names.
  • The emulator doesn't show up in the preview when opened in the IDE.
  • Studio freezes completely once a day, requiring a reboot.

One of the features is the difficulty of finding information about Jetpack Compose. On Stack Overflow, most tips and tricks are for an outdated version. While the developers are working to fix these issues, for now you can use some useful tricks to work more efficiently with Compose.

  • Right now, the best source on this topic is the official documentation.
  • Check out the YouTube playlist — it contains non-obvious nuances of some Compose features.
  • Beginners will find the video review of the beta version useful.
  • There is a lot of practical information in the official guide from Google. Although there is some outdated advice there, too.

Kotlin Multiplatform — a godsend for mobile development?

You can read the ProAndroidDev community blog.

Reading this material will help you understand the practical advantages and disadvantages of Kotlin Multiplatform. This technology provides the ability to use a single codebase for developing applications on iOS and Android, which greatly simplifies the process of creating and maintaining mobile applications. By familiarizing yourself with the key aspects of Kotlin Multiplatform, you'll be better able to understand how it can impact development efficiency and resource optimization.

A developer at the well-known online editor InVideo shared the reasons for choosing Kotlin Multiplatform. The primary motivation was the desire to eliminate the need to maintain multiple codebases and optimize development costs. Kotlin Multiplatform allows for the efficient sharing of code across platforms, significantly simplifying the development process and improving team productivity. This approach not only saves time but also improves product quality, an important factor in the competitive online services environment.

When choosing a technology for app development, React Native, Flutter, C++, and Kotlin Multiplatform were considered. The project's primary focus is low-level graphics, which immediately ruled out React Native and Flutter. Developing in C++ proved too time- and resource-intensive. Ultimately, the choice came down to maintaining two codebases (Swift for iOS and Kotlin for Android) or using Kotlin Multiplatform. Ultimately, the decision was made to use KMP, since the Android app still required writing in Kotlin. This allowed for the creation of a universal codebase and simplified project maintenance.

Kotlin Multiplatform offers numerous benefits for developers looking to build cross-platform applications. Firstly, it allows the same code to be used across multiple platforms, significantly reducing development time and costs. Secondly, thanks to its high compatibility with existing libraries and frameworks, developers can integrate Kotlin Multiplatform into existing projects without significant changes.

Furthermore, Kotlin Multiplatform provides seamless support for multiple platforms, such as Android, iOS, web, and server-side, enabling developers to build applications with a single source code base while maintaining a native user interface experience. This allows developers to focus on business logic rather than platform-specific concerns.

Also worth noting is the active community and support from JetBrains, which contributes to the ongoing development of the language and its ecosystem. Kotlin Multiplatform is becoming an increasingly popular choice for creating high-quality and performant applications, making it attractive to developers looking for modern and efficient solutions.

  • cross-platform development;
  • high performance;
  • a familiar language for Android developers;
  • compatible with Java, Swift, and Objective-C;
  • all major libraries included;
  • this code can be used for other platforms in the future.

Kotlin Multiplatform has a number of disadvantages that are worth considering. Firstly, there is limited support for libraries and frameworks, since not all libraries written in Kotlin can be used in multiplatform projects. Secondly, there is difficulty integrating with existing codebases written in other languages, which may require additional adaptation efforts. A third disadvantage is insufficient documentation and use cases, which can hinder the learning process and implementation of the technology. It's also worth noting that debugging code can be more challenging due to the specifics of working with multiple platforms. Finally, Kotlin Multiplatform is still under active development, which may cause uncertainties in stability and functionality support.

  • iOS developers will have to learn a new language;
  • the interface for each platform will still have to be created separately;
  • more libraries would be welcome.

You can read more on the Amazon blog.

Reading this material will allow you to understand why Amazon decided to use the Kotlin programming language and what results were achieved in this process. You will learn about the benefits of Kotlin, its features, and how it has influenced software development at the company. This experience can be useful for those interested in modern technologies and programming languages.