Kotlin Programming: Spring, Ktor

Training is conducted by Trayan Iliev, Oracle® certified Java programmer with 20 years experience, developer of end-to-end reactive fullstack apps with TypeScript, Angular, React and Vue, 15+ years experience as IT trainer for international software companies. Regular speaker at developer conferences – Voxxed Days, Java2Days, jPrime, jProfessionals, BGOUG, BGJUG, DEV.BG on topics as SOA & REST (JAX-RS, Microservices), Spring & Spring Reactor, Angular, React, high-performance Java programming.

Duration: 45 hours

Target audience: Java developers

Key takeaways:

  • detailed, systematic hands-on learning of rich Kotlin capabilities and language constructs;
  • rapid development, testing, deployment of production-ready, secure web applications and REST services using Kotlin, Ktor, Spring Boot, Hibernate, Spring MVC, WeFlux, Reactor, MySQL/PostgreSQL, MongoDB;
  • detailed hands-on experience using Kotlin, concurrent programming using coroutines and channels, REST microservices with Ktor, Spring Boot, Hibernate, JPA, Spring MVC, Spring Data, Spring Security, Spring MVC Test framework, KotlinTest, MockK, Logback, SLF4J, JSON, Protocol Buffers, reactive programming using Kotlin Flow;
  • novelties in  Kotlin, Ktor, Flow, Spring 5, Spring Boot, WebFlux и  Reactor – functional reactive programming, real-time event stream processing, security.

