feat: Make spotlight formatting consistent across articles

This commit is contained in:
Mark
2021-04-02 12:35:40 +01:00
parent 59ad73b907
commit 41f3748b04
13 changed files with 137 additions and 138 deletions
+14 -14
View File
@@ -1,17 +1,17 @@
**What is kotlin?**
## What is kotlin?
Kotlin is a statically typed programming language that runs on the JVM (Java Virtual Machine).
**Why does kotlin exist?**
## Why does kotlin exist?
Kotlin exists as a modern roll of Java - Java was built from the ground up to suit OOP, and that's a task that it does pretty well. Later, functional programming was added in, by contrast, kotlin was made with both paradigms in mind, picking the good, easy to adopt parts up and adding them all into one neat language. Kotlin also had a requirement: Allow interop with Java code - to which it does (works great on android!)
**How hard is kotlin to learn?**
## How hard is kotlin to learn?
Well, that depends a lot on where you are coming from. If you already know Java, it'll be exceptionally easy to pick up. Everything has a very "right" feeling to it compared to the older style, it's almost like a natural progression.
If you don't know Java, that's a bit trickier to answer. You can certainly learn it, as a first language either, but there are some Java things you will need to know. If I were learning it as a first language, I'd try to heavily rely on the documentation and understand each feature that exists in kotlin, and why they exist. The most important is the concept of nullable types.
Java will allow anything to be null, but in kotlin there is a distinct separation. a `String` is very different to a `String?` - the second one can have a value of null, the first cannot. When interoping with Java code, it's always best to assume anything can be null.
**What are some key features of kotlin?**
## What are some key features of kotlin?
If you're a Java user, here is a comparison list made by Jetbrains: <https://kotlinlang.org/docs/reference/comparison-to-java.html>
Some key ones to point out of this list:
@@ -20,19 +20,19 @@ Some key ones to point out of this list:
- Delegation properties (Lazy evaluation, observables and more !!)
- Extension functions - great for fixing up a library class that is missing a method. No pretty print function? That's cool, just define it yourself. `LibraryClass.newFunction() = ...` (Yes, like C#)
**What platforms can kotlin run on?**
## What platforms can kotlin run on?
Anything and everything. Let's break that down:
**The JVM**
## The JVM
This is primary compile target, the JVM as a piece of kit allows you to write some code and have it work without separate compilations on Windows, Mac and Linux - so you've got all of your bases covered there.
**Android**
## Android
Yea, it's also a first class language on android, the only other language supported by google: <https://youtu.be/d8ALcQiuPWs>
**Native**
## Native
If you don't like the JVM and you're not an android dev, well, you can just target native: <https://kotlinlang.org/docs/reference/native-overview.html>
**JavaScript**
## JavaScript
Yea, you can make kotlin compile to JavaScript, see here: <https://kotlinlang.org/docs/tutorials/javascript/kotlin-to-javascript/kotlin-to-javascript.html>
Here are some extra points that don't fit into any of the headings above
@@ -43,7 +43,7 @@ Here are some extra points that don't fit into any of the headings above
- Kotlin is fairly unopinionated, so if you're more a functional person you can go down that route most of the way, and the same for OOP, think of it as the Jack of all trades
- Kotlin allows building through both maven and gradle, two very mature build systems with a lot of libraries available - that means that you don't need to suffer the problems associated with small languages (No tools or libraries, it already has a great set of tools (intellij, maven, gradle) and a great ecosystem (it steals from Java!))
**Learning resources**
## Learning resources
- Language reference: <https://kotlinlang.org/docs/reference/>
- Introduction to kotlin <https://youtu.be/X1RVYt2QKQE>
@@ -52,7 +52,7 @@ Here are some extra points that don't fit into any of the headings above
- Try it out online <https://try.kotlinlang.org/#/Examples/Hello,%20world!/Simplest%20version/Simplest%20version.kt>
- **Awesome** kotlin - <https://github.com/KotlinBy/awesome-kotlin> Many great resources and libraries here
**Hello, world!**
## Hello, world!
```kotlin
fun main(args : Array<String>) {
@@ -60,7 +60,7 @@ fun main(args : Array<String>) {
}
```
**FizzBuzz**
## FizzBuzz
```kotlin
fun main(args: Array<String>) {
@@ -70,7 +70,7 @@ fun main(args: Array<String>) {
}
```
**Generate some nice HTML**
## Generate some nice HTML
```kotlin
//declarations here `https://kotlinlang.org/docs/reference/type-safe-builders.html`
@@ -107,7 +107,7 @@ fun result(args: Array<String>) =
}
```
**Create some SQL tables and do some CRUD operations with kotlin exposed (link here: <https://github.com/JetBrains/Exposed>)**
## Create some SQL tables and do some CRUD operations with kotlin exposed (link here: <https://github.com/JetBrains/Exposed>)
```kotlin
// Declare the table structure