Kotlin logo


A concise multiplatform language developed by JetBrains


Teaching Introductory Computer Science in Kotlin – Webinar Recording and Q&A

“Always bet on the future. If you’re not willing to, it’s hard to enjoy a life in technology.”

Geoffrey Challen

On November 23, we held a ‘Teaching Introductory Computer Science in Kotlin’ webinar, featuring Geoffrey Challen, Teaching Associate Professor at the University of Illinois at Urbana-Champaign. He is the lead instructor for a course, which is now the largest introductory computer science course to offer Kotlin as a language option, with an impressive 1300 students.

According to Geoffrey, Kotlin is an ideal choice for a first programming language to learn as it maximizes the fun and minimizes the frustration.

In this post, we want to share with you a recap of the questions and answers from the webinar.

Q1: It gets a bit heavy for students to set up an IDE to start with Kotlin. I use Kotlin playground to teach them but is there any syntax highlighting REPL for Kotlin?

A1: A lot of the work that we do for my class is done in the browser. I think IDEs are great and the JetBrains IDEs for Java and for Kotlin are fantastic, as well as Android Studio, which is built on top of the same technology. 

For people that are just getting started, the IDE can get in the way. So we have students work in this very stripped-down playground environment where there is no syntax highlighting. 

In terms of things like auto-completion, I tend to think that students do better starting out without those helpful things and I encourage them to type the code themselves. The problems that we’re having students do for my class on a daily basis are at most 10 or 20 lines of code. Type the code yourself and get used to doing that type of thing without heavy reliance on the IDE. 

I was working with someone the other day and they were trying to set up an empty list and on the right side of the initialization, instead of writing new array lists, they wrote new lists and then they hit “Return”. And of course, the IDE thinks that you want to create a new anonymous implementation of the list class and so it spits out this one-hundred-line-long prototype implementation. And the student has no idea what just went wrong. And it’s just a small mistake that is easy to make. I’ve made it before. 

But I use an IDE all the time, so I certainly don’t want to claim that they’re not useful. They’re tremendously helpful. But I think for people who are just getting started, they’re certainly not required, and besides, I wouldn’t want to use a language that really required an IDE.

It’s interesting with Kotlin because I have seen people say the language really seems to require an IDE. And our experience has been that that’s not the case. Our students are able to write Kotlin code fine in an environment with limited syntax highlighting and no auto-completion. 

Once we start working on Android, we do have them use Android Studio obviously, because there’s no other way to do it. I have always been really impressed with how well it works, and I think it’s just a testament to Android Studio and how good the documentation is. I’ve got 1300 students in my class, and I would say 99% of them are able to set up Android Studio on their machine without any problems. I think the fact that this is a tool that’s used by so many developers just means that the documentation is awesome and the tutorials for getting started are great. 

Q2: ​What’s the knock-on effect for other modules here? E.g. If students in CS1 choose Kotlin, does this force other faculty to allow it for coursework in their modules?

A2: One of the things that gives me a little bit of freedom in my CS1 course is that I don’t have a lot of downstream dependencies. At the University of Illinois, when students start in my class, they take either Java or Kotlin and then they end up grinding through multiple semesters of C++. From the perspective of fun, I have a lot of concerns about that language choice and I’ve been talking about this with my colleagues. There’s not a second-semester course that’s also in Java. I think the next course in the department that’s in Java is actually at the 400 level so it’s multiple years downstream. 

When you think about how curricula work, at some point you want to stop teaching languages. We teach languages for the first couple of years, but once students get to the third year or fourth year of the program, I think they should be expected to take a course and just pick up a new language as they need. 

So I hope that in some of our more advanced courses that use Java – one of those courses actually does do Android Development – I would hope that they would be able to say “Okay fine, we’ll do Kotlin too, why not?” 

Q3: When using Android, how do you handle the balance between spending time on CS fundamentals and/or Android specificities? 

A3: I feel like the concern here might be that students are getting distracted by the fun of Android programming and they’re not learning basic computer science principles that you want them to learn in a CS1 course.

