Hacker News new | ask | show | jobs
by skydhash 396 days ago
So why do we have Java, Kotlin, Scala, Groovy, and Clojure, all targeting the JVM? And many such families?

The only thing that matter to the machine is opcodes and bits, But that's alien to human, so we map it to assembly. Any abstractions higher than that is mostly for reasoning about the code and share that with other people. And in the process we find some very good abstractions which we then embed into programming languages like procedure, namespacing, OOP, patterns matching, structs, traits/protocols,...

All these abstractions are good because they are useful when modeling a problem. The some are so good then it's worth writing a whole VM to get them (lisp homoiconicity, smalltalk's consistent world representation,...)

3 comments

To allow you to write more readable and extensible code, that can solve real problems more effectively. Solving problems is the point of writing code.

Saying that reading code is the point of writing code is crazy, that's like saying the point of writing scripts is to read them, or the point of writing sheet music is to look at it.

No - the point of writing a script is to have it performed as a play, the point of writing music is to hear it and enjoy it. The point of writing code is to run it.

> All these abstractions are good because they are useful when modeling a problem.

Then what do you do after modeling the problem? You solve it! You run the program! Everything is in service to that.

> Solving problems is the point of writing code.

No one does it in isolation. The goal of having a common formal notation is for everyone to share solution unambiguously with each other. We have mathematical notation, choreographic notation, music notation, electric notation,... because when you've created something, you want to share it as best as possible to others. If not, you could just ship the end result and be done with it.

So no the point of writing music is not to hear it and enjoy it. To do so you just find an instrument and perform. You do not to do anything else. But to have someone else to do it, you can rely on their ear, their sights and their memory to pick things up. Or you just use the common notation to exchange the piece of music.

> No one does it in isolation.

Yes, they do. There are plenty of solo developers out there. And plenty of solo musicians who write and perform music.

Because a secondary goal of code is communication with other humans. That means readability is still a highly valuable trait. Just not as valuable as the primary purpose.
They are different ways to communicate with the machine...