Course program:

  1. Introduction to Kotlin – why Kotlin?, main features, comparison with Java, installation, InteliJ IDEA, Kotlin REPL, hello-kotlin program, programming and debugging with InteliJ, git workflow setup (1 h)
  2. Kotlin basic syntax – variables and values, basic types, numbers, strings, string templates, statements and expressions, main operators, operator overloading, equality, nullable values and null checks, null safety, type checks and automatic casts, ‘is’ and ‘as’, conditionals, functions, for and while loops, return, break and continue, labels, ranges, when expressions, arrays and array invariance, basic collections, basic classes and their instances, basic data classes (DTOs/ POJOs/ POCOs) (3 h)
  3. Packages and imports – package declarations, imports and default imports, static imports, classes and interfaces, visibility modifiers, modules (1 h)
  4. Classes and objects – classes, instances, constructors and initializer blocks, properties and fields, getters and setters, late initialization, implicit and qualified ‘this’, inheritance, overriding methods and properties, sequence of initialization, abstract classes, interfaces, functional (SAM) interfaces, decorator design pattern, extension functions and properties, companion objects, data classes, copying, destructuring, sealed classes, generics, type parameters, covariance and contravariance (in and out), invariance, type projections, star projections, generic constraints, generic functions, type erasure and reification using inline functions, nested classes, enum classes, object expressions and declarations, type aliases, inline classes, delegation, delegated properties, standard delegates – lazy, observable, memorization, storing values in a map, providing custom delegates. (5 h)
  5. Functions and lambdas – function declarations, parameters, default arguments, named arguments, Unit-returning functions, single-expression functions, functions with block bodies, explicit return types, varargs, destructuring, infix notation, function scope, local functions, member functions, extension functions, generic functions, tail recursive functions, function types, higher-order functions, lambdas and anonymous functions, scope functions, it – implicit name of a single parameter function, returning values from lambdas, function references, invoking a function type instance, closures, function literals with receiver, creating custom DSLs using type-safe builders, inline functions, non-local returns, inline properties. (4 h)
  6. Collections and sequences – Kotlin collections overview, collection types, mutable and immutable collections, main interfaces – List, Set, Map and their implementations, constructing from elements, empty collections, initializer functions for lists, copying, producing collections and maps by invoking functions on other collections, iterators and mutable iterators, sequences, constructing sequences from elements, Iterable, function, chunks (yielding), sequence and collection operations (map, filter, take, reduce, plus and minus operators, grouping, retrieving collection parts, retrieving single elements, ordering, aggregate operations, etc), List, Set and Map-specific operations. (3 h)
  7. Exception handling. Annotations. Reflection – errors and exceptions, exception handling with try-catch-finally, exception matching, declaring exceptions, using custom exceptions, Java interoperability, using annotations in Kotlin, defining custom annotations, kotlin-reflect, class references, callable references. (2 h)
  8. Data Serialization. Interoperability with Java – IO API for working with files and streams – kotlin.io package, working with text and binary files in Kotlin, object serialization – default (binary), CSV, JSON, protocol buffers, interoperability with Java. (3 h)
  9. Coroutines and concurrency – threads, kotlin.concurrent package extension classes and functions, difference between threads and coroutines, coroutines basics, writing own coroutines, bridging blocking and non-blocking worlds, waiting for a job, structured concurrency, scope builder, extract function refactoring, suspend modifier, global coroutines and daemon threads, cancellation and timeouts, cooperative cancelation, closing resources with finally, using withContext, non-cancellable blocks, asynchronous timeout and resources, composing suspending functions, sequential by default, concurrent using async, lazy async, structured concurrency with async. (3 h)
  10. Coroutine Context and Dispatchers – dispatchers and threads, unconfined vs confined dispatcher, debugging coroutines and threads, debugging with IDEA, using logging, jumping between threads, Job in the context, children of a coroutine, parental responsibilities, naming coroutines for debugging, combining context elements, coroutine scope, thread-local data, exception handling – CoroutineExceptionHandler, processing, aggregation, supervision. (2 h)
  11. Asynchronous Flow – representing multiple values, sequences, suspending functions and flows, pull (cold) streaming, flow cancellation, flow builders, flow operators, flow context, flowOn operator, buffering, conflation, composing flows, flow exceptions, exception transparency, flow cancellation checks, making busy flow cancellable, launching flow, imperative vs. declarative flow programming, reactive programming, Flow and Reactive Streams. (2 h)
  12. Shared mutable state and concurrency – sending data and closing a channel, iteration over channel (for-in), creating channel producers and pipelines, message processing patterns – Fan-out, Fan-in, channel buffering, ticker channels, shared state and mutual exclusion, thread-safe data structures, thread confinement, actors, awaiting multiple suspending functions using select expression. (2 h)
  13. Test Driven Development (TDD). Logging – using KotlinTest, tests and assertions, writing TDD and BDD tests, choosing a spec, project config, matchers, inspectors, interceptors, property testing, table-driven testing, tags, conditions and config, grouping tests in test suits, testing for exceptions, mocking objects in Kotlin using MockK library. Idiomatic logging using Logback and SLF4J. (3 h)
  14. Databases and persistence. Spring Data – connecting to MySQL/PostgreSQL DB using Spring Data JPA, executing SQL CRUD operations, connecting and inserting data in MongoDB, CRUD operations with Spring Data Mongo. (3 h)
  15. Spring Boot, Spring MVC and Web Flux REST/ WebSocket API development in Kotlin– introduction to HTTP, AJAX, REST, CORS, WebSocket, domain driven design best practices, building REST APIs and applications with Spring MVC using annotations, functional reactive web service implementation using Spring Web Flux and Reactor, handling errors, deploying for production, testing REST APIs with Spring. (4 h)
  16. Rapid development of production REST APIs using Ktor – advantages of Ktor and Kotlin, low-ceremony, DSL, coroutines, implementing asynchronous HTTP/S 1.x/2.x and WebSocket services and clients, configuring server engine by composing modules, features and pipelines – routing, sessions, compression, authentication (JWT, OAuth, LDAP), CORS, JSON, audio/video streaming, static content, sessions, templates, error handling, webjars, Micrometer and Dropwizard monitoring, structured HTTP request handling, type-safe routing DSL using higher order functions, supported ApplicationEngines (Netty, Jetty, CIO,Tomcat, etc.), testing Ktor APIs using TestApplicationEngine, reactive Flow and RxJava integrations, building and testing end-to-end reactive micro-services with Ktor. (4 h)

Presentations, demonstrations, and hands-on exercises are conducted in parallel to achieve immediate reinforcement of concepts in practice.

Participants will learn how to rapidly develop, deploy, and test production ready, secure web apps and REST services with Kotlin, Ktor, Spring Boot, Hibernate, Spring MVC, WebFlux, Reactor, MySQL/PostgreSQL, MongoDB. Study is conducted in small groups – up to 10 persons. During the training there will be opportunity for discussion of additional questions the participants are interested in.

For more information and registration, please send us an e-mail at: office@iproduct.org