Is Kotlin good as my first "real" Language?


#1

Hey there Kotliners(?),

I tried Powershell, because i am an admin, and went through a few ruby/python/f# tutorials, because my school told me so :slight_smile:

But now I want to learn a language capable of creating client applications, web applications and mobile apps, besides being geared up for the backend part.
I think Kotlin can all do this. So my question is:

Is Kotlin any good as a first programming language relating to simplicity of syntax etc.?

Thank you for your coming answers :slight_smile:


#2

IMO, yeah.


#3

I agree. Kotlin is consistent and expressive without being verbose. The syntax is easy to learn and does not contain annoying requirements like semicolons at the end of each line. The val allows easy access to final variables and the property syntax is nice to write and concise. Also Kotlin supports different kind of programming styles from OOP to functional.

There are however a few problems IMO that you should be aware of. Kotlin “hides” some more complex parts behind the nice syntax. The first is properties. I think it’s important to be aware of the fact that those hide methods which look just like accessing a variable. It’s easier to see this in languages like java as you have to create all getters and setters yourself. This creates a lot of repeating code and it’s good for kotlin to move away from that, but knowing about it and understanding why they are there in OOP is important.
The other thing many people have problems with in kotlin (and this includes experienced programmers) is that val does not always implies immutability. Instead it only means that a field is read-only.

Another small problem could be the amount of resources about Kotlin. Kotlin has a great documentation and IMO also a great community but I don’t know how many resources there are for people completely new to programming. Many tutorials require some java experience, but I think this should not be too hard to overcome.


#4

Resource wise Kotlin is not as well-supported as for example Java which has too many books available. But it is conceptually cleaner. From a teaching/learning perspective free functions are much more intuitive and straightforward than Java ones. It also has a lot less of boilerplate and other code that for beginners you need to write “because the teacher says so” (for example setters/getters). For beginners even first is much more intuitive than the equivalent using a for loop. And of course the web version is brilliant.


#5

I will be starting a course on scientific programming in kotlin next term. And for physicists it s definitely the first “real” language. We are rather limited in this since C++ is used broadly, but it is definitely a bad candidate for the first language. Java is good, but why have java, when you can have kotlin?

In fact, I think that the real choice is between Java, Python and Kotlin. Python is good candidate for first language, but not for first “real” language. Java has a lot of teaching materials, but Kotlin is growing very fast.


#6

Thank you for your replies and suggestions.
I agree that Python is mainly easier to learn, but commonly slower.
GUI features are also not that good from what i have seen so far.
I was actually thinking do i choose C# or Java, then i found Kotlin.
then it was C# or Kotlin.

For me the Syntax of Kotlin looks easier and a bit more clean?
I don’t really know about performance of both in comparison in the different fields (GUI, Web…).
But i don’t think the margin is too big. Syntax is for me, as a beginner, more important.
Thanks!


#7

For the first language it is not a question of speed. The problem is that in order to write quality programs in Python you need to follow some practices that come not from general common sense or language structure, but from python limitations. For example, in Python you are forced to use ndarray everywhere event if common logic dictates otherwise (I am talking about computations, but there are similar points).

C# is a very good language, but its application is historically more limited than Java/Kotlin (since good CLR implementations for non-Windows systems arrived only recently). In my personal opinion, Kotlin has better prospects than C#, but they are similar enough that it is not a real problem.


#8

Kotlin is expressive, usually easy to understand meaning with a mere glance. It’s not Haskellian elegant though, mainly because it lives to java interop and that oft complicates things. Personally I wish Java interop was tossed to bin and forgotten. {rant} Kotlin needs to evolve, java’s a hindrance to that.{/rant}


#9

You do not have to create all getter and setters in java. You can read filds in java. And this is much faster (for java), especially on mobile.


#10

It seriously depends on programs you want to write. Is it command line tools ? Is it client code for web or Android or iOS ? Is it a server side code ?

Unfortunately, there is no language that cover all the platforms.

Kotlin might have something in the future.


#11

Kotlin does not have java interop. Look at Kotlin.js or Kotlin.native (or Kotlin on iOS). It does not have anything related to java.


#12

On the other hand, K/J has Java interop, K/JS has JavaScript compilation, K/N… I haven’t even managed to compile it after trying for 5 hours. So many possibilities. Sounds worse than just Java interop?
You can’t practically write anything useful without interop with one of the environments.


#13

There is a laguage that covers every single aspect of programming. C. It can be use for literally everything, provided the platform has a compiler/assembler for it. Aside some esoteric/very-old systems, there isn’t a great many that is weird enough to not have C. And even if they don’t have, C is one of the closes almost-hardware-banging languages there is, aside straight assembler. And barebones can be made for any such very swift, albeit with optimizations later.


#14

Yes, C/C++ is very good. But they are extemely hard. Very few people can program it.
Thats why java and Kt exists.


#15

I despise Java (truly), but I love Kotlin, (and Haskell). C one the other hand is a tool for when speed is of utmost importance. C is at least semi- portable, as I’m not ready to learn each and every assembler there is.


#16

I think C/C++ currently is the only multi-platform language.

But this thead is about Kt.
And we here to help the thread starter.

Probably he has to learn all and compare, java, C++, Kt, JS and C# is a good start.


#17

Frankly, I’d skip JS. It’s nice for web, but that’s it. C#is like trying to shove “I love Microsoft” at anyone… Java? Ehh, no one should learn that…


#18

I’ve gone thro a lot of languages, Perl, Python, Ruby, C, C++, D, R, Ocaml, E, Haskell, MC, yadda yadda. Kotlin’s one of the easiest to make code other people can understand.


#19

Well, tonns of clent UI code written in JS. Web+JS is probably the top cilent platform. For what reason to skip it? Java is a very nice managed language, very popular, l think it is 2nd asked language on hiring, after JS.

C# is also very powerfull language with powerful unmanaged extensions. Its not used for client code as far as know…

Kt is growing and in trend.

Learning them all is an answer.


#20

There is nothing nice in Java, not even in name. It’s so verbose that it’s not even readable! What comes to UI? Beyond Web? Who in their right mind uses JS if they want security? Or even mediocrum of not-crashing. They’re not laguages, they’re toys.