<p>I've been using Kotlin for two years now on an introductory course on imperative programming (bachelor's first semester) and I'm very happy with this decision. Before Kotlin, I was using Java for the same course.</p>

<p>Here are some of the benefits:</p>

<ul>
<li>No need to explain what are classes on a imperative programming course, since Kotlin programs can only have a main() top level function (like C)</li>
<li>It is a "safe" language in the sense that it prevents most novice mistakes at compilation time (uninitialised variables, type conversion errors, etc.) </li>
<li>For simple interactive programs (e.g., ask two numbers and compute their sum), you don't need all the complexity of the <code>Scanner</code>/<code>BufferedReader</code> classes, just use <code>readLine()</code> and <code>println()</code> (without the <code>System.out</code>). This makes the initial learning curve much more pleasant.</li>
<li>It forces the students to think about the little things that are essential when you are taking the first steps in programming: mutable vs immutable variables, nullable vs non nullable types, mandatory variable initialisation, implicit vs explicit types, conditions as expressions, etc...</li>
<li>It is easy to jump to Java in later courses (than say Python or Javascript)</li>
</ul>

<p>Most of all, from my experience students find it more motivating to learn to program in Kotlin than Java, since they have to write less to accomplish the same things while at the same time feeling protected about runtime errors.</p>

<p>My advice: go for Kotlin.</p>

CC BY-SA 4.0
2018-12-06T19:56:58.877Z
2019-02-13T16:33:31.280Z
2019-02-13T16:33:31.280Z
alves
<p>My preferred curriculum is to teach relatively few languages explicitly, but require others in projects, even large projects. Then draw it together in a <em>principles</em> course. </p>

<p>Most students in the US come to a CS program knowing some imperative programming, even if they think of it otherwise. But their background is usually very weak and they don't write effective or maintainable programs. They write too few, too large functions, for example with deeply nested logic structures that are hard to unpack. They need to be taught how to write differently. It can be a struggle for many to not just build deeper and deeper logic structures, with lots of badly named flags, etc., hacking a more or less workable solution. </p>

<p>So, in my view, the curriculum, as it relates to programming, focuses on abstraction and how to use it effectively in the different programming paradigms. </p>

<p>Ideally, three languages are sufficient to cover (most of) the ground. A low level language in which you can write things that need to be close to the machine. An object-oriented program in which you can discuss the various kinds of abstraction and encapsulation. A functional language in which you can discuss higher level constructs (first class functions, etc). If that is followed by a <em>language principles</em> course in which you can take a meta level view of the language paradigms, it should be possible, in theory, for a student to learn any new language (until a new paradigm comes along). Paradigms are, by their nature, hard. The principles course can dip a toe into several languages other than the ones the students know, just to give them the flavor of the range of possibilities. This is separate from any compiler course, though. </p>

<p>My preferred method is to start with the OO paradigm as it is sort of mid-way between imperative and functional. I don't start with low level constructs (int, float, if, while) however, but with OO features programmed in a prepared simulation that allows Turing Complete programming without any of the low level detail. The "primitives" of the simulation are much higher level, constructed objects with well defined behavior. From that base you can introduce both higher and lower level ideas. </p>

<p>The German system, however, has much more opportunity to do various things as there are more courses in the curriculum. </p>

<p>However, actually <em>teaching</em> both Python and Java seems to be a waste of resources to me. Teach one and in another course, do a project in the other. The ideas are nearly the same and the differences can be learned by osmosis. </p>

<p>I don't know Kotlin, actually, but brief examination suggests that its benefit is in concurrency. That is actually a different paradigm, of course, to the "big three". But if they know Java or Python, a project based course focusing on concurrent programming in Kotlin might be feasible, with relatively little emphasis on the other features of the language. I wonder a bit if the language is stable enough currently to make it a fundamental part of a curriculum. Hence a project rather than a full course. </p>

CC BY-SA 4.0
2018-12-06T20:02:05.807Z
Kotlin advantages go much further than concurrency - see this post for some examples: https://hashnode.com/post/why-i-abandoned-java-in-favour-of-kotlin-ciuzhmecf09khdc530m1ghu6d
alves
CC BY-SA 4.0
2018-11-19T18:21:00.723Z
2018-11-19T18:21:00.723Z
Buffy
<p>We are teaching an "introduction to cs" course (bachelor level) and in the first half of a year students are learning the fundamental principles of procedural languages. We are using python 3 and C as exemplary languages for this part. </p>

<p>Up until now, I moved on to C++ and the object oriented part of python 3 in the second half of the year to demonstrate object oriented languages. </p>

<p>Java is currently tought in the third semester.</p>

<p>All three languages will be needed by the students later on, so the pros and cons of C, C++ and python 3 are not part of the question...</p>

<p>Now we decided to start introducing Java one semester earlier instead of C++. </p>

<p>While we were discussion the course design I joked "why don't we just skip Java and move to Kotlin", and since I had this idea I'm really considering it. </p>