So, first of all, my experience is that we’ve been able to do both. We do a lot of foundational computer science concepts including sorting algorithms and recursion. We actually added some content on graphs this semester for the first time. And students had a lot of fun with it. Then they’re also doing Android programming alongside it. So I think that with a course that’s ambitious enough you can get this to work. I’ve had some people look at my class and say: “You guys are covering a lot!” 

We see very healthy numbers when we look at final grades and when we look at things like drop rates. So it certainly isn’t being done at the expense of the students in the class, particularly the students who come in with no experience. We bring them along but I think there are some intro courses that aren’t quite doing enough. 

We’ve been using Android now for several years in the class. I do think that our Android assignments had gotten a little bit integration-heavy, focused on challenges involving getting two parts of the app to work together properly, as opposed to core CS concepts. 

One of the things we’ve done this semester is we actually have more components of the Android project that students do that are really basic programming tasks and that really do push on core computer science competencies like the ability to use basic data structures and the ability to implement basic algorithms. We have students doing some work where it’s a part of the Android project. We end up using it either in the UI or in some other way. But really it’s almost like a problem that you could take out of Android and assign in a completely different context that just involves things like working with maps, understanding how to traverse a data structure, how to transform a data structure into a slightly different form, etc. 

One of the final steps we are having the student do is essentially graph traversal. It’s in the context of this data set that we’ve given them that they’re using to do other things with the UI. But the core algorithm that we’re having them implement is graph traversal. 

There is an opportunity to have some overlap there, where you’re not showing students how to build an app, you’re also continuing to give them practice with core computer science competencies.

Q4:  I don’t think it’s good to teach Java & Kotlin at the same time. Students who are trying to understand a concept and need to remember two pieces of syntax and will get confused about which is which.

A4: I think there’s a little bit of a misconception underlying that question. Students don’t take the class in both languages. Students choose one language and then a student that chooses Kotlin can take the course and never even see a piece of Java. 

One of the things that’s made this possible is this big restructuring of the course we did during the pandemic. The class is still being taught asynchronously online, so I don’t lecture. I used to be on stage in the largest auditorium on campus three times a week teaching students Java. I don’t do that anymore. 

We took the course and completely redesigned it around this daily lesson model. If you’re a Java student in my class, you wake up, you go to the lessons page, you do the lesson – it’s in Java, you finish the problem – it’s in Java, you show up to take your weekly quiz – it’s in Java, you open up your project – it’s in Java. Some of the students are peeking at the other languages, I’m sure. So if you’re a Java student and you’re done with your lesson and you want to see the same concepts in Kotlin, you can do that. 

Otherwise, if you were trying to do this as part of a more traditional course, I think it would create some problems. If you were teaching a course like this in two languages, I do think that you would choose ones that were more syntactically different.

I think we might be one of the only courses – we’re certainly one of the biggest, highest-profile courses – that’s offering students the option of languages. 

Q5: How does such a large course work? Do you get any one-on-one time with your students?

A5: I don’t necessarily do a lot of that. I spend my time creating the materials, working with my staff, and keeping all of our systems online. We do have – and again this is something we created during the pandemic – a system that is built through the website where students can get one-on-one help from staff. I have a large core staff, about 40 or 50 paid staff members, and then a bunch of students that are doing it for course credit to learn how to be a course assistant. 

Normally pretty much from 9 am to 11 pm we have somebody on our help site. A student who is struggling with that day’s lesson or needs help with the homework or with the Android project can go on the help site and receive assistance from a staff member. From time to time I jump on the help site as a staff member, partly because it’s fun. I enjoy helping students. It also helps me understand how students are doing. I see what people are struggling with. But the students are typically pretty surprised when I end up helping them. 

One of the reasons it works so well is because I think our online materials are already really good. 90% of the students almost never use our help site. That’s great because they’re learning material from the lessons, from our interactive materials. And then it also means that it’s easier to help the other students because the staff-to-student ratio is better. The whole system works really well. I’m pretty proud of it.

The pandemic has been such a difficult event for so many people. I think it’s been difficult to talk about some of the good things that have come out of it. But in the past, if a student needed help, we said, “Oh we have office hours, come to the computer science building, down to the basement, and we’ll help you.” It might take them an hour to go back and forth for five minutes’ worth of help. 

