by taberiand · 7y ago · 0 comments
SIMPLE appears to be leaning even more towards the functional programming side of things; I think we should probably just get it over with and accept that composition of functions operating on immutable data structures is just the right way to go.
I'd say Kotlin over Clojure.
It’s one of his main points that something like a language being “hard to approach” can be overcome by spending a little effort to learn it (as opposed to sticking with something like Kotlin just because its easy to pick up because it’s familiar). The benefits of learning the unfamiliar (in his case, he’s speaking specifically about Clojure) being that it allows you to write code that is much simpler to reason about.
I have no particular beef with Kotlin (or most any languages... right tool for the job and all), but I have lately become infatuated with Clojure and many of Rich’s viewpoints.
I think, among all the languages being actively used in the industry (in business, not academy), Clojure perhaps can be crowned as the simplest of them all. The ingenious of Rich Hickey was to design it the way that the essentials were made simple and complicated stuff either unnecessary or pushed onto the edges of the ecosystem.
Clojure can be learned à la carte - from the basics to more advanced things. Or if you want to dive straight into more difficult topics, you still can do it, and preliminaries would be minimal.
I can argue that Clojure is easier to learn than Kotlin, Python, Javascript, or Ruby. That is not a mere opinion - I know many people for whom Clojure was the very first language. And they tried to apprehend other PLs later, and it was a confusing and frustrating experience for them.
It is easy to start with Clojure. One simply needs to be less skeptical about things that people (mostly those who are unfamiliar with the language) criticize it for:
- They say, "It is hosted on JVM. JVM means Java, and I hate Java", and therefore ignore the fact that JVM is a very robust piece of tech, and you don't need to write any Java at all to use Clojure, you don't even really need to know Java.
- They say, "JVM has a slow startup time." But once you try Clojure's REPL (which is a real REPL, unlike in other, non-lispy languages), it becomes a non-issue.
- They say, "It is a Lisp, and parentheses look scary." But once you learn structural editing idioms, it becomes so frustrating to deal with all the punctuation in other languages.
- They say, "It is dynamically typed." But once you learn Clojure.Spec you may discover that you can do things with it, that most type-systems simply can't.
I encourage everyone to try to learn some Clojure, because it is fun.
Combine that with multi platform productivity. If you do want to get dorkier there are fully functional libraries.
It’s definitely a feel argument, and thus highly subjective.
Anecdote, not data, but I've found that Rust, Erlang, and F# (if MS stack) tend to be in the sweet spot of expressive enough without drowning in symbols, without being as mushy as, say, Python/Ruby/pick something.
That said, I do not recommend immutable libraries. Here are the reasons:
1. They provide false comfort. Nothing in JS is truly immutable. People are just going to end up breaking the rules (purposely or inadvertently).
2. Boxing and unboxing regular JS objects becomes a pain in the ass and a maintenance horror show. You'll never know what an object is and you'll have to jump through countless hoops to get plain old JS objects to do anything with anyway.
Much better is to educate developers, and make sure code is properly reviewed before merging. Immutability doesn't need to be built into the language. Code customs and practices can go a long way.
Yeah. No. Maybe. The cost of immutability can be high. Immutability can be very elegant when it's right, but mutability can be clearer other times. As another respondent said, there's no silver bullet. There's no 'right way to go'; as ever it depends.
If you analyze expenses for software projects of 1960-80ies and compare them with recent years, you probably see that the most expensive item now is at the bottom. The most costly thing used to be hardware. The not so expensive - developer's time. Now it's the opposite - the equipment is cheap, and the software developer's salary is the most expensive thing. Of course, that does not apply to every single case, but for the majority of projects, that is true.
Immutability by default (baked into the language), offers enormous benefits, and increases programmer's productivity, it simplifies many things, especially concurrency and parallelism. Languages like Erlang and Clojure are good examples. The price you are talking about does matter. But very often, the benefits outweigh the small cost.
I haven't checked the value of eg. for{} in scala vs a mutable/procedural loop, but I wouldn't be surprised if it was an order of magnitude or two different. Figures are needed, and I don't have them (nor the time to benchmark them now, simple though it is).
Functional programming as it exists today takes these ideas to a somewhat extreme form. That has its place and value, but as experience in the real world shows, as long as it feels so mathematical, it isn't everybody's cup of tea. Hopefully, over time we find more intuitively accessible abstractions for the really useful principles that functional programming is based on.
Languages like Elm, Elixir and Clojure don't feel "so mathematical".
It can provide an incremental improvement but it is https://en.wikipedia.org/wiki/No_Silver_Bullet