<p>Do you already have experiences with Kotlin in teaching? Would you consider replacing Java entirely by Kotlin? Or would you just mention its existence?
Any pros and cons? How about GUI design etc. (I used qt in the old course)?</p>

<p>Our students might develop smartphone apps as well as webservices in those languages. </p>

CC BY-SA 4.0
2018-11-16T00:27:56.443Z
I wonder, actually, if lots of languages is a good thing to do. As opposed to diving deeply into problem solving in a smaller set. Especially if students never really get to understand any of the paradigms on which those language are based. I think it can become just a syntax jumble, rather than anything deeper. If they have Python, for example, then why Java at all?
Buffy
CC BY-SA 4.0
2018-11-16T10:27:59.973Z
@Buffy our education is very applied and we try to teach the relevant programming languages for our domains. Since many students will working with Java later on, they like to learn the languages they are confronted with in their later business fields (which was one reason for C (embedded programming) as well). My personal favourite is Python 3 as well ;-).
OBu
CC BY-SA 4.0
2018-11-19T12:45:05.650Z
To be honest, I'm having trouble understanding the context here. What level of education is this? Secondary? Undergraduate? You say it is very applied. Is this a traditional program at some level or specialized training rather than degree focused?  What happens to your graduates, generally? I think more context might make it possible to give advice.
Buffy
CC BY-SA 4.0
2018-11-19T14:27:37.633Z
Yes, I realize you said bachelor level, but is it an actual baccalaureate? Sorry that I don't understand the educational system in Germany very well.
Buffy
CC BY-SA 4.0
2018-11-19T14:49:23.327Z
@Buffy The German bachelor starts after 12 or 13 years of school. It takes (usually) 7 semester, and afterwards you can do a matter of science (3 semester) which is the entry qualification for a PhD. Many people leave after the bachelor of science to work in industry, in our case maybe as programmer, consultant, product manager, ...
OBu
CC BY-SA 4.0
2018-11-19T14:54:09.517Z
And is it entirely focused on one subject, or a generalist education? In the US a CS student studies lots of things other than CS such as history, language, etc. Only about a third of the program is actually CS focused. I think it may be different with you.
Buffy
CC BY-SA 4.0
2018-11-19T15:01:03.567Z
Here, an undergrad might take ten courses in a year, four of which might be CS. In the last year, maybe a bit more. But no single term will consist of just CS. The "major" is usually about 15-18 term length courses out of about 40. Some places count differently, but it amounts to about the same.
Buffy
CC BY-SA 4.0
2018-11-19T15:08:25.837Z
yes, it's totally different! It's about 70-80% CS (including math, formal languages, ...) and 20-30% application domain specific, but still with CS in mind (e.g. embedded programming, quality systems applied to software engineering, scientific writing). We assume (partially wrongly ;-) ) that things like history, languages etc are fully covered at school.
OBu
<java><programming><kotlin>
Java or Kotlin for beginners (procedural programming knowledge is existing)?
# Java or Kotlin for beginners (procedural programming knowledge is existing)?

(Asked by: username_0 on 2018-11-15)

We are teaching an "introduction to cs" course (bachelor level) and in the first half of a year students are learning the fundamental principles of procedural languages. We are using python 3 and C as exemplary languages for this part.

Up until now, I moved on to C++ and the object oriented part of python 3 in the second half of the year to demonstrate object oriented languages.

Java is currently tought in the third semester.

All three languages will be needed by the students later on, so the pros and cons of C, C++ and python 3 are not part of the question...

Now we decided to start introducing Java one semester earlier instead of C++.

While we were discussion the course design I joked "why don't we just skip Java and move to Kotlin", and since I had this idea I'm really considering it.

Do you already have experiences with Kotlin in teaching? Would you consider replacing Java entirely by Kotlin? Or would you just mention its existence?
Any pros and cons? How about GUI design etc. (I used qt in the old course)?

Our students might develop smartphone apps as well as webservices in those languages.

**Tags:** java, programming, kotlin

