Why doesn't Crystal leave the niche? StackOverflow 2022 Survey Result.

In the StackOverflow 2022 survey, the Crystal language did not do well. Why is the language not being widely adopted? Elixir came out in 2012, just two years before Crystal, and is being much more embraced. As I see it, the main problem with the language is object orientation. The academy has already moved away and now the industry is too. The problem isn’t Windows support or parallelism… It’s OOP. Ruby until recently didn’t have decent support for Windows and still doesn’t have strong parallelism. But by the time version 1.0 was released, it embraced what was trending in programming. Nowadays OOP is not well regarded.

Crystal should have been procedural and functional (like Rust); have Ruby-like syntax, but with just one way to do things and be explicit (just like Python).

Automatically translated.

Do you have metrics for this? In the survey results you linked, 5 of the top 7 languages are OOP languages — the other 2 are HTML and SQL.

I’d also caution against asserting anything based on the results of a survey. The folks at StackOverflow may go to great lengths to solicit a broad range of responses, but every survey contains some amount of selection bias and this one is no exception.

For example, in the database portion of that survey, Oracle is in 9th place, but DB-Engines lists it as the most popular database in the world. Similarly, the SO survey shows Postgres above MySQL (for professional devs specifically) but DB-Engines shows MySQL being used 2x as often. I’m not saying DB-Engines is right and SO is wrong, but since they show such radically different results I wouldn’t trust either of them on their own.

There are other factors to consider here. The functional paradigm is arguably the least interesting and least impactful factor of Elixir’s success. Elixir benefited from its association with a very well known and respected open-source software developer on top of a VM and ecosystem that has existed since the 1980s. The former had an impact on awareness and the latter provided the benefit of accelerating its pace of development and assuring teams adopting it of its production-readiness. Specifically, anything that Elixir didn’t implement yet, you could just use the Erlang equivalent. For several years a lot of apps and libraries did exactly that.

6 Likes

I don’t agree on the presumption that OOP isn’t good anymore. Quite the contrary.
It fits very well with Crystals purpose of being easy to use. Functional programming may be simpler in concept. But in practice, I think it’s often harder to wrap your head around. Especially for novice programmers.
Anyways, it’s a mute point. Crystal is not going to drop object orientation.

Elixir 1.0 was released in 2014. Crystal 1.0 in 2021. That’s a 7 years more of stable releases and community growth.

5 Likes

Don’t worry, it’s just my opinion, no basis whatsoever. I just wanted to know what people thought.

1 Like

As for me the biggest problem of Crystal is poor ecosystem. I can’t use many shards because they are abandoned and unmaintained. So if I want to make something on Crystal, I should keep in mind that I need write all code by myself unlike Ruby where on each case you have several gems. Anyway I like Crystal.

First of all, thanks for bringing this discussion, I think it’s an interesting one to have! Let me add my 2cts to what’s already said.

I agree there’s a growing agreement in academia that OOP is bad, but it’s IMO a misguided criticism. Look at Scala, it merged functional and object-oriented programming nicely (for some definition of nicely :sweat_smile:). The trick is simply to keep small the number of mutable variables.

Let me add something, I love ML-style modules. And to be frank, in my OCaml dev days I only saw one nice use of OCaml’s class system (OCaml is hybrid like Scala). One thing I learned is that modules serve the purpose of code structuring and encapsulation very nicely… if you can get it’s tricky parts right! OOP, on the other hand, is a simpler concept to grasp.

So the real statement is not necessarily OOP considered harmful but the very old saying mutable state considered harmful. Crystal already is pretty ahead in this front, by making list-processing style array functions and stack-based structures. I think there’s room for improvement, for sure, but the discussion should be focused on how to make Crystal more functional, not less OO.

7 Likes

Also notably, Crystal has the Maybe monad baked in:

2 Likes