Kotlin for new programmers

Do you think Kotlin is a good language for learning programming? Would you recommend it for that purpose?

1 Like

Yes

4 Likes

I think Kotlin is a good language to start, because it tries to make a lot of well-known programming concepts available through polished syntaxes:
Object oriented
Functional
Contract (not stable yet I think)
Context programming
Coroutines
Etc.

Moreover, its syntax is more easy to learn than a lot of functional languages. It’s not as advanced as other, well established languages, but is far easier to learn imho.

And as other garbage collected languages, memory management is easy (but be careful, it’still important to understand memory model)

1 Like

Absolutely.

  • It’s a better intro language than Java. Instead of everyone starting with their public class main and public static void main(String args[]) (so many words that a beginner doesn’t need to care about), they start with just fun main() and get straight to writing code. Gradually, you can introduce writing more methods, then data classes, then extension methods, then class methods, then interfaces, then inheritance.
  • It’s a better intro language than Python. The basics are much the same, but the compilation step catches errors with greater ease than Python. The language is “safer,” as things are properly scoped and protected with val versus var, with no global keyword that just confuses beginners. Really, I can’t think of any advantage Python has over Kotlin.

I teach Kotlin at Uni (2nd year), but would use it instead of Java in the first year. Less main ceremony is nice, but in general Java is problematic for hello world. It has too many “magic incantations”. Very important for beginners is that Kotlin has free functions. Having to use classes when you don’t need them is extremely confusing for beginners and they tend to misuse classes/objects a lot as a consequence. Add in the static keyword and it can become mayhem. In general beginners don’t seem to understand the static keyword (not applied to methods, let alone applied to nested classes).

Overall I find Kotlin to be concise and conceptually quite clean. It also allows you to write very clean code, or write your own functions that allow you to do that.

4 Likes

Sure! Check it out by the way: JetBrains Academy. There are a lot of content about Kotlin, and algorithms in general.