Building Kotlin Applications A comprehensive guide for Android, Web, and Server-Side Development (Mounir Boussetta) (Z-Library)

Author: Mounir Boussetta

商业

No Description

📄 File Format: PDF
💾 File Size: 4.2 MB
26
Views
0
Downloads
0.00
Total Donations

📄 Text Preview (First 20 pages)

ℹ️

Registered users can read the full content for free

Register as a Gaohf Library member to read the complete e-book online for free and enjoy a better reading experience.

📄 Page 1
(This page has no text content)
📄 Page 2
(This page has no text content)
📄 Page 3
Building Kotlin Applications A comprehensive guide for Android, Web, and Server-Side Development Mounir Boussetta www.bpbonline.com
📄 Page 4
Copyright © 2024 BPB Online All rights reserved. No part of this book may be reproduced, stored in a retrieval system, or transmitted in any form or by any means, without the prior written permission of the publisher, except in the case of brief quotations embedded in critical articles or reviews. Every effort has been made in the preparation of this book to ensure the accuracy of the information presented. However, the information contained in this book is sold without warranty, either express or implied. Neither the author, nor BPB Online or its dealers and distributors, will be held liable for any damages caused or alleged to have been caused directly or indirectly by this book. BPB Online has endeavored to provide trademark information about all of the companies and products mentioned in this book by the appropriate use of capitals. However, BPB Online cannot guarantee the accuracy of this information. First published: 2024 Published by BPB Online WeWork 119 Marylebone Road London NW1 5PU UK | UAE | INDIA | SINGAPORE ISBN 978-93-5551-633-6 www.bpbonline.com
📄 Page 5
Dedicated to My daughter: Inas & My son Saad
📄 Page 6
About the Author Mounir Boussetta a highly accomplished and dedicated software engineer with a passion for the ever-evolving world of technology. As a co-founder and a project manager at FIRETHUNDER, a leading company in medical information systems, Mounir brings an exceptional level of expertise and leadership to his role. Mounir's journey in the IT industry began after he graduated with a degree in electronics and telecoms engineering in 2013. Driven by his love for programming, he transitioned into the IT domain, where he has thrived ever since. With over 13 years of experience in Java development, starting from version 1.6, and 6 years of experience with Kotlin, Mounir has an extensive understanding of the language and its applications. Prior to his role at FIRETHUNDER, Mounir worked as a software developer at Vivace Consulting SARL, where he honed his skills in AngularJS/Angular, Java, Spring Boot, Spring Data, Spring Security, Hibernate, and REST APIs. His proficiency in IHE Framework standards such as DICOM 3.0 and HL7, which he gained through five years of experience, has been instrumental in his success in the field.
📄 Page 7
About the Reviewer Devnath Jha is a seasoned Android developer with nearly a decade of experience in both Java and Kotlin. In addition to his extensive work in the Android realm, Devnath has embarked on an exciting journey in the world of Java backend development with Spring Boot and MongoDB. He is currently contributing his expertise to a forward- thinking IT startup company based in Bangalore. His passion for technology extends beyond the confines of his workspace. When he isn't immersed in code, he dedicates his time to staying updated with the latest advancements in both Android and backend technologies. Devnath Jha's unique blend of Android expertise, coupled with his burgeoning backend development skills, positions him as a versatile and invaluable asset in the realm of software engineering.
📄 Page 8
Acknowledgement I wish to extend my profound appreciation to my family and friends for their consistent support and motivation throughout the process of writing this book. Additionally, I'd like to express my thanks to BPB Publications for their invaluable guidance and expertise in bringing this book to fruition. The journey of revising this book was a lengthy one, and I am immensely thankful for the valuable contributions and collaboration of reviewers, technical experts, and editors. I would also like to acknowledge the significant contributions of my colleagues and coworkers from my years of working in the tech industry. They have not only taught me a great deal but have also provided valuable feedback on my work. Lastly, I want to convey my gratitude to all the readers who have shown interest in my book and supported its realization. Your encouragement has been truly priceless.
📄 Page 9
Preface Building applications is a multifaceted endeavor that demands a comprehensive grasp of cutting-edge technologies and programming languages. Kotlin has emerged as a powerful and increasingly popular tool in the realm of software development. This book is meticulously crafted to serve as your all- encompassing guide to constructing enterprise applications with Kotlin. It delves into a vast array of topics, beginning with the fundamentals of Kotlin programming, progressing to advanced concepts like object-oriented programming, and culminating in the utilization of the Kotlin ecosystem to forge robust and scalable applications. As you traverse the pages of this book, you will immerse yourself in the essential attributes of Kotlin and its ecosystem, equipping you to fashion enterprise applications that are not only efficient and reliable but also easily maintainable. You will glean insights into best practices and design patterns tailored to the unique demands of enterprise application development, and you will encounter a plethora of real-world examples that will solidify your comprehension of these concepts. Whether you are a newcomer to Kotlin and the world of enterprise application development or an experienced developer seeking to fortify your command of these technologies and elevate your proficiency in crafting resilient and dependable applications, this book is your compass on this journey.
📄 Page 10
With this book as your companion, you will acquire the knowledge and expertise needed to flourish as an adept developer in the sphere of multiplatform applications development using Kotlin. I sincerely hope that you discover this book to be enlightening and invaluable on your path to mastery. Chapter 1: Java and Kotlin - In this first chapter, we will put you in the context of the language, and you will be introduced to the history of Kotlin, why this new programming language has appeared, who created Kotlin, and what was their intention behind Kotlin. We will also learn about Kotlin in comparison to Java; we will learn about the advantages and disadvantages of each and what makes the Kotlin language the right choice for your future development and maybe your career. Chapter 2: Kotlin Basics - The readers will get an understanding of the basics of the Kotlin programming language. They will be able to deal with variables, data types, the creation of functions, the basic control structures, and also how to work with some Kotlin features like smart casting, class extensions, and operator overloading. Chapter 3: OOP with Kotlin – This presents how to create some basic real-world applications in Kotlin by following an object-oriented way, and this goal will be possible by following this chapter’s sections on object-oriented programming. It examines and discovers what makes a language object-oriented by learning about the pillars of this concept. Chapter 4: Generics – The learners will be able to use generics in your programs to be more concise in writing code by getting most of the advantages they offer. They will explore some new concepts that are introduced in Kotlin, such as reified-type parameters and declaration-site
📄 Page 11
variance. They will be taught some issues with generics in Java that are resolved in Kotlin in a very concise way. Chapter 5: Annotations and Reflection – The readers will learn about annotations and reflection and how to be able to use and define their custom annotations, and will be able to use reflection to introspect classes at runtime as well. Chapter 6: Functional Programming with Kotlin and RxKotlin - This will give learners some understandings about the functional programming paradigm, reactive programming, functional data structures, higher order functions, how error handling is done, and many other concepts. Chapter 7: Observables, Observers, and Subjects – It will make readers understand the concepts of observables, observers, and subjects in the context of reactive programming. Learn how to create observables and observers in Kotlin using the RxKotlin library. Explore the various factory methods and operators the RxKotlin library provides for working with observables. Understand the different types of Subjects available in the RxKotlin library and how they can be used. Learn how to use observables, observers, and subjects to create asynchronous and event- based programs in Kotlin. Chapter 8: Flowables and Backpressure - Flowables and observables are types of data streams that are used in reactive programming. They allow developers to represent asynchronous data streams and react to changes in the data over time. Flowables are a type of data stream designed to handle large volumes of data, known as backpressure. They allow developers to control the rate at which data is emitted and processed, ensuring that it can be processed efficiently and without overloading the system. On the contrary,
📄 Page 12
observations are a simpler type of data stream that does not have built-in support for backpressure. They are often used for smaller data volumes or cases where backpressure is unnecessary. Chapter 9: Data Transformers and Async Operators - This chapter aims to provide a comprehensive understanding of the various Rx operators and how they can be used to work with streams of data in a reactive programming paradigm. Understanding these operators and their use will help developers create powerful, efficient, and responsive data flows that can handle real-world scenarios. Chapter 10: Concurrency and Parallel Processing - This chapter covers the concepts of concurrency, schedulers, and their usage in RxKotlin. We will start by understanding the basics of concurrency and how it can be applied in our systems. Then, we will delve into the world of schedulers, which are responsible for scheduling the execution of our tasks. We will learn how to use schedulers with the subscribeOn and observeOn operators in RxKotlin to achieve concurrency and parallel processing. Chapter 11: Testing Reactive Applications - Testing reactive applications in Kotlin requires a different approach than testing traditional applications. Reactive applications are asynchronous and often handle concurrency, which can make them more difficult to test. However, there are several testing tools and techniques that can be used to make testing reactive applications easier. Chapter 12: Spring Reactive for Kotlin - Spring Boot is a popular framework for building JVM-based applications, and Kotlin, as we already know, is a modern programming language that has gained popularity in recent years due to its concise syntax and powerful features. Together, they
📄 Page 13
provide a powerful combination for building efficient and scalable applications. Chapter 13: Asynchronous Programming and Coroutines - It will explore the concepts of multithreading, callbacks, coroutines, jobs, and UI threads. It discuss why multithreading is important in modern software development, including the benefits of improved performance, scalability, and responsiveness. And then dive into the topic of handling work completion using callbacks, which are a powerful mechanism for signaling the completion of asynchronous tasks. Chapter 14: Suspending Functions and Async/Await- In the real world, suspending functions can be used to write code that performs network requests, database queries, and other asynchronous operations. For example, you could use suspending functions to write code that fetches data from a web service, updates a database, or plays a sound file. Chapter 15: Contexts and Dispatchers - This chapter focuses on the management and control flow aspects of Kotlin coroutines. It will explore how coroutines are scheduled and executed, the different types of dispatchers available, and how exceptions propagate within coroutines. Additionally, It will delve into the critical topic of coroutine cancellation, understanding the mechanisms behind it and exploring techniques to effectively manage and handle cancellations. Chapter 16: Coroutines Channels - The concept of channels is an important part of Kotlin coroutines. Channels can be used to implement communication patterns between coroutines, allowing data to be passed between them in a safe and efficient way. This chapter will explore the various features of channels, including generators, pipelines, and broadcast channels.
📄 Page 14
Chapter 17: Coroutine Flows – The chapter delve into the powerful concept of Coroutine Flows in Kotlin. Asynchronous programming often involves handling data streams that require efficient processing and management. Traditional approaches to stream processing may have limitations when it comes to handling backpressure, composing operators, and maintaining concurrency. Coroutine Flows offers a comprehensive solution to these challenges by providing a declarative and efficient way to work with data streams. Chapter 18: Multiplatform and Kotlin - This final chapter of the book, will delve into the realm of multiplatform development with Kotlin. Multiplatform development has emerged as a powerful approach to building applications that can run on multiple platforms, enabling code sharing and reducing development effort, It will explore the principles and benefits of multiplatform development and guide readers through the process of setting up development environment for multiplatform projects.
📄 Page 15
Code Bundle and Coloured Images Please follow the link to download the Code Bundle and the Coloured Images of the book: https://rebrand.ly/wq5ve66 The code bundle for the book is also hosted on GitHub at https://github.com/bpbpublications/Building-Kotlin- Applications. In case there’s an update to the code, it will be updated on the existing GitHub repository. We have code bundles from our rich catalogue of books and videos available at https://github.com/bpbpublications. Check them out! Errata We take immense pride in our work at BPB Publications and follow best practices to ensure the accuracy of our content to provide with an indulging reading experience to our subscribers. Our readers are our mirrors, and we use their inputs to reflect and improve upon human errors, if any, that may have occurred during the publishing processes involved. To let us maintain the quality and help us reach out to any readers who might be having difficulties due to any unforeseen errors, please write to us at : errata@bpbonline.com
📄 Page 16
Your support, suggestions and feedbacks are highly appreciated by the BPB Publications’ Family. Did you know that BPB offers eBook versions of every book published, with PDF and ePub files available? You can upgrade to the eBook version at www.bpbonline.com and as a print book customer, you are entitled to a discount on the eBook copy. Get in touch with us at : business@bpbonline.com for more details. At www.bpbonline.com, you can also read a collection of free technical articles, sign up for a range of free newsletters, and receive exclusive discounts and offers on BPB books and eBooks. Piracy If you come across any illegal copies of our works in any form on the internet, we would be grateful if you would provide us with the location address or website name. Please contact us at business@bpbonline.com with a link to the material. If you are interested in becoming an author If there is a topic that you have expertise in, and you are interested in either writing or contributing to a book, please visit www.bpbonline.com. We have worked with thousands of developers and tech professionals, just like you, to help them share their insights with the global tech community. You can make a general application, apply for a specific hot topic that we are recruiting an author for, or submit your own idea. Reviews Please leave a review. Once you have read and used this book, why not leave a review on the site that you purchased it from? Potential readers can then see and use your unbiased opinion to make purchase decisions. We at BPB can understand what you think about our products, and our authors can see your feedback on their book. Thank you! For more information about BPB, please visit www.bpbonline.com. Join our book’s Discord space Join the book’s Discord Workspace for Latest updates, Offers, Tech happenings around the world, New Release and Sessions with the Authors:
📄 Page 17
https://discord.bpbonline.com
📄 Page 18
Table of Contents 1. Java and Kotlin Introduction Structure Objectives Overview History of Kotlin Who is behind Kotlin, and when did it appear? Why Kotlin? What is Kotlin? The name Kotlin Kotlin versus Java Kotlin Advantages Disadvantages Java Advantages Disadvantages Next in Kotlin Conclusion Points to remember 2. Kotlin Basics Introduction
📄 Page 19
Structure Objectives Overview Variables Declaration and initialization Types and cast Integer types Floating-point types Numbers representation on the JVM Character String String functions Boolean Arrays Null safety Creating functions Creating and using a function Function arguments Variable number of arguments (varargs) Choices and conditions if/else-if/else when Loops repeat for loop while and do .. while loops Returns and jumps Return Break
📄 Page 20
Continue Smart cast with Kotlin Work with extensions Extension functions Extension properties Overloading operators Handle exceptions Conclusion Points to remember 3. OOP with Kotlin Introduction Structure Objectives Overview Classes and objects Kotlin class Objects Inheritance Inheritance in Kotlin Overriding parent class methods Abstract classes Properties Getters and setters Backing fields Interfaces Properties in interfaces Interfaces inheritance Visibility modifiers
The above is a preview of the first 20 pages. Register to read the complete e-book.

💝 Support Author

0.00
Total Amount (¥)
0
Donation Count

Login to support the author

Login Now
Back to List