Free AI web copilot to create summaries, insights and extended knowledge, download it at here
4604
Abstract
d experience. These opinions, and the reasons for them, are always motivated, thoroughly explained, and unapologetic, even when this means being in conflict with the official documentation.</p><h2 id="fcb3">You like a hands on, no-nonsense approach.</h2><p id="da38">The Primer uses embedded <a href="https://play.kotlinlang.org/">Kotlin Playground</a> code to provide interactive demonstrations for all the material, which can be edited and run directly from the article page. Here is an example:</p>
<figure id="29d6">
<div>
<div>
<img class="ratio" src="http://placehold.it/16x9">
<iframe class="" src="https://cdn.embedly.com/widgets/media.html?src=https%3A%2F%2Fpl.kotl.in%2FfKYzhIPYa%3Ffrom%3D13%26to%3D30&display_name=Kotlin+Playground&url=https%3A%2F%2Fpl.kotl.in%2FfKYzhIPYa%3Ffrom%3D13%26to%3D30&image=https%3A%2F%2Fplay.kotlinlang.org%2Fassets%2Fog-image.png&key=a19fcc184b9711e1b4764040d3dc5c07&type=text%2Fhtml&schema=kotl" allowfullscreen="" frameborder="0" height="300" width="800">
</div>
</div>
</figure></iframe></div></div></figure><p id="c01c">Additionally, <b>every article introducing a new concept includes exercises that can be run and completed directly on the page of the article</b>. The exercises are designed to really drive home how things work, validated by tests, and often require some effort to solve.</p><p id="681a">The Primer <b>does not waste time with trivial exercises</b> that serve only to frustrate the intelligent reader. It has faith that you can indeed write a function that sums two integers, and doesn’t really see the need for you to prove it. It is for this reason that there are no exercises until the article on <a href="https://readmedium.com/nullability-46d1bed24111">Nullability</a>.</p><h1 id="3585">What you won’t find in the Primer</h1><h2 id="d9ce">Subjects outside the JVM</h2><p id="98e5">The Primer is focused solely on the JVM.</p><h2 id="645a">Coroutines</h2><p id="f4cc">The Primer is a publication which strives to provide a certain level of quality to its readers. It is not satisfied with explanations that involve hand waving, and expects to be able to dissect every issue down to the fundamental level necessary to truly understand a given topic.</p><p id="cfba">A direct prerequisite for this is a satisfactory amount of practical experience, not only with the topic, but also with <i>learning</i> the topic. If there is any quality to the Primer, <b>it is a consequence of undertaking many paths through the material</b>, from those that are readily available elsewhere, to those that are a result of experimentation, introspection, or challenges one puts themselves to, and then looking back and picking the one which is deemed most satisfactory.</p><p id="76bf">I don’t yet feel that I have reached this threshold with coroutines, and I currently don’t feel confident the material would live up to the standards of quality to which this publication aspires to.</p><h2 id="b129">Certain newer features</h2><p id="ce23">The Primer was written during the year 2021, based on experience gathered during previous years. Therefore, certain newer features that have since arrived are not covered in these materials, for reasons similar to those stated above. I will cover these subjects once I am satisfied with the degree to which I understand them.</p><h2 id="a18b">Political correctness</h2><p id="7a43">Though used sparingly, there are times where “fucking” and “bullshit” are the only words that truly capture the essence of a situation.</p><h1 id="e156">How to read the Primer</h1><p id="c581">Unless you are an avid reader, it is not necessary to read these materials from start to finish. You should instead browse through and concentrate on understanding two key things: 1) what features Kotlin offers, and 2) the problems they solve. Of these two, <b>the latter is the most important</b> — awareness of a problem will cause you to recognize it when it arises, and look for a solution. This will quickly lead you to the information you need.</p><p id="ab71">I generally recommend against attempting to memorize all the details on the first go. Unless it’s something important, it’s usually better to just make a mental note that feature X is there for certain situations, and when you encounter these situations in real life, come back and read the section on feature X.</p><p id="ec36">To help you make decisions on what to concentrate on, <b>each article in the Primer is tagged with the type of inform
Options
ation included</b>. The article heading will be tagged with all tags of subheadings, and each subheading might have its own set of tags.</p><p id="5b17">These tags are:</p><h2 id="4557">FYI</h2><ul><li>Often similar to what is available in Java, or not of large significance, and trivial to understand</li><li>If you’ve never or only briefly used Kotlin, just quickly scroll through and be aware of what it is. No need to invest lots of time</li><li>If you’ve already used Kotlin more than a few times, you can probably skip it</li></ul><h2 id="b512">FYI++</h2><ul><li>Basically the same as FYI, but also includes something extra that you might find interesting — a new concept, interpretation, link to external materials etc.</li></ul><h2 id="f416">KOTLIN FEATURE</h2><ul><li>Important and different from what’s available in Java, but shouldn’t be hard to understand</li><li>If you’ve never or only briefly used Kotlin, read through carefully and make sure you understand the principles of the feature and most importantly when you should use it. Then come back and read it again when you need it.</li><li>If you’ve already used Kotlin more than a few times, just quickly scroll through and check if maybe there’s some aspect you didn’t know of</li></ul><h2 id="88e0">FUNDAMENTAL CONCEPT</h2><ul><li>Completely different from what’s available in Java and also may require a new style of thinking to understand and use effectively</li><li>You should invest the time and read through this, regardless of your seniority level. There is a distinct possibility you will learn something new, be confronted with a novel interpretation, or discover motivation for using it in a particular manner</li></ul><h2 id="cc69">EXERCISE</h2><ul><li>Contains exercises</li><li>Exercises are included for every <b>FUNDAMENTAL CONCEPT</b> and for most of the <b>KOTLIN FEATURE</b>, but not for the rest — I see no point in “Create a <code>Dog</code> class that..." nonsense.</li><li>When an exercise is there, it’s there for a reason — <b>do it</b>.</li></ul><h1 id="2a6d">Material categorization</h1><h2 id="f0c5">Introduction</h2><ul><li>Describes basic language syntax and the type system</li><li>Pay special attention to <code>when</code>, string templates, nullability and higher-order functions/lambdas. Understand that almost everything is an expression</li><li>I recommend reading the “expanded” version of types, but that can be left for later</li><li>Make mental notes about ranges, <code>tailrec</code>, <code>inline</code> and <code>vararg</code></li></ul><h2 id="2213">Classes — What we know from Java</h2><ul><li>Lengthy section on the aspects of classes that differ only slightly from what is available in Java</li><li>Mainly included as a reference</li><li>Be sure to understand the fundamentals, as they are different from Java, especially the primary constructor and properties</li><li>I recommend reading the section on variance — even if you understand the concepts, it might give you a different point of view</li><li>The rest of the section on generics might also warrant closer attention</li><li>Other than that, just sort of fly through quickly, there are almost no exercises</li></ul><h2 id="2b48">Classes — What is different</h2><ul><li>Pay special attention to reified type parameters, data classes, sealed hierarchies, inline classes, objects and delegation — especially the last one can take time</li><li>Dedicate time and energy to really understand the concept of modeling error states using sealed class hierarchies, and <b>use it</b>. It will make you a better programmer, and your code easier to maintain.</li><li>Make mental notes of enums, infix functions, operators, type aliases and functional (SAM) interfaces</li></ul><h2 id="6271">Extension functions</h2><ul><li><b>Read the whole thing.</b> No exceptions, everything is important</li></ul><h2 id="0f6a">Standard library</h2><ul><li><b>Pay special attention to Programming with Result</b> — along with modeling errors states using classes, discussed in <i>Classes — What is different</i>, this is among <b>the most important things</b> you can learn from the Primer.</li><li>Read the lesson on functional programming and why you should use it, why we needs Sequences, and pausing functions</li><li>Other than that, almost no theory, just a demonstration of the stdlib</li><li>Make mental note of everything</li></ul><p id="2def">Jump to the <a href="https://readmedium.com/table-of-contents-c52573cfa291">Table of Contents</a> or continue to the <a href="https://readmedium.com/preface-a65cb535d122">Preface</a>.</p></article></body>