Next semester the plan is to restart some in-person activities, but we’re definitely going to keep this site running, because, for students that have quick questions, it’s awesome.

Q6: Have you considered using the Kotlin EduTools plugin to solve problems in the IDE? 

A6: I’ll admit, I tend to be sort of bad at using other people’s things. I enjoy creating my own stuff. As I was prepping for this, I was looking around and I was like “Oh, you guys do have these amazing resources.” One of the things that’s important for me from the perspective of an educator is being able to generate content. 

The problems that we’ve created for our students are super valuable, but they do take time and energy to create and so does the system that we’ve built to author those problems, maybe we could get it to fit in with the plugin for Kotlin. We could look into it.

Like I said, I’m also not 100% convinced that I want students working in an IDE right away, because I do think there are some pedagogical advantages to having to type the code out yourself, not being able to rely on all the autocomplete and suggestions. 

One of the things that’s at least fun for me as an educator is that you realize how much the experience of working with computers has changed you. The kinds of mistakes that my students have a really hard time seeing, like the difference between a single equals and a double equals. I can see that from 30 feet away because I’ve just been looking at code for too long. 

I think working in a simplified environment helps students instill some of these abilities, and then for doing a real project, use an IDE. I mean, everybody does this. Like I said, I use them all the time. I don’t do any programming outside of it. I try to do as little as possible outside of an IDE environment because I want all those benefits.

But I think there’s a question about how to bootstrap students in a good way that gives them the foundation for success. For me, having them start with the IDE is not always the best thing.

I think IntelliJ IDEA is a fantastic IDE. The other thing to keep in mind too is that these are complex pieces of software. As soon as you open up one of these IDEs, it’s like you’re at the controls of a 747. I think the IntelliJ-based IDEs do a great job of organizing information and trying to simplify stuff, but it’s still a power tool. You don’t take someone who’s trying to learn how to fly a plane and put them in the cockpit of a 747. That’s not where you start. I like just having them understand “Okay there’s a text box on the website that you’re typing into, and that’s all you need to worry about,” as much as I like IDEs for real, more advanced, complicated programming.

Q7: Do you know if some of the students stick with Kotlin after the courses for hobby or even professional settings?

A7: The first course I taught in Kotlin was to a subset of students in Spring 2019. So it’ll take a couple of years to get a sense of how things work as students go through the pipeline. 

One of the things that you learn as an instructor is that there are these really long feedback loops that happen in computer science programs. 

I’ll give an example: When I started teaching the course, I started requiring that students (this was in Java, in spring 2019) follow the Checkstyle guidelines that have to do with things like spacing brace placement. There was a massive amount of howling that went up from the students in the first semester: “Why are you grading me on this? It has nothing to do with correctness.” 

But semester after semester the volume just went down, because students realize that this thing actually paid off downstream. It really helped them in the next courses. 

One of the reasons that we use Checkstyle is as follows: Imagine you’re a staff member on my help site. You’re working with one student for five minutes, another student for five minutes, another student for five minutes – every piece of code looks different, if every one of them has different conventions… 

Indentation is obviously the biggest problem with student code. You can’t read code if it’s not indented properly. If everything looks different, there’s a lot of extra mental overhead for you to just help the student. So one of the nice things about Checkstyle guidelines, which we use now for Kotlin, is that everything looks the same and that really helps the staff. I want the staff to be helping the student with the computational thinking that they’re struggling with.

Ask me in a couple of years right after these students have moved their way deeper into the program, they’ve had a chance to interview for jobs. 

As Kotlin becomes more well established for programming interviews and stuff like that, I think that’ll help. I think right now, though, if you learn Kotlin, you might have a little bit of an advantage for some jobs, if the job wants someone who knows Kotlin. 

You guys have made some great progress at getting Kotlin taught in computer science programs but it’s still far from common. So if you’re going up for an internship and the internship wants somebody with Kotlin experience and you’re that person, you’re not going to have a lot of competition. So hopefully that’ll help, but the long-term impact of this we’ll see. It’s going to be fun to watch.

Q8: How can I gain admission to this university?

A8: The admission to the Computer Science program here is really selective. I think we accept around 10% of applicants at this point. The university does offer a variety of mixed degrees. We have a degree in CS plus Statistics, we have a degree in CS plus Crop Sciences. This is an agricultural university so there’s actually some really cool agricultural tech that’s being built right now that you can see out in the fields around here sometimes.  

