Kotlin for Enterprise Applications using Java EE
eBook - ePub

Kotlin for Enterprise Applications using Java EE

Develop, test, and troubleshoot enterprise applications and microservices with Kotlin and Java EE

  1. 388 pages
  2. English
  3. ePUB (mobile friendly)
  4. Available on iOS & Android
eBook - ePub

Kotlin for Enterprise Applications using Java EE

Develop, test, and troubleshoot enterprise applications and microservices with Kotlin and Java EE

About this book

Build Java Enterprise Applications and learn how Kotlin makes it easier to code them using components like JSF 2.3, Enterprise JavaBeans (EJB) 3.2, Contexts and Dependency Injection (CDI) 2.0, the Java API for WebSockets, JAX-RS 2.1, Servlet 4.0.

Key Features

  • An in-depth guide updated with all the latest features of Kotlin 1.2 and Java EE 8
  • Build microservices in Java EE with the help of Kotlin use cases
  • Explore coroutines, garbage collection, multithreading, memory management and more

Book Description

Kotlin was developed with a view to solving programmers' difficulties and operational challenges. This book guides you in making Kotlin and Java EE work in unison to build enterprise-grade applications. Together, they can be used to create services of any size with just a few lines of code and let you focus on the business logic.

Kotlin for Enterprise Applications using Java EE begins with a brief tour of Kotlin and helps you understand what makes it a popular and reasonable choice of programming language for application development, followed by its incorporation in the Java EE platform. We will then learn how to build applications using the Java Persistence API (JPA) and Enterprise JavaBeans (EJB), as well as develop RESTful web services and MicroServices. As we work our way through the chapters, we'll use various performance improvement and monitoring tools for your application and see how they optimize real-world applications. At each step along the way, we will see how easy it is to develop enterprise applications in Kotlin. By the end of this book, we will have learned design patterns and how to implement them using Kotlin.

What you will learn

  • Understand Kotlin syntax and appreciate why it's gaining in popularity
  • Explore the Java EE ecosystem and the APIs in Java EE
  • Implement applications using Kotlin
  • Overcome the challenges of developing the Java EE system using Kotlin
  • Gain insights into Java Message Services (JMS)
  • Build RESTful MicroServices and secure applications
  • Optimize applications with performance and monitoring tools
  • Understand design patterns and implement them

Who this book is for

Kotlin for Enterprise Applications using Java EE is for Java EE developers who want to build their enterprise project or application with Kotlin or migrate from Java to Kotlin. Basic knowledge of programming is necessary to understand the key concepts covered in this book.

Tools to learn more effectively

Saving Books

Saving Books

Keyword Search

Keyword Search

Annotating Text

Annotating Text

Listen to it instead

Listen to it instead

Information

Kotlin – A First look

Kotlin is a new language based on the Java Virtual Machine (JVM) that is fascinating the developer community with its concise, clear syntax, its lack of boilerplate code, and its full interoperability with the Java language.
The following topics will be covered in this chapter:
  • The features offered by Kotlin
  • Installing and running Kotlin
  • The various constructs of the language

Technical requirements

Knowing the basics of the Java language will help you to understand Kotlin and compare the two JVM-based languages. We will work with the command line to illustrate the language features that are highlighted in this chapter.

Introduction to Kotlin

Kotlin is a statically-typed programming language that runs on the JVM and works across different platforms. The fact that it is statically typed means the types are resolved during compilation. JVM is a specification that provides a runtime environment for running applications that are developed in Java and other JVM-based languages. The most well known reference implementation of JVM is OpenJDK, which was originally developed by Sun Microsystems and is now supervised by Oracle. Kotlin is another JVM-based language that is simple to write and concise in nature.
Kotlin combines object-oriented and functional programming features. Kotlin is designed to be interoperable with Java and relies on the Java code from the existing Java Class Library (JCL).
Kotlin provides a more expressive syntax than Java. It is concise and has strong type inference, which reduces code verbosity. It also has a wide variety of useful features, such as operator overloading, string templates, extended functions, and coroutines.

The history of Kotlin

