Hacker News new | ask | show | jobs
by atonse 1204 days ago
You can be plenty sloppy in elixir. I’ve seen it.

It’s exactly like older style PHP in the sense that you can build entire apps without having to do any object or data design. It’s all functions, like old style PHP.

Modern PHP of course uses objects and cleaner code liberally.

3 comments

Considering that elixir is a functional language, it makes sense that it doesn't make use of objects. I'll also push back on the idea that OO is cleaner than functional. OO tends to heavily use inheritance and mutates state in obscure and unintentional ways. Functional doesn't have those issues. Though "clean code" is certainly a vague and moving target.
1) You can write bad code in any language.

2) it’s a functional language. There are no objects. PHP doesn’t have guardrails for referential transparency or data immutability. These are first class concerns in a language that ergonomic to do functional programming in. PHP has never had these. It’s completely different and you are comparing apples to oranges.

I just wanted to clarify that I wasn't criticizing elixir or functional languages (we've bet the company on Elixir/LiveView and it's paid off), but I was refuting the idea that it is harder to be sloppy in something like elixir.

My point was, sloppy programmers will be sloppy programmers. And if you are writing old school PHP where everything was a bunch of functions, it's even less of a cognitive shift to go to elixir, and you will write the same kind of sloppy code there too.

There's nothing special about elixir as a language that will prevent you from writing sloppy, unreadable code in the same style of PHP (as with other languages)