Hacker News new | ask | show | jobs
by 3dpancake 856 days ago
I am really missing out on the Elixir hype. And Phoenix has liveview, so the htmx hype gets multiplied with the Elixir hype?

This article provides a huge list of things you have to know for web dev. Certainly not all of them a required. And of the ones you will have to know to accomplish your task, you'll still have to learn the Elixir flavor of it.

My current job is rewriting what is basically a crud elixir app in python for a company. I'm not completely sure their reasons wanting it re-written, but they're spending money to do it, so they must have some justification. I have heard them mention difficulty in finding people to work on their existing codebase. A lot of companies they just want fungible (and cheap) programmers (like me).

I've really only bothered to learn enough elixir to reverse engineer the existing app for reference. I have no idea what good elixir looks like, and it could be that this is just bad elixir. Completely subjective, but it's not easy to follow. I had to work through some code where a bunch of functions were piped together, but all these functions were defined multiple times with different args (pattern matching on arguments). It seems like a strange way to do flow control within a pipeline, because the logic seems to really be spread around.

Maybe I have to sit down and write something from scratch to appreciate it.

1 comments

fwiw Python also has pattern matching: https://benhoyt.com/writings/python-pattern-matching/
ruby does too. its not remotely the same
What are you saying isn’t the same? This is a very hostile, dismissive response when I was simply pointing out Python had a similar concept in the hopes it might help the person understand something they said confused them.

As far as I can tell all three languages, Python, Elixir, Ruby, have pattern matching and the matching can set variables. Python’s has a “match” keyword. I’m not as familiar with Ruby, but I know it uses “case”.

I like Elixir’s the best because it’s not just what I would call a fancy switch statement. You can use it on single lines and in function definitions. Someone else might like a different form of pattern matching better. It’s just an opinion.

Pattern matching is fundamental to programming in elixir/Erlang the way go channels are in Go and super clean metaprogramming interfaces are in Ruby or types are in Haskell etc, you can do those things in other languages but when it's fundamental to the design of the language itself it filters down (or up) to every layer, where it significantly impacts how useful/powerful it is.

Elixirs pattern matching is the one thing I wish every language had from day one. Besides maybe an Optional/Maybe concept for error handling / data enclosures.

It makes for some very readable code and encourages passing return values that are easily consumed in a simple/functional way. Not capturing random error objects or unpredictable data structures.

Although I'm biased towards functional style, even though I code JS/Ruby for a living.