It seems that you're using an outdated browser. Some things may not work as they should (or don't work at all).
We suggest you upgrade newer and better browser like: Chrome, Firefox, Internet Explorer or Opera

×
low rated
I am wondering if it's worth looking into the programming language Kotlin. I currently know C, C++, Python, and bits of assembly and rust. (I should also point out that I have no desire to learn java, as I don't like that language's forced object orientedness.)

I also have a few other questions:
* How does Kotlin compare to other languages? In particular, how would you compare it to, say, C or Python?
* How are the open source tools for Kotlin development?
* How well does Kotlin interact with other languages?
* How resource intensive is Kotlin? In particular, how much memory does, say, a hello world program take?
* Would it be relatively simple to recreate my forum avatar with a Kotlin program? (The black portion of my avatar is just a rotated Mandelbrot set.)
Kotlin is basically Java improved. If you don't like Java, Kotlin might not be for you.
Good stuff in Kotlin: nullable (if an object is null and not nullable, compiler error), it's also less verbose, but sometimes verbose is not that bad. It also has operator overloading, which personally I think is dangerous if abused.
It runs on JVM but I think it can be translated to javascript too in some cases.
low rated
avatar
blotunga: Kotlin is basically Java improved. If you don't like Java, Kotlin might not be for you.
Just looking briefly at Kotlin, I already see two respects in which it is definitely improved over Java:
1. Not everything needs to go in a class. This greatly simplifies the "hello world" program and is definitely helpful for situations when OOP is the wrong solution.
2. Type inference, which significantly reduces redundancy in the code. In particular, creating a new object doesn't require repeating the class name twice. According to https://www.infoworld.com/article/3224868/what-is-kotlin-the-java-alternative-explained.html, "StringBuilder sb = new StringBuilder();" becomes "val sb = StringBuilder()", which is a lot less tedious, while stile conveying the same information. (It appears that the type inference in Kotlin is very similar to how it is in Rust, which is not quite as powerful as in C++ with the auto keyword.)
avatar
blotunga: it's also less verbose, but sometimes verbose is not that bad.
Verbose can be good if the extra words convey useful information to the programmer; it's not so good when it's extra noise that conveys no useful information. Rust's "unsafe" is good verbosity; Java's need to state the class name twice when creating an object is not.
Post edited March 25, 2020 by dtgreene
True, I think it's a big improvement over Java. Let's hope it gains traction
avatar
blotunga: Good stuff in Kotlin: nullable (if an object is null and not nullable, compiler error), it's also less verbose, but sometimes verbose is not that bad.
For example, the function keyword in Kotlin is "fun".
avatar
dtgreene: Verbose can be good if the extra words convey useful information to the programmer; it's not so good when it's extra noise that conveys no useful information.
I agree, but I think your Java knowledge is a little out of date, since it does have type inference in more recent versions, using the "var" keyword. (Although it's not technically a keyword and you can use "var" as a variable name.) e.g. "var sb = new StringBuilder();" But it still requires "new", which I think is pointless verbosity in this case since obviously you're creating a new instance, what else would it be.
Post edited March 25, 2020 by eric5h5
avatar
dtgreene: Verbose can be good if the extra words convey useful information to the programmer; it's not so good when it's extra noise that conveys no useful information.
avatar
eric5h5: I agree, but I think your Java knowledge is a little out of date, since it does have type inference in more recent versions, using the "var" keyword. (Although it's not technically a keyword and you can use "var" as a variable name.) e.g. "var sb = new StringBuilder();" But it still requires "new", which I think is pointless verbosity in this case since obviously you're creating a new instance, what else would it be.
I am pretty sure that "new" comes from C++, where it is used to dynamically allocate space for an object that would outlive the function (and actually returns a pointer to it). Thing is, in C++, you can create an object on the stack without having to use the "new" keyword; it's just like declaring a variable without a primitive type. (Just make sure that no pointer to the object outlives the function.) I note that C++ also has "delete" to free the object, which is something not seen in Java.

In any case, in C++, "new" serves a real purpose, to indicate heap rather than stack allocation, and also a sign that you're going to need to use "delete" somewhere if you want to free the memory later.

Example:
auto a = StringBuilder();
will create a StringBuilder object on the stack, call it "a", and a will be automatically freed (with the destructor called) when the function returns.
auto a = new StringBuilder;
will allocate a StringBuilder on the heap, and it will remain until
delete a;
is executed. Also note that a is a *pointer* to the object, not the object itself.
If you're interested in Android development, absolutely.
Kotlin's main benefits lie in its Android extensions, IMHO.

If not, then it's not such an obvious candidate.
Particularly if you've no interest in getting acquainted with the rest of the Java/JVM ecosystem.

I'f you're looking to try out a new programming language in general, I think you'd have more fun with Go or C# (and perhaps F#, if you're brave) on .NET Core.

And then there are all the new features in C++. It's not your grandpa's C++ anymore. Well, it is, but it's a lot more too. Too much more, perhaps. (Remember the Vasa! -- Stroustrup)

How about Haskell? >:-)
avatar
Norglics: No.
Why not?