4 ms·
When people choose to build on a more esoteric language such as Elixir (and to lesser extent Erlang) is it because what they want to do simply is not possible i
by pbreit 11y ago
When people choose to build on a more esoteric language such as Elixir (and to lesser extent Erlang) is it because what they want to do simply is not possible in Ruby/Python/Go/JavaScript/etc or just less efficient, elegant, productive, etc?
- erokar 11y agoThe latter. The virtues of Elixir is that it is a functional language with immutable data structures, and that it does not support object oriented programming (which I consider a feature).
- sjtgraham 11y agoErlang processes have state and you interact with them by sending them messages. You can do OO if you want :P
- dpeck 11y agoOddly enough you can do OO with Erlang/Elixir in a more pure/better (to me) way than you can with more traditional OO languages.
- Havvy 11y agoThat's because the core of OO (message passing to opaque things) is really all you can do if you have a PID. In other more-traditional object-oriented languages, they usually have defaults that let you do more than just send messages - such as mutate the internal state directly in ways that the object cannot detect.
- sjtgraham 11y agoErlang/OTP is great fit for building applications that support a huge amount of concurrent users, but the problem is that IMO Erlang is nowhere near as pleasant to work with as Ruby, Python, etc. So if you're building something with zero users and choosing Erlang because of the ROFLscale potential it's premature optimisation. Elixir is the difference. I am just as productive in it as anything else and I enjoy it much more. So what we have is the massive power and potential of Erlang/OTP with a productive, pleasant API and great developer tools (Mix, Hex, etc).
- querulous 11y agomy employer uses erlang because it's a huge leap forward operationally over ruby/python/go/java. the erlang/otp concept of a release is extremely straightforward and reliable and the beam (erlang/elixir vm) run time introspection and debugging tools are second to none. it's trivial to attach to any running application and get a REPL with full access to the environment. you can even update running code in place
- djKianoosh 11y agohow do people typically put security (authentication and authorization) around this? You wouldn't want just anyone to be able to connect to your running apps, of course. From what I saw in Elixir, there's some kind of cookie/session key that you can specify, but is that it or is there more?
- greenleafjacob 11y agoVPC?
- czbond 11y agoVirtual Private Cloud. Amazon's "branded" term for a private cloud with strict firewall inbound access protection.
- querulous 11y agowe're on aws, so we use vpc with security groups that limit connections to our vpn or a bastion server at our network edge i'm not aware of anyone running an erlang or elixir repl over http but it would be an interesting project
- andyl 11y agoI use Elixir/Phoenix on mobile multi-core arm devices because it uses memory efficiently and has off-the-shelf support for multi-core concurrency.
- unoti 11y ago> is it because what they want to do simply is not possible in Ruby/Python/Go/JavaScript/etc There are several key distinctions about Elixir vs the other languages you mentioned. These are things that are basically not going to happen in Ruby, Python, Go, Javascript, or etc.: 1) You get the benefits of Erlang/OTP as others have mentioned in their replies. 2) You also get the amazing macro capabilities (runtime code execution and runtime code generation, a la LISP) that Elixir brings to the table. Many of the language features of Elixir are written in macros in Elixir. The source to both Elixir and Phoenix are quite elegant and educational to browse, and demonstrate this runtime code generation aspect very well. It's straightforward in Elixir to introspect code, represent that code as data structures, manipulate those data structures, then generate or execute that code, as you can in LISP. 3) Immuatable data and functional style leads to better code in lots of ways. This is what really makes the benefits of OTP possible (updating the code without restarting the servers, easily migrating state between servers, and so on). But it also makes certain kinds of situations easier to understand and fix, since all state in the system can be expressed as parameters to functions.
- sasa555 11y agoEverything is possible in a Turing complete language (assuming enough of base utility functions are provided by stdlib), so the question is not possible vs impossible, but how much of a help the tool is. Erlang provides great abstractions for building fault-tolerant, scalable, distributed, soft real-time systems. That's not to say you can't do it with Erlang, but Erlang does give some simple, yet very powerful tools for making developer's life easier. Without Erlang you have to work harder to get similar effects. Again, it's not impossible but there's more burden on developers because the runtime provides less guarantees. I elaborated a bit on the topic in the promo interview for my book (http://www.infoq.com/articles/elixir-in-action-erlang-review http://www.infoq.com/articles/elixir-in-action-erlang-review).
- bphogan 11y agoI did. I love Rails. Love it. Love Ruby. I've been writing code for over 25 years this year, and I've been doing Ruby for 10. And I hit a big brick wall with a very websocket-heavy app I'm building. I switched to Elixir and Phoenix last year and got the core of my app working. It's funny though - the core is easier. But many freebies from Rails aren't there yet. So I still don't have password recovery emails or confirmation emails on signup done yet :)
- prapam2 11y agoBut you woudn't need gems to for recovery emails right?
- pmontra 11y agoThe Devise gem does that for free. I remember me coding it in my first Rails application so many years ago and I'm not keen to go back to it: it feels like wasted time. Phoenix didn't have it one year ago and it's sad to learn that it doesn't have it yet. Somebody will write it sooner or later because it's almost core functionality of a registration and authentication system.
- prapam2 11y agoIts actually pretty simple to implement on your own. I am not big of device. I feel it does too much magic. It should have been just a api layer and not touching views.
- bphogan 11y agoIt's simple to write a password-based auth system. Then you must clear session appropriately. Then you must create the login page. Then the controller for authenticating. And then you need to ensure that the flow works with a test. Then you need the email that actually activates the account, with the activation hash. So now you're setting up a mailer system, which Phoenix does not have by default. Then people will want to recover passwords. So you need to write the logic for that. Oh, and the controllers and views. And routes. And of course, you need to hash the password using some kind of encryption. Excrypt, comeonin, what have you. Choices choices choices. You'll need a plug to act as the bouncer for your routes too, so nobody gets in where they shouldn't. So you'll have to write that. You have to end-to-end test this, of course. And probably, if your business depends on it, get a couple other people to review the security of your system. Simple. And takes a long time. HTTP is pretty simple, but we use frameworks. SQL is pretty simple too, but we use Ecto now. It's simple in its pieces, but I really don't wanna do all that work on every app. I'm lazy.