Kotlin was developed by JetBrains in 2010. They initially released it under the name Project Kotlin in July 2011. They needed a language that was concise, elegant, expressive, and also interoperable with Java, as most of their products were developed in Java, including the Intellij Idea. They were looking for an alternate language to reduce the amount of boilerplate code required and to introduce new constructs, such as higher-order functions, to make language more expressive and concise. One of the goals of the Kotlin language was to be able to compile code as quickly as Java.
JetBrains open-sourced the project under the Apache 2 license in February 2012. Kotlin v1.0 was released on February 15, 2016. This was the first official stable release from JetBrains. Kotlin v1.2 was released on November 28, 2017. This release added a feature to allow code to be shared between JVM and JavaScript platforms.

Features of Kotlin

The key features of Kotlin are as follows:
  • Interoperability with Java: The most important feature of Kotlin is its deep interoperability with Java. Kotlin compiles to JVM bytecode and runs on the JVM, using Java libraries and tools.
  • Concise: Unlike Java, which is verbose, Kotlin reduces the amount of boilerplate code. This results in a leaner code syntax and improved readability.
  • Safe: Kotlin improves code safety through the proper initialization of properties, null safety, and strong type inference.
  • No runtime overhead: Kotlin imposes no runtime overhead. The standard Kotlin library is small. The Kotlin runtime exists only to support the language features. It has mostly focused on extensions to the Java standard library. Many of its internal functions are inline.
  • Collections: In Kotlin, we have higher-order functions, lambda expressions, operator overloading, lazy evaluation, and lots of other useful functions for working with collections.
  • Extension functions: Kotlin allows us to extend the functionality of existing classes without inheriting from them. Extensions do not modify classes; they extend them and are resolved statically.
  • Open source: Kotlin is an open-source programming language. The Kotlin project is open-sourced under the Apache 2.0 licens...

Table of contents

  1. Title Page
  2. Copyright and Credits
  3. Dedication
  4. Foreword
  5. Contributors
  6. Acknowledgements
  7. About Packt
  8. Preface
  9. Kotlin – A First look
  10. Kotlin – The Game Changer
  11. An Overview of Java EE and Kotlin
  12. Kotlin with JSF and CDI
  13. Kotlin with JPA and EJB
  14. Enterprise Messaging with Kotlin
  15. Developing RESTful Services with JAX-RS
  16. Securing JAVA EE Applications with Kotlin
  17. Implementing Microservices with Kotlin
  18. Performance Monitoring and Logging
  19. Design Patterns with Kotlin
  20. Other Books You May Enjoy

Frequently asked questions

Yes, you can cancel anytime from the Subscription tab in your account settings on the Perlego website. Your subscription will stay active until the end of your current billing period. Learn how to cancel your subscription
No, books cannot be downloaded as external files, such as PDFs, for use outside of Perlego. However, you can download books within the Perlego app for offline reading on mobile or tablet. Learn how to download books offline
Perlego offers two plans: Essential and Complete
  • Essential is ideal for learners and professionals who enjoy exploring a wide range of subjects. Access the Essential Library with 800,000+ trusted titles and best-sellers across business, personal growth, and the humanities. Includes unlimited reading time and Standard Read Aloud voice.
  • Complete: Perfect for advanced learners and researchers needing full, unrestricted access. Unlock 1.4M+ books across hundreds of subjects, including academic and specialized titles. The Complete Plan also includes advanced features like Premium Read Aloud and Research Assistant.
Both plans are available with monthly, semester, or annual billing cycles.
We are an online textbook subscription service, where you can get access to an entire online library for less than the price of a single book per month. With over 1 million books across 990+ topics, we’ve got you covered! Learn about our mission
Look out for the read-aloud symbol on your next book to see if you can listen to it. The read-aloud tool reads text aloud for you, highlighting the text as it is being read. You can pause it, speed it up and slow it down. Learn more about Read Aloud
Yes! You can use the Perlego app on both iOS and Android devices to read anytime, anywhere — even offline. Perfect for commutes or when you’re on the go.
Please note we cannot support devices running on iOS 13 and Android 7 or earlier. Learn more about using the app
Yes, you can access Kotlin for Enterprise Applications using Java EE by Raghavendra Rao K in PDF and/or ePUB format, as well as other popular books in Computer Science & Entreprise Applications. We have over one million books available in our catalogue for you to explore.