Ability to learn Kotlin for 1st Lang

Am I able to learn Kotlin as my 1st programming lang or is it recommended to learn Java or any other programming lang 1st?

1 Like

Yes, you can learn Kotlin as a first language. I would recommend doing that.

1 Like

What method do you think is the best way to learn it (book, online course, etc.)?

Start with Kotlin Docs | Kotlin. Then you can try Kotlin Basics – JetBrains Academy — Learn programming by building your own apps. Then select your own project and start working on it. I do not recommend to start with Android.

1 Like

Hi,
I think java virtual machine would not help you to understand computing.
@darksnake did you start programming langage with java?

I started programming about 1997. There was no Java then. But I’ve been working on Java since 2006-2007 and completely moved to Kotlin in 2018.

I did not understand statement about JVM (and you do not need to work in Java to understand JVM).

1 Like

I think jvm hide memory management and for a beginner it will not really help to understand computing.

Memory management is not a part of modern application-level programming and it is very good. All modern languages feature automatic memory management (it is not only JVM). Memory management is important for systems programming, but it is a very narrow niche.

Memory layouts are sometimes important for high performance computing. But it is not a thing that newbie programmers should focus on. Focusing on performance before you can write a program is a very bad practice that sadly characteristic for old-school programming teachers.

9 Likes

That’s your point of view. But I don’t talk about performance.
For function parameter adress or value I think you need to understand what is memory.
Before an array copy too.

No, you do not. In Kotlin you do not need to think about by address or by value. Because those are not relevant (those terms are applicable in C++ and partially in Rust, but not in other languages). You do not need to work with arrays as well (outside of interop and performance critical parts, you should use List). All those simplifications allow you to focus on things, that are more important. Like architecture, control and data flow design. Performance is also important, but it is important for library authors. It could be learnt later.

Another note. In most cases performance could be fixed without breaking the whole program. Design could not. If you focus on low level details from the start, you will write something that you won’t be able to work with.

6 Likes

And this is exactly why it is better to start with it than e.g. C++.

3 Likes

You can learn programming top down or bottom up.
Bottom up means you would understand almost everything every time.
Assembly language would be the place to start.

However, you could also start building code and move towards more understanding later.
For example, you would not need to start with biology before you start sporting.
But knowing biology, can help you to avoid injuries.

I personally think you could perfectly start in a programming language where you are just talking to the computer. Because hardware is often cheaper than the developers, optimizing for understanding and adaptability is often better then optimizing for hardware.

I think high level languages allow to give more attention to developer-friendly coding, exactly because the low level stuff is hidden. Therefor, I personally think Kotlin is a good language to start with.

2 Likes

@reyfam start with kotlin if you want but don’t start alone

@darksnake
no adress, no value ? not used in another language?

Why array tab_a is modified here?

fun ma_fonction_1(a: IntArray, b:Int): Int {
    a[0] = a[0] + 1    
    return a[0]+b
    }
    
var tab_a: IntArray = intArrayOf(18, 12 , 3)

println("tab_a Array =")
for (v in tab_a)
    print("$v ")
val b = ma_fonction_1(tab_a, 17)
println("\nResult ma_fonction_1 $b")
println("tab_a Array =")
for (v in tab_a)
    print("$v ")

results
tab_a Array =
18 12 3
Result ma_fonction_1 36
tab_a Array =
19 12 3

I don’t understand your point with this example. First you said Kotlin/JVM will hide the memory management and then you provide an example… in Kotlin. So this example is not based on something that is hidden in JVM.

Newcomers have to only understand a function receives an object that can be modified. But they don’t have to understand if it is stored on stack or on heap, who is the owner of this object, who should release it and when, etc. That helps learning, because we can focus more on what our code does and not how it does it. It is the same as using for statement which internally uses goto or Thread.sleep() which internally uses signals or interrupts. We don’t have to know this straight from the beginning.

4 Likes

What you call “modifiable” I call “adress” that’s all. Array values can be changed but not the array (size for example in function or method)

Java was released in May 1995. It was my main professional language from 1997 to 2017 (when I too switched to Kotlin). So you have no excuse :slight_smile:

??

1 Like

You can use a duck or a real person

Thanks

@reyfam
If I was young and start learning programming, I would

  • Try both directions: bottom-up and top-down, each in 1 month to see which direction I prefer. For the top-down approach, Kotlin is a good start, IMO. For bottom-up, maybe choose C++ or Assembly. Assembly is lower programming language and requires more understanding of hardware and memory.
    => So basically, I would not force me to any direction but follow the approach I feel comfortable with. To me, the most important is to keep fun while learning. And if I feel boring with top-down approach, I will switch to bottom-up to have new fun things. I will continue to switch these approaches when I feel it’s good time to try a switch. But if I switch, I will spend enough of time for it to get a big improvement in my head. Don’t switch again and again in a short of time.
  • Find best resources for each direction. I will pay if the resource is much better than free resource when needed (time vs. money).
  • Find a good code reviewer. I will give the reviewer the best version I am able to write then improve it.
  • Start learning basic of DSA while practicing programming
  • Create small application, which works, not just write small functions.
1 Like