Speaker

Suraj Shah

Suraj Shah

Technical Lead, SuperShare

Bengaluru, India

Hallo, I'm Suraj (he/him). I lead the technical team at SuperShare. I like to talk about programming languages in general. My interest lies in Go and Rust but Kotlin is my daily driver.

I started as an Android Dev but the logic side of things pulled me to work with the backend team and handle couple of scalable services myself. My primary tech stack includes: Kotlin, Java, MongoDB, Kafka, Redis and Aerospike.
I've contributed to couple of open source projects, including the rewrite of the Firefox browser for Android.

I like to read a lot. I can speak 5 languages. Recently picked up German.

You can talk to me about programming languages, system design and transitioning towards backend.

Danke :)

Area of Expertise

  • Information & Communications Technology

Topics

  • software engineering
  • OpenSource

Dissecting the inline keyword in Kotlin

A deep-dive into the internal workings of the inline keyword in Kotlin

While being mostly under-recognized, this little optimization forms the backbone for a lot of features and APIs in Kotlin, features which are directly dependent on the lambda infrastructure.

And it doesn't stop there, the inline keyword opens up the ecosystem to have capabilities for type reification, which still isn't possible when writing Java.

Java 8 introduced the concept of lambdas, while this was done at the language level, using bytecode instructions introduced in Java 7, Kotlin, tries to make this lambda functionality available for applications targeting Java 6. Kotlin does this by creating Classes of functions are lambdas. This can lead to performance problems as a good number of instances for the classes might get created.

This talk dives into:

* How does Kotlin achieve it? What changes does it do to make this compatibility happen?
* How does inlining optimize a lambda?
* How this little optimization makes it possible to have type reification?
* How it doesn't stop there and introduces the concept of Inline classes, which enable Kotlin to have unsigned integers.
* How all of this is done, by just adding one keyword support in Kotlin.

Also presented at:
* FOSDEM20, Brussels: https://fosdem.org/2020/schedule/event/kotlin_dissecting_the_inline_keyword/
Video link: https://video.fosdem.org/2020/UA2.118/kotlin_dissecting_the_inline_keyword.mp4

Link to medium article submitted on proandroiddev:
https://proandroiddev.com/dissecting-the-inline-keyword-in-kotlin-chapter-1-51735600d7

Understanding mocks and spies using mockk

Mocks and spies form a vital tool for unit, integration and end-to-end tests. But a lot of potential use-cases are sometimes lost in the jargon, with questions like: Is it a stub? What is a fake? Why can't we directly use the real objects? etc.

While these questions seem to be valid and they do attract the spotlight, the core fundamentals behind mocking and spying seem to lose focus.

In this talk we'll cover the journey of re-understanding these core concepts from an implementation point of view, while putting focus on the following points:
* What are test doubles and why are they called so?
* Types of test doubles and busting the jargon with simple definitions.
* Introduction to mockk.io and its Kotlin first nature.
* Mocking and Stubbing in context of mockk.
* Mocking vs Spying with real life examples on which one to use when & why with working code snippets around the same. Canned responses and why we need them.
* Mocking private calls and implementation hurdles.
* Mocking extension functions. Moving away from the OO nature of mocking.
* Shortcomings, problems and troubleshooting them by understanding how the internals works.
* Advanced features: Verification - ordered, unordered. Answers and exclusions, Capturing, Operations, coroutine support, properties support.
* Unmocking.
* Links, documentations and cheat-sheets.

While some real life examples originate from backend applications, listeners in no way need to be aware of any backend context. This topic is Kotlin first and conceptually deep dives into mocking and spying as a concept. The listeners are not expected to have prior knowledge of testing or are expected to have written mocks or spies before.
Mockk is just one of the tools for mocking available. And the choice for using mockk as the basis for the explanation of these concepts is a personal decision and wasn't sponsored.

Suraj Shah

Technical Lead, SuperShare

Bengaluru, India

Please note that Sessionize is not responsible for the accuracy or validity of the data provided by speakers. If you suspect this profile to be fake or spam, please let us know.

Jump to top