> **Comments:**
> **username_1**: I wonder, actually, if lots of languages is a good thing to do. As opposed to diving deeply into problem solving in a smaller set. Especially if students never really get to understand any of the paradigms on which those language are based. I think it can become just a syntax jumble, rather than anything deeper. If they have Python, for example, then why Java at all?  
> **username_0**: @username_1 our education is very applied and we try to teach the relevant programming languages for our domains. Since many students will working with Java later on, they like to learn the languages they are confronted with in their later business fields (which was one reason for C (embedded programming) as well). My personal favourite is Python 3 as well ;-).  
> **username_1**: To be honest, I'm having trouble understanding the context here. What level of education is this? Secondary? Undergraduate? You say it is very applied. Is this a traditional program at some level or specialized training rather than degree focused?  What happens to your graduates, generally? I think more context might make it possible to give advice.  
> **username_1**: Yes, I realize you said bachelor level, but is it an actual baccalaureate? Sorry that I don't understand the educational system in Germany very well.  
> **username_0**: @username_1 The German bachelor starts after 12 or 13 years of school. It takes (usually) 7 semester, and afterwards you can do a matter of science (3 semester) which is the entry qualification for a PhD. Many people leave after the bachelor of science to work in industry, in our case maybe as programmer, consultant, product manager, ...  
> **username_1**: And is it entirely focused on one subject, or a generalist education? In the US a CS student studies lots of things other than CS such as history, language, etc. Only about a third of the program is actually CS focused. I think it may be different with you.  
> **username_1**: Here, an undergrad might take ten courses in a year, four of which might be CS. In the last year, maybe a bit more. But no single term will consist of just CS. The "major" is usually about 15-18 term length courses out of about 40. Some places count differently, but it amounts to about the same.  
> **username_0**: yes, it's totally different! It's about 70-80% CS (including math, formal languages, ...) and 20-30% application domain specific, but still with CS in mind (e.g. embedded programming, quality systems applied to software engineering, scientific writing). We assume (partially wrongly ;-) ) that things like history, languages etc are fully covered at school.  

---

## 2 answers

### Answer by username_2 on 2018-12-06. Score: 6

I've been using Kotlin for two years now on an introductory course on imperative programming (bachelor's first semester) and I'm very happy with this decision. Before Kotlin, I was using Java for the same course.

Here are some of the benefits:

* No need to explain what are classes on a imperative programming course, since Kotlin programs can only have a main() top level function (like C)
* It is a "safe" language in the sense that it prevents most novice mistakes at compilation time (uninitialised variables, type conversion errors, etc.)
* For simple interactive programs (e.g., ask two numbers and compute their sum), you don't need all the complexity of the `Scanner`/`BufferedReader` classes, just use `readLine()` and `println()` (without the `System.out`). This makes the initial learning curve much more pleasant.
* It forces the students to think about the little things that are essential when you are taking the first steps in programming: mutable vs immutable variables, nullable vs non nullable types, mandatory variable initialisation, implicit vs explicit types, conditions as expressions, etc...
* It is easy to jump to Java in later courses (than say Python or Javascript)

Most of all, from my experience students find it more motivating to learn to program in Kotlin than Java, since they have to write less to accomplish the same things while at the same time feeling protected about runtime errors.

My advice: go for Kotlin.


---

### Answer by username_1 on 2018-11-19. Score: 1

My preferred curriculum is to teach relatively few languages explicitly, but require others in projects, even large projects. Then draw it together in a *principles* course.

Most students in the US come to a CS program knowing some imperative programming, even if they think of it otherwise. But their background is usually very weak and they don't write effective or maintainable programs. They write too few, too large functions, for example with deeply nested logic structures that are hard to unpack. They need to be taught how to write differently. It can be a struggle for many to not just build deeper and deeper logic structures, with lots of badly named flags, etc., hacking a more or less workable solution.

So, in my view, the curriculum, as it relates to programming, focuses on abstraction and how to use it effectively in the different programming paradigms.

Ideally, three languages are sufficient to cover (most of) the ground. A low level language in which you can write things that need to be close to the machine. An object-oriented program in which you can discuss the various kinds of abstraction and encapsulation. A functional language in which you can discuss higher level constructs (first class functions, etc). If that is followed by a *language principles* course in which you can take a meta level view of the language paradigms, it should be possible, in theory, for a student to learn any new language (until a new paradigm comes along). Paradigms are, by their nature, hard. The principles course can dip a toe into several languages other than the ones the students know, just to give them the flavor of the range of possibilities. This is separate from any compiler course, though.

My preferred method is to start with the OO paradigm as it is sort of mid-way between imperative and functional. I don't start with low level constructs (int, float, if, while) however, but with OO features programmed in a prepared simulation that allows Turing Complete programming without any of the low level detail. The "primitives" of the simulation are much higher level, constructed objects with well defined behavior. From that base you can introduce both higher and lower level ideas.

The German system, however, has much more opportunity to do various things as there are more courses in the curriculum.

However, actually *teaching* both Python and Java seems to be a waste of resources to me. Teach one and in another course, do a project in the other. The ideas are nearly the same and the differences can be learned by osmosis.

I don't know Kotlin, actually, but brief examination suggests that its benefit is in concurrency. That is actually a different paradigm, of course, to the "big three". But if they know Java or Python, a project based course focusing on concurrent programming in Kotlin might be feasible, with relatively little emphasis on the other features of the language. I wonder a bit if the language is stable enough currently to make it a fundamental part of a curriculum. Hence a project rather than a full course.

> **Comments:**
> **username_2**: Kotlin advantages go much further than concurrency - see this post for some examples: https://hashnode.com/post/why-i-abandoned-java-in-favour-of-kotlin-ciuzhmecf09khdc530m1ghu6d  

---