Also, if you take one of those programs, you get a fantastic grounding in computer science combined with complementary study in some other field. 

In CS plus Statistics you get all the computer science stuff but then you also get this rigorous training in data analysis. I think that those are the two modern superpowers: how to build things using computer science and then work with data. 

But Illinois is a top-five/top-three school depending on how you rank. It is tough to get in here. I’m not gonna sugarcoat that.

Q9: Is there any specific CS concept that you have found easier to teach students with Kotlin (in comparison to Java)?

A9: What we’ve done so far with Kotlin is that we took a course that was in Java and we’ve run a Kotlin course alongside of it. The results end up being a little bit handicapped by Java. For example, when I’m designing our Android project, I have a solution set that I’m working on and I always work on the Java solution set first, because the Kotlin version is going to be a lot nicer. If you start with Kotlin it’s easy to build something that’s too hard to do in Java. So I always start with Java and then I translate it to Kotlin for the Kotlin solution set. 

There’s a couple of things about Kotlin that I think are super nice. Working with containers in Kotlin: lists, sets, maps – is a massive improvement over Java. You don’t have five imports that you need to do. 

Initialization syntax, bracket syntax is awesome and I talked a little bit about this in my blog post. I have mixed feelings about operator overloading in general, but the ability to support things like bracket syntax for lists and maps is awesome. I think that’s one of the areas where Kotlin has a massive advantage for Intro CS.

If I was teaching the course in Kotlin, I would do more with streams and stream processing, pipeline-type, higher-order programming concepts. 

We do those very very late, and it’s really kind of enrichment at that point. Part of the reason for that is that I don’t think I could write a stream pipeline in Java without an IDE because the syntax is just weird. I want a list and there’s some collectors to lists and I remember how to do it so I just start typing to lists and I hope that the IDE helps me out. Whereas Kotlin syntax for map-reduce-filter type stuff is just awesome.

If we were doing the course in Kotlin and didn’t have Java alongside, we’d probably do more functional programming ideas, more work with higher-order programming, we’d talk a little bit more about things like maps and first-class functions and function wrappers.

It’s stuff you can do in Java, but the syntactic issues start to raise their ugly heads there, so that’s something that we don’t do as much.

But I think if we started with Kotlin and worked that way, there probably are some pretty substantial differences that would arise. 

Q10: Is it possible to deploy your own version of the online learning platform you built, for courses at other places? Is it open-source or did you consider making it open source?

A10: We’re working on this. First of all, if you’re interested in this type of project please let me know. It’s always easiest for me to work on something when I have the knowledge that there’s someone who’s actually excited about using it. 

The current course website was developed very quickly during the pandemic and I was learning a lot of things as I went. So I don’t have any plans to publish it. It also has a lot of other materials in it that I don’t want to share. It has all the quiz contents for my class and I can’t publish those because they have solutions in them. 

If you’re excited about this, I would love to have a class that I maintain with a collaborator. Particularly at another institution, so if someone else said, “Hey, I’d like to teach Kotlin. Let’s work on materials together,” the materials are designed so that anybody can contribute explanations and content. 

So if you were at some other university and I was here and the courses were similar enough in structure, you could record a bunch of your materials, my students could see you explaining stuff, your students could see me explaining stuff – and my staff and everybody else who’s already contributed. That would be pretty cool. I’d be super excited about that. 

In my opinion, there isn’t enough cross-institutional collaboration in this type of way. 

The structure is amenable to this type of collaboration. You can make the course feel like yours; I can still make the course feel like it’s mine. But students get the best of both worlds, where they have more backup content, and more voices. 

That’s the other thing, too, that I’m really passionate about: making the course speak with a more diverse set of voices. I’m hoping that, in a couple of years from now, when students come and take the class, they hear a lot less from me and they hear a lot more from my staff, and a lot more from a diverse set of collaborators.

As always, we’d love to hear from you. Leave your comments here, send us a message about your educational experience to education@kotlinlang.org, or drop us a message in our Kotlinlang Slack #education channel. Thanks!

image description