190 points · by lemevi · 11y ago · 199 comments
[1] https://github.com/search?o=desc&q=language%3AKotlin&ref=searchresults&s=stars&type=Repositories&utf8=
This is what I love about Kotlin:
- It is IMHO the best language to develop native application in Android by far.
- I was primarily a C# developer (still now) and I could pick up the language in a day. The language is quite small for people that has already known a programming language.
- JetBrains is taking their time to get the language right. There is no 'swift syndrome' here.
- They are really serious about the Java 100% compatibility.
- The IDE support is world class.
- It is a really pleasant language to use.
- JetBrains is actually using the language for their own products.
- The community is friendly and the language designers are approachable.
- You can really mix and match Java and Kotlin code in the same project. You don't have to use it only in a green field projects.
Kotlin was developed in the open from much of its development and you can see how the language evolves based on the feedback of early adopters. There is no rush to 1.0 until they feel they got the right mix of features.
I just think the way Jetbrains approached the development of the language is more responsible and it bodes well for future iteration of the language.
but the hype was mostly done by the apple disciples iirc, so it might be a little unfair to hold that against the language.
However, Python 2/3 is a better example for breaking backwards compatibility.
But I could be wrong.
Not that Kotlin is introducing anything like this, but, I wonder if this sets a precedent going forward for popular programming tooling vendors to evolve as the primary distribution point for introducing new programming language research and paradigms to the industry.
+ World class IDE support.
+ Simple Language, that isn't as complicated as Scala (but this really depends on what features you end up using) but is expressive nonetheless.
+ Really good Java compatibility (if that matters to you that is).
- Language still does not have a 1.0 (although for a few GUI apps I've done, things are pretty stable)
- Language has poor documentation compared to the likes of Java and Scala
- Language has few learning resources (but two people in the Kotlin team are working to change that)
As far as Android development goes, Android Studio is built on top of the IntelliJ platform (which is Jetbrains' product) so I think you'll get really good android development support for Kotlin although I'm a little indifferent to this. I think that at one point go is going to become the defacto language for Android since google likes to keep everything in-house.
As someone who writes Android/Java code for the day job but who prefers coding in Go whenever I have the chance, I'd love for this happen but I doubt it will anytime in the foreseeable future.
There's just way too much invested in all of the Android Java Platform/UI/etc APIs which would make little to no sense in Go even if you had good bindings for them.
Go will be increasingly supported in Android and it'll get some uptake from people writing games and apps that are primarily OpenGL based, but I just don't see how they could (without investing an absolute giant amount of resources and causing all sorts of developer balkanization), get from where the Android platform is now to an equivalent environment that is properly Go-esque for apps that make heavy use of the higher level platform APIs.
You nailed it. I think that this is ultimately something that JetBrains must stress in their documentation and have extensive examples on how to go about doing this if Kotlin is to get much more widespread adoption.
Kotlin is a tool we created out of need. We're using it and we're relying on it, so I'd say it's got a very good long term viability.
Also I still miss a good build tool. I mean Maven really sucks, Gradle is kind of okai, but there is no support of autoreload project on change (like sbt has via sbt-revolver or playframework internals) however that is mostly helping web development.
Also some other things aren't really written out, like threading or some kind of Akka stuff. Also these days a language needs Dependency Injection, a good Integration with JSR330 would be great.
Also for some functional workflows something like pattern matching would be great and a @tailrec annotation like scala.
And please, for gods sake, remove labels and break/while.
Why?
> I mean Maven really sucks
Why?
> Also these days a language needs Dependency Injection
There's plenty of JVM libraries that provide it. Why does a language need to provide it?
Why?
I think after a while one gets tired of using XML as a configuration language. It's verbose and not the easiest to read. Beyond that, we used to find ourselves in dependency hell with maven pretty frequently, though that hasn't happened to me in a few years.
The biggest problem, imho, is that it's inflexible. You can't just (easily) throw in a bit of functionality or make an unusual tweak to your build. So, if you can't find an existing plugin to do what you need, you have to write it yourself.
I've written a maven plugin, and the documentation/support was rather poor. I also found myself having to use an older version of various plugin libraries in order to write proper tests for the plugin. It took me a couple of weeks. Had I done all that in Gradle, I could have just thrown in a few lines of groovy and probably finished in a day.
That said, it's stable and well known. Gradle seems to have the momentum and increasing mindshare, but you probably won't get fired for using maven.
XML based Build Tool, I mean seriously? It should at least be somehow human readable.
A language should need a sane integration of it, not the library itself. Okai DI is definitly somewhat that isn't needed, but a good integration is still suitable.
I mean good Multithreading lives in RxKotlin which is based on RxJava, however I still think that Threading or some kind of Library which should handle mutli prozessors / async capabilities should live INSIDE the language (like go, erlang or lots of others).
I mean currently Java9 will get a lot of new things which will definitely help out Scala to compile faster and Java10 will bring these closer. So there is no real reason for a language that still lacks a lot of stuff. As already said, Kotlin is small, on some edges thats good, on some it's just too small and I don't get it why they built while, break and continue into a somewhat functional language. Especially when while, break and continue is really hard to handle / read.
I really dislike it. Couldn't it at very least have a space between keyword and label?
Given the candidates at the time, it was decided to start Kotlin.
... and when you went to the Scala developers, they said "no, we aren't interested in such improvements at all, even if you implemented them yourself"?
Hard to imagine...
Or maybe Java just was the best alternative [at the time].
Color me skeptical.
http://blog.jetbrains.com/kotlin/2011/08/why-jetbrains-needs...
The nice thing about that post is that they (Jetbrains) are pretty honest about the whole things e.g.
"First and foremost, it’s about our own productivity."
"The next thing is also fairly straightforward: we expect Kotlin to drive the sales of IntelliJ IDEA. "
"The final point is less obvious but still important: new programming languages is a topic that many people really enjoy talking about, and the first days that have passed since we’ve unveiled Kotlin prove that."
"And we’d like to reiterate that our work on Kotlin does not in any way affect our investment into other development tools, and in particular the Scala plugin. If you’re already happy with Scala and have no need for another new language, we’ll continue to do our best providing you with first-class Scala development tooling."
The problems I had with Kotlin are minimal. When converting a Java file to Kotlin, I got ClassNameException (I might not remember the name correctly), but you just need to clean and rebuild the project. Lack of support for multiple constructors of a class made me scratch my head, but they added this support in a recent version. Overall Kotlin is a better Java (in less radical ways than Scala). The reason it's feasible for Android is that its size is comparable to small libraries like Retrofit, while Scala is huge and building Android apps together with sbt has been a nightmare for many who tried.
The adoption issue is a chicken and egg problem: long-term viability depends on people adopting it, and people want to adopt tools reliable in the long-term. So just do it. Java sucks anyway, I would do anything not to write it.
While other languages promise a huge productivity boost (though few deliver) at a high switching cost, using Kotlin is practically free. It interoperates with Java so smoothly that you can gradually transition by freely mixing Java and Kotlin files in the same package. Calling and passing objects from Kotlin to Java and vice-versa is nearly seamless.
IDE support is world-class, and Kotlin is the only language other than Java (AFAIK) that lets you use annotation processors, so you can make use of, say, Dagger's compile time verification of dependencies.
My favorite feature is smart casting. Inline functions are a poor-man's macros: powerful enough for many things, yet not too clever to be potentially confusing.
The only concerns are with adoption rates, and whether the evolutionary progress justifies a new language. I think that the extremely low switching costs make it at the very least worth a try. Why not start with a mixed Java/Kotlin project?
To be honest, I love it. Here's a comment I wrote a few days ago about my experience with it for Android development, from the perspective of someone coming from java:
"Seconding Kotlin coming from Java. It takes maybe 2 days to learn everything in the language if you already know Java, and it fixes pretty much all the warts that bother me about Java (the big ones for me are immutable references by default, first-class/higher-order functions, and unnullable-by-default references. Type inference and string interpolations are handy as well). It also has a small enough runtime/stdlib (unlike Scala or Clojure, which I've also tried) to make it practical to use in environments where startup time matters, specifically Android."
Compared to Scala, Kotlin is definitely less powerful. But there are three things that concern me about Scala: (1) really long compile times (2) a big runtime (problematic for Android development, although less of an issue on the server) and (3) a "the good parts" syndrome -- that is there are parts of the Scala standard library/common practices that everyone seems to agree are best to avoid. If Kotlin weren't around I think I would look to Scala as my go-to JVM language despite these issues, but given that Kotlin exists and gives me nearly all of the sugar I'd like from Scala without the pain, I'd rather develop in Kotlin.
I'm not particularly worried about the community size, although it would be wonderful if the language picked up steam. JetBrains has demonstrated a big long-term commitment to continued development, it's open source, and the Java interop is so seamless that the library ecosystem is a non-issue -- you can use code written in Java without even knowing the difference. And as dodyg says in another comment, the language is really small if you're coming from Java or C#, so there's not a lot of room for undefined or confusing behavior -- it's true that there really ought to be more documentation, but given how similar it is to other languages it should be pretty simple to translate code/examples from Java to Kotlin (IntelliJ even comes with an automatic Java -> Kotlin translator that just works).
https://www.reddit.com/r/androiddev/comments/3egzq5/so_has_g...
For me the language looks nice as alternative to Java 6 on Android (or 7 when targeting 4.4 onwards), but those break@label, continue@label, .... put me off.
[1] https://medium.com/@octskyward/why-kotlin-is-my-next-program...
This is a bit of a double edged sword for alternative JVM languages since on the one hand JVM improvements (like current SAMs and value types in Java 10) are a big win for all involved, but on the other, Java's evolution is very much a threat to Scala, Kotlin, and Ceylon in particular*
Why is Java's evolution a threat? As Java cherry picks functional idioms from, for example, Scala, the motivation for Java teams to pick up Scala is reduced. Arguably Kotlin is in a worse position as its main "problem" is being too similar to Java. Already Java has deprecated the `_` character so shouldn't be any surprise to see `roster.stream().filter(_.getGender() == Person.Sex.MALE)`, land in the language [1]...getting pretty Scala-like o_O
Kotlin's window of opportunity is in the next 2-3 years, basically before Java 10 lands. If an ecosystem develops around it (likely one of the reasons adoption rates are so low at present) and their 1.0 comes on the scene soon, they can steal some limelight from Scala, and maybe put Ceylon in the rear view mirror.
* Clojure and JRuby are probably safe given their non-Java roots, and Groovy, not sure where it would be without Gradle.
[1] https://docs.oracle.com/javase/tutorial/collections/streams/
Looks like you're right [1], see Goetz's comment in linked thread. Though that was 2 years ago, the language landscape has changed (notably Swift's arrival and M$ setting up shop on *nix) so Oracle may be a bit more willing to pull the trigger on some easy syntactic sugar to give Java the impression of being somewhat up-to-date with current languages. Underscore is earmarked for something regardless, we'll see..
[1] http://mail.openjdk.java.net/pipermail/lambda-dev/2013-Augus...
Their roadmap is pretty clear for the coming years, and it's all things like value types, better arrays, better APIs, modularity, performance, better ways to do "unsafe" stuff, etc. The only major change to the Java language they seem to be exploring right now is improved generics/class specialisation, and only because that's needed for the value types project.
Kotlin has basic things like real properties, which Java still lacks after two decades. Along with many other features.
The big competitors for Kotlin are Scala and Ceylon.
Absolutely. Oracle's strategy is very simple: Java should serve as the assembly language for the server side. The JVM should be the de-facto runtime. Like pron suggests, they are actively encouraging alternative JVM languages and I wouldn't be surprised if they invest in the JRuby/Jython implementations for quicker adoption.
As someone watching from the side, Oracle's strategy is brilliant.
They take a different view to the comparison, looking at things the language enforces more than features/syntax it permits. Of course backward compatibility and plain sanity stop Java making such enforcements so the argument is that the functional languages maintain some strong advantages.
Kotlin has some FP features. You can easily make immutable data classes (one line definitions of struct like things), you have map/filter/reduce/etc with a much more efficient approach than Java 8's streams framework, the compiler knows about tail recursion, there's some basic forms of pattern matching.
I suspect Kotlin will take a breather from new features for a while now to try and stabilise what they've got. But after that, I imagine a few more FP features might materialise.
Gradle's bound to open up its build configuration as an API that any scripting language can use soon enough, so not sure where Groovy will be then as Android Studio ships Gradle with another default build language like JRuby, Jython, or even Clojure.
We wanted to iterate on a lot of the software structure we came up with for our Swift iOS app, and for a bunch of pieces we needed a powerful type system. So rather than just stick with Java -- as others have said, it's way too verbose, we started looking at alternatives. We wanted a strong type system. Scala has too much overhead for Android. Kotlin really stood out for us. This document by Jake Wharton at Square https://docs.google.com/document/d/1ReS3ep-hjxWA8kZi0YqDbEhC... made the decision easier. So we took the risk.
And we love it!
The best features:
Null type safety!
Lambdas can be inlined! No need to be afraid of anonymous inner class overhead on the map/filter/fold of iterables.
Reified generics!
Extension functions!
Single-method interfaces/classes can be represented as lambdas! aka
view.setOnClickListener(new View.OnClickListener() {
@Override public void onClick(View v) { /* do something */ }
});
becomes view.setOnClickListener { /* do something */ }
This is great for things like RxJava.Speaking of which, the Java interoperability is fantastic. Any Android libraries we've tried work great from Kotlin.
Using these tools, we've built a simple dependency injection framework, a handful of really useful extensions on things like T? (for example monadic bind), a hack for algebraic data types and pattern matching, and of course a fairly complex app.
Android Studio's Kotlin support is fantastic (good job JetBrains!) -- it's a pleasure to use.
I think Kotlin is totally worth using. The biggest issue for us is the build time. Our build takes anywhere from 1.5 to 6 minutes depending on how much you've changed, but I've found that the type system is strong enough that you don't have to do too many build-change a line-rebuild cycles.
We'll be starting a blog soon to talk about some of the stuff we've been doing, but if you can't wait send me a message bkase at highlig.ht if you're interested in hearing more (I love talking about this stuff)
I'm sorry that I didn't make it clearer in my post (I'll edit it), but the thing I really appreciate is that I can use functional methods on objects (like map, fold, filter on iterables or our monadic bind method on optionals) and pass lambdas because I know it will be inlined. The inlining -- which should always happen this particular scenario (please correct me if I'm wrong) -- makes using these methods super cheap!
> Lambdas can be inlined!
Kotlin's inline functions are meant to serve as a poor man's macro system (to implement simple control structures) and/or for argument type specialization -- not to save the "inner class overhead" because, guess what? There isn't one! While HotSpot's JIT will certainly not inline lambdas in every circumstance (though it's getting better), it will inline them in all cases where Kotlin's inline functions can be used (and many others where they can't). It is possible, however, that inner classes do have some overhead on Android.
> Reified generics!
Kotlin does not reify generics, and like in Java, that's a good thing! Java's erased generics are precisely what makes polyglot interop easy.
Again I wasn't being very clear, sorry about that: Kotlin doesn't always reify generics, but it can for functions you mark as inline if you want (it's useful!). Check out the inline function docs!
Also, there are few compilers anywhere with optimizations as powerful as HotSpot :) And HotSpot compilation is only getting better and better. Java 9 will even let us use Graal as the optimizing compiler (i.e. instead of C2), which can do this: https://twitter.com/ChrisGSeaton/status/619885182104043520
I use Kotlin for non-Android projects with Maven, so incremental compilation works. Build times are not a significant issue, though the Kotlin compiler is still not as fast as the Java compiler is. I noticed from doing hotswaps when debugging processes that Kotlin seems to still compile too much, even when in incremental model. So I hope once JetBrains get stability under control they can spend some time optimising.
Kotlin worked well - clear concise code, no null worries and no cast worries.
It is peculiarly refreshing to know that my code won't even compile if I try to call a method on null and that Intellij will underline the code in red and suggest a fix.
At the time I was using it I would say the quality of some of the code in the Kotlin API was questionable - specifically the jdbc code. I used the parts that seemed sensible and wrote additional code to provide the functionality I needed. I don't think that code is even in the standard API anymore.
Hope first priority was to replace the Groovy rather than the Java.
Kotlin certain ly made life easier in some places, most importantly it was fast and easy and a joy to work with.
I write some parts of Telegram app in Kotlin. Pretty good after plain java. I can't rely on it in production yet (used in build chain).
My feelings that React Native + Kotlin could be awesome combination.
Source?
For google Kotlin can be very good language: it designed to compile to javascript, so you can write code for Android and Web in one language.
Also JetBrains developing (not a surprise) Android Studio for Google. JetBrains is most qualified company for building Java-based language.
A couple of months ago I used Kotlin to setup a Dropwizard project and it was a breeze so I put together an example on GitHub to serve as a starting point for others: https://github.com/doomspork/kotlin-dropwizard
Everyone and their cousin can create a language, but without tooling then one is back to authoring in "dumb" editors and I will never ever tolerate that on a team again.
I literally spent may be 5 minutes reading their site. The language is extremely small and intuitive to pick up, if you had some experience with Scala.
IDE worked fine. I had few exceptions, but they didn't ruined anything. Refactorings worked. IDE support is very nice.
I have zero Java knowledge so I wonder if it is feasible to jump straight into using Kotlin or to try and learn some Java first?
It's only on version 0.12.213. Bit premature to judge long term viability imho.
Overall I think it is a really interesting language for Android (and I guess Java) developers. It's much cleaner and safer. I recommend at least taking some time to play with it and see how it looks. I also have some simple articles at my blog, antonioleiva.com, very basic and perfect to start with it.
I work in an 8 engineers Android team, switching to Kotlin for our Android app is not on the table at all though. Our huge codebase and complex build script can't be easily retuned to another language, even one compatible with Java and it is an added liability we don't want to deal with. If Google were to adopt it, it could very quickly gain steam for Android development.
- Argued with the developers, they have not clue about Option/Maybe and what it's good for. They offer non-nullable type which solves just one - minor - problem with Null
- No deconstruction
- Their documentation in the beginning mixed features and planned features without discrimination. Spend a lot of time to find out trying to make them work that the features they've described in detail were fantasies.
- With deconstruction I would give it a try in a project.
Since Kotlin can leverage JVM libraries, why not use Google Gauva? https://code.google.com/p/guava-libraries/wiki/UsingAndAvoid...
I personally would listen instead of attacking me.
Kotlin has deconstruction:
val (a,b,c) = myDataObject
Their documentation did indeed commit this sin when I first started using Kotlin last year. It's been cleaned up considerably and this is no longer an issue (except, I think, for the mysterious modules which appear to be an IDE specific concept).2. Sorry, wording is vaque, often deconstruction is
val MyValueObject(a,b,c) = myObject
Option/Maybe solves the problem of things either being there or not (from databases, domain modelling, ...). As a side effect this solves NPEs.
Non-Nullable Types is there to solve (accessing non initialized variables) NPEs.
The Kotlin type system does help though/is essential to correctly implement Option types where other languages like C# can not.
The essential part is you can/should define an Option type with a non-null upper bound. Otherwise you would have a Some() that still might contain a null value. So the side affect of solving NPEs you speak of is only there if a language actually supports non-null upper bounds.
If you allow null as a return type you need to check for null if you want to use it or not. If you return Option[_] people e.g. just use map() on the return value and then map().map().map().map() on that etc. With Option your code usually does not care to check until the very last moment. Sorry my English is not good enough to make the point :-( And I know, saying "You need to use Option (and Applictives etc.) some years to grok" sounds arrogant and unsatisfactory. But I would not go back to a language without Option (and Applicatives etc.) usage in it's culture.
It made things simpler to write, develop and maintain.
One big downside, as of 0.12.1218, is that builds on Android are quite slow (I got 5min builds). But the Kotlin team is aware of the issue and working on it.
Once the kotlin builds on Android get fast enough, it will blow everything else out of the water.
If Google were to switch from Java to Kotlin for android, I wonder how Oracle would feel...
Kotlin seems to have a killer feature which is Android development, which is of course good. But what about internal enterprise development? It makes me think whether Kotlin has enough added value to make people change from a safe haven like Java8 to Kotlin. Sure, much better build times and less problems with code readability when using Akka, Play, Spark with Kotlin instead of Scala. Also Kotlin offers much more power in exploiting the features of those tools compared to Java. But how many people use Akka or Spark? Nevertheless, I wish Kotlin all the best. I will always greatly prefer it over Java or Scala.
There are still a couple of issues though:
- Debugger functionality in IDEA (maybe it's been fixed now?). It was pretty unusable last I tried.
- (Android-specific) When extending Android framework classes you don't gain much benefit, since you'll be using the !! operator (override null-safety) a lot, and you'll be somewhat forced into a design pattern that takes away a lot of the power Kotlin offers.
If I were to use Kotlin, I'd use it for helper classes and extend View classes, etc. in plain old Java.
But Scala is much, much more powerful than Kotlin. Just look at Scala Traits for example. I think, if you have good developers who are willing to learn and to improve, you can get more out of Scala. If you're not that lucky (and I think that is the usual case), you maybe better off with Kotlin.
I admit to a little bias: I've tried to get into Scala several times, but the bad documentation and often overly complex approach puts me off. A lot of Scala features seem like workarounds for other features sometimes. For instance value types in Scala have so many restrictions that they are barely value types at all (e.g. they can have only one member!) and so their primary use case appears to be implementing overhead free extension methods. But Kotlin supports extension methods directly. So whilst implicits+value types may appear to be two features that Kotlin lacks, when you boil it down, it turns out that it has simpler and faster approaches to the same thing.
That said, real value classes (with JVM support) will be good when they arrive.
Oracle would probably never have started to experiment with value types and specialized generics, if Scala didn't take the plunge and implemented, tested and shipped it years ago already.
Of course there are restrictions... but the choice was basically either never getting value types and generics, or accepting some restrictions until Scala drags Java into the 1990ies.
It's the same with extension methods. If the only thing you ever knew where extension methods, they would look pretty exciting. But after being aware of the full range of approaches, extension methods are "meh" ... they only implement the least useful part of implicits.
If I had to decide between extension methods and nothing, I'd pick nothing. Extension methods are just not pulling their weight.
Scala does a lot of things in a certain way, because the have > 10 years of experience experimenting with various approaches.
I suggest that you try to understand _why_ Scala does things this way, instead of assuming Scala devs are stupid. It's pretty likely that everything Kotlin does has been considered by Scala developers 5 years ago already–and discarded because better designs were discovered.
Value types are useful to enforce certain types which helps to avoid million dollar mistakes like the NASA made when mixing inch and meter as simple floating point numbers.
All in all I think, that Kotlin is a good example of the 80:20 rule. You get the most useful concepts and convenience with a low investment. Maybe Kotlin hits a sweet spot in the JVM landscape.
And since Kotlin also compiles to JS, we're writing our REST api client in it so that our Android app and web product can somewhat share the same codebase.
I think Kotlin can potentially go mainstream
For Android development, it is even sweeter, who likes keep using `findViewById()`. Kotlin-Android-Extension does that automagically.
I even write my own HTTP lib for Android entirely in Kotlin. If you like to check it out, here it is (https://github.com/kittinunf/Fuel)
I downloaded Intellij IDEA Community Edition, and with Java 7 already installed on my machine (OS X 10.10 - I use Java for RubyMine support), I went through the tutorial here: Getting Started with IntelliJ IDEA - http://kotlinlang.org/docs/tutorials/getting-started.html
I started at about 12:55 (download time in Firefox d/l mgr says Intellij d/l completed at 12:58). It's currently 2:13. So ~1h 20m later.
Some notes:
- First thing I did was install IDEA and then install the Kotlin plugin in IDEA.
- Next was creating my first project.
- Had to let IDEA know that I have a JDK when creating the project. Took me some time to understand. Once I added this I was able to create a Java project.
- The tutorial references creating a Java Module but I didn't know what that meant (still don't really, just know that I had to pick Java from the lefthand-side of the New Project window, and nowhere on my screen is Java Module mentioned). I checked off Kotlin in the Additional Libraries and Frameworks box and off I went.
- Also in creating a project, I get an error message that the library I'm specifying doesn't exist, but this doesn't seem to break anything so I ignore it.
- Every time I open a project in Intellij I get an error message: "IDE Internal Error occurred. Click to see details and submit a bug report." I click to see the details but the error message just disappears and it seems like there's no actual error at this point, stuff just continues to work.
- screenshots are out of date or else different for Community Edition. The wizard doesn't have the "Create Kotlin Library" popups, but some balloons pop up on the top righthand-side and allow me to do the same thing, I think, copying some jars into my project's `lib` directory.
- personally I find it slightly confusing that the tutorial asks for the file to be named `app` (as in `app.kt`), and would have preferred if it was called `hello.kt`, but maybe this is some kind of Kotlin convention, so I went with it.
- having created the project and the `app` Kotlin source code file, creating the Hello World program was easy and ran as shown in the tutorial.
- I did one bit of cleanup in here: I accidentally named my module folder "HellowWorld" instead of "HelloWorld" (though I think the tutorial screenshots reference plain-old "kotlin") and I poked around in IDEA for a few minutes trying to rename it. I couldn't see how, without possibly screwing things up or having to change a few path names. Being worried I'd miss some, I closed the project and renamed the directory in Terminal, and was able to open it up successfully again in IDEA.
So now I was finished the Getting Started with IntelliJ IDEA tutorial. I decided to proceed but it was a little bit unclear where I was supposed to go. I would have liked to see a suggested next page link on the bottom of the tutorial, but after clicking around I ended up on the Kotlin Koans page - http://kotlinlang.org/docs/tutorials/koans.html .
So I followed the Koan tutorial and it asked me to do a git clone of the Koan repo. I did that and opened the directory as a project in IDEA. `ls -l` shows me that the modified time on the koans dir is `25 Jul 01:21`. I believe that's actually the creation time (which is what I want, anyway, so you can see how my progress is going) since I have been modifying stuff up to the point that I wrote this post. (It's now 2:33, btw.)
The basic concept of the Koan tutorial is that a bunch of pre-written tests fail and you have to make them pass, one by one.
- I was able to run the tests and I find it a bit confusing where I can accidentally switch between running a single test or a whole test file, but I guess that's my inexperience with IDEA showing.
- the git repo dir is named `workshop-jb` -- I don't know what this means, but I'd prefer it to be named `koans`
- I've finished up-to-and-including `_4_String_Templates` so far, i.e. 4 directories worth of tests.
- I haven't yet referenced the `resolutions` branch of the repo, which the tutorial page tells me contains solutions to making all the tests pass. I figured I'd learn more by solving them on my own first. Maybe at some point I'll go back and take a look at the reference solutions.
- Running the tests and seeing them fail prints out some help messages about how to make the tests pass. I have found it a little bit confusing navigating back and forth between the reference code they show you at the top of the Koan file that the test executes, the example Java code they sometimes tell you to reference/convert to Kotlin, and the test. In the first, second, and third case, I found the reference code to be confusing -- I couldn't quite tell how it was supposed to help me pass the tests. In all four cases I found making the tests pass to actually end up being quite simple, but I was intimidated by the blob of reference code at the top of the `.kt` file and wasn't always sure what exactly I was to take away from it. I think it is definitely possible to trim these reference bits down and make them very specifically relevant to fixing the tests. I think they are trying to introduce a lot of features of the language at the same time as giving you what you need to pass the tests, and I find it a bit overwhelming.
- I've made a few attempts to read through the Reference documentation (http://kotlinlang.org/docs/reference/) and it looks interesting, but ultimately I don't think it helped me to make the test pass at all. I am not sure when/where I'd use it, but it did help me understand one of the labelled break/return comments that is posted somewhere in this comment thread. (Personally, I think that's a cool feature. I first encountered it in uC++ - http://plg.uwaterloo.ca/usystem/uC++.html .)
- Last thought: build times are IMO quite slow. I'm changing exactly one short file and it takes several seconds to run the new code, most of the IDEA status seeming to be in the "make" step of the process.
Ok, I guess those are my full thoughts for now, I am sorry if this brain dump was too long but I figured someone might get some benefit out of it. For reference, I've been programming for ~20 years now and I was only able to really get started when I first read one of my all-time favorite programming books, C for Dummies :) I was a DOS-fluent 13-year old at the time, and I'd tried reading some others and found them impenetrable. I think the ease of reading and trying shit out and the humor that I found in that book shaped my tastes for learning considerably, and while I don't think every programming tutorial has to be as gentle an introduction as that book was, I think it has a lot to be learned from in terms of programming writing. It's now 2:46. I am tired and going to bed!
Then there's the warning about unregistered VCS roots. I confess that rather than looking into the meaning of this warning and trying to fix it, I just uninstall the VCS plugin (git in my case) and do revision control outside of IDEA (TortoiseGit).