News for hackers. Stuff that matters.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @07:44AM (#21280963)
I write CRUD apps for a living , how is Elixir gonna make it easier for me? It can't and it won't. Not saying it's bad or anything, just has nothing for me personally.
Re:An Interview with Jose Valim, Creator of Elixir by generalk on Thursday October 17, 2019 @09:45AM (#21281970)
I also write CRUD apps for a living. Not every project needs Elixir, but here's several reasons why I might choose Phoenix for a project:

1. Phoenix's channels make communication between a frontend and backend pretty effortless. Create a channel, publish a message, and anyone listening to the channel picks it up. Communicating updates from the server to the client is simple. Communicating between clients is equally simple.

2. Elixir has great support for spawning and managing background processes. My go-to is Rails, and if I want to manage background work I have to use something like Sidekiq and Redis. It works, but Elixir is much nicer. I've written systems that need to manage heavy amounts of background work and I dream of rewriting them in Elixir.

Just a few data points that might be helpful.

Re:An Interview with Jose Valim, Creator of Elixir by ravenstine on Thursday October 17, 2019 @10:47AM (#21282603)
I wish that more people would bring up points like this instead of just insisting that Elixir and Phoenix are "scalable". Both of those points sound appealing.

It's like, okay, so there's the functional programming, the similarities to Ruby, the BEAM VM, the concurrency.... but what does it do for me? They're not exactly selling points on their own because other languages can compete with those things.

Re:An Interview with Jose Valim, Creator of Elixir by pdimitar on Thursday October 17, 2019 @08:13AM (#21281159)
If you elaborate on what you find underwhelming then perhaps people would not downvote you? They may even engage in a discussion.
Re:An Interview with Jose Valim, Creator of Elixir by adamkittelson on Thursday October 17, 2019 @12:05PM (#21283460)
A quote from pg's beating the averages (http://www.paulgraham.com/avg.html) seems relevant here to me:

As long as our hypothetical Blub programmer is looking down the power continuum, he knows he's looking down. Languages less powerful than Blub are obviously less powerful, because they're missing some feature he's used to. But when our hypothetical Blub programmer looks in the other direction, up the power continuum, he doesn't realize he's looking up. What he sees are merely weird languages. He probably considers them about equivalent in power to Blub, but with all this other hairy stuff thrown in as well. Blub is good enough for him, because he thinks in Blub.

[dead]
Re:An Interview with Jose Valim, Creator of Elixir by soneca on Thursday October 17, 2019 @10:27AM (#21282407)
Sure, but I still would like to know why you don't like Elixir
Re:An Interview with Jose Valim, Creator of Elixir by westoque on Thursday October 17, 2019 @09:46AM (#21281981)
It does for me. Let me give you an example:

You make an app using Ruby on Rails, keep developing it, and it keeps growing. You monitor your traffic and it gets bigger, now you add more servers to handle the traffic (it costs you $20/server, now you need 4). A couple more developments, memory usage starts to grow also.. Now, you need to increase memory of your server.. but now you also need Websockets, so you add both and need to add more resources to handle the scale, and the cycle continues.

When you use Elixir/Erlang and it’s BEAM VM, it’s highly efficient and scalable out of the box, so you won’t need to do “much” of the above. A simplistic explanation but shows the point.

Re:An Interview with Jose Valim, Creator of Elixir by jrochkind1 on Thursday October 17, 2019 @03:18PM (#21285456)
> it costs you $20/server, now you need 4

OK, so in real life maybe the costs can actually be an order of magnitude higher than this.

But for $60/$80 a month? Is like no money.

That is less than one hour of time for even a cheap developer including taxes and other overhead, or okay call it two hours a month of time if you want to be generous. So if Elixir instead of Rails (or, of course worse, _switching_ to Elixir from current Rails) takes more than, say, 24 hours of developer time in a year... you didn't save money.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @10:43AM (#21282569)
OK I'm not working on Google scale, but for the vast majority of companies I don't think this actually matters that much. If it's all about budget than I would hire PHP devs instead of Elixir cos cheaper! No it doesn't make sense sorry. For the small amount of companies where this actually matters you'd still need to convince me how java/.net/Go can't get it right.
Re:An Interview with Jose Valim, Creator of Elixir by dnautics on Thursday October 17, 2019 @01:33PM (#21284382)
ok maybe this make a difference. I can train a junior on elixir and have them writing code that I am confident won't break the system in prod within three months. I can't do that in any of the other languages, I would have to buy a senior.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @01:08AM (#21288851)
lol sure man, good luck with that project.
Re:An Interview with Jose Valim, Creator of Elixir by cpursley on Thursday October 17, 2019 @09:05AM (#21281570)
Elixir (via Phoenix) not only makes CRUD apps trivial, it also sets you up to very easily evolve the application as requirements change.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @09:25AM (#21281756)
PHP is trivial. Understanding it and shipping code can be done by a 9 year old. Rails is trivial. What is so trivial about Elixir? More concepts, caring way more about performance and concurrency (things a normal dev has to deal with very very rarely). Just don't see the upside
Re:An Interview with Jose Valim, Creator of Elixir by brightball on Thursday October 17, 2019 @09:35AM (#21281867)
It's understandable. Elixir is one of those languages you won't really appreciate until you've experienced the problems that it addresses.

You're getting down voted mostly because of your tone (IMO) but the appeal if Elixir is just a reality of experience.

When I found it, I was 15 years in my career and when I dove in, learned it and saw how it addressed so many short term and long term issues that appear in application development...the balance was the closest thing I'd seen to perfect.

But if I hadn't experienced the pain, I would never have appreciated it all the little details.

Re:An Interview with Jose Valim, Creator of Elixir by preommr on Thursday October 17, 2019 @09:52AM (#21282031)
It would be nice if you elaborated on what those problems are and how elixir solves them better than existing alternatives.

All I ever see is people exclaiming how awesome it is and then the responses turn out to be underwhelming for various reasons. Like hot reloading isn't that special or unique anymore.

Re:An Interview with Jose Valim, Creator of Elixir by gregors on Thursday October 17, 2019 @10:06AM (#21282174)
I feel like this talk does a great job of answering that question - The Soul of Erlang and Elixir by Saša Jurić (https://www.youtube.com/watch?v=JvBT4XBdoUE)
Re:An Interview with Jose Valim, Creator of Elixir by preommr on Thursday October 17, 2019 @10:58AM (#21282721)
lol, there's the hot reloading.

But that's an interesting talk. I didn't have time to go through the whole thing but the core of it seems to be the pros of erlang like BEAM's high concurrency advantages and uniformity of tools running on top of otp.

It's an interesting argument.

Re:An Interview with Jose Valim, Creator of Elixir by brightball on Thursday October 17, 2019 @11:25AM (#21283044)
I need to write about it more. The most in depth piece I've written was this one:

https://blog.codeship.com/comparing-elixir-go/

Hot reloading is very unique though (but not necessary for most use cases). There's no other stack outside of the BEAM that has an equivalent. A lot of what is offered by the BEAM isn't even possible in other stacks because it requires a collective of language decisions working together.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @09:59AM (#21282095)
Doing this for 7 years, have yet to seen a problem throwing more servers/caching/database locks can't handle. I'm not saying those problems don't exist, I'm just saying it's not that common. Agree about the tone, was having a rough morning (plus: why does every Rails thread turn into a "you should really try Elixir!" , yeah we don't like our stack to be constantly shat on by Elixir guys)
Re:An Interview with Jose Valim, Creator of Elixir by ranyefet on Thursday October 17, 2019 @04:40PM (#21286170)
Of course you can throw more servers/caching/database locks, but the advantage of using Elixir & Phoenix is that you can do a lot more with less.

Think how much the code would be simpler and easier to reason about without caching. Or reducing the numbers of servers you need from 150 to 2 and with better performance [1]

[1] https://www.techworld.com/apps-wearables/how-elixir-helped-b...

Re:An Interview with Jose Valim, Creator of Elixir by tarsinge on Thursday October 17, 2019 @05:36PM (#21286572)
> yeah we don't like our stack to be constantly shat on by Elixir guys)

Sorry to be blunt but this is nonsense, languages and stacks are just tools.

When I was working on banking systems the idea of using dynamic typed language would have been insane. Now that I’m in a two man’s shop working on low traffic web app I’m happily using Rails for the CRUD work. And if tomorrow I were to work on a public high traffic real-time app like Discord I would do it in Elixir. There is no such thing as your stack.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @03:20AM (#21289309)
Usually there's the 1-2 tools you're most comfortable with, unless you're a true generalist. Most people can't be incredible in Rails/Django/Spring/Node/.NET at the same time, you have to pick 1-2 things you excel at. You can be efficient in 5 tools at the same time, but not an expert (for most people. some people are great at everything they put their hands on).
Re:An Interview with Jose Valim, Creator of Elixir by interactivecode on Thursday October 17, 2019 @10:16AM (#21282280)
You seem to have a bunch of experience with Phoenix, could you suggest some tutorials that will be helpful for people who start from scratch learning elixr and this type of development.

Coming from a php / node.js background it seems very overwhelming

Re:An Interview with Jose Valim, Creator of Elixir by di4na on Thursday October 17, 2019 @10:30AM (#21282442)
The default phoenix guide are really good and should be understandable if you come from php. https://hexdocs.pm/phoenix/overview.html

The default elixir-lang getting started is pretty good. https://elixir-lang.org/getting-started/introduction.html

Some people prefer this community one https://elixirschool.com/en/

Re:An Interview with Jose Valim, Creator of Elixir by cpursley on Thursday October 17, 2019 @10:48AM (#21282620)
This video course is fantastic:

https://pragmaticstudio.com/elixir

Re:An Interview with Jose Valim, Creator of Elixir by ravenstine on Thursday October 17, 2019 @10:43AM (#21282559)
CRUD is trivial in general, and pretty easy to implement even with the Node.js built-in HTTP library. A more complex API is probably where Rails or Phoenix start to make sense, but there's no reason why an HTTP library and a database aren't enough for basic CRUD. Someone who doesn't see CRUD as fundamentally trivial probably hasn't been programming very long.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @12:23PM (#21283634)
Well the idea behind Crud is easy but it doesn't mean every crud app is easy. Is Wikipedia or base camp easy to write without a framework?
Re:An Interview with Jose Valim, Creator of Elixir by lfn716 on Friday October 18, 2019 @04:43AM (#21289666)
I wouldn't say Elixir has more concepts, it is rather different concepts.

You also don't have to worry about performance and concurrency. I would actually argue that you have to worry less about performance and concurrency because you can go further without having to resort to cache layers, tuning, etc.

But ultimately, I don't disagree with you. If you are building CRUD apps, then any technology is likely fine. Perhaps there is a chance Phoenix will start to take a bigger pie of the "CRUD apps space" with LiveView (https://github.com/phoenixframework/phoenix_live_view). If you could produce CRUD apps at the pace you do today, but making them interactive and realtime is orders of magnitude simpler, would that interest you?

Re:An Interview with Jose Valim, Creator of Elixir by cpursley on Thursday October 17, 2019 @09:57AM (#21282072)
Can PHP or Rails do websockets or concurrency out of the box? The last Rails app I worked on required lots of glue to make this happen.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @10:01AM (#21282116)
Well yes of course they do. Any modern web dev stack does concurrency out of the box. In Rails you use a web server like Unicorn if multi process is good enough or puma if you want mutli threads as well. PHP has apache modules that do the same thing.
Re:An Interview with Jose Valim, Creator of Elixir by jonesetc on Thursday October 17, 2019 @02:20PM (#21284936)
considering their comment about it being difficult with rails, I think they are likely talking about concurrency within a single request as opposed to what I think you are talking about of concurrently handling requests.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Thursday October 17, 2019 @03:40PM (#21285640)
Again, that's just very rarely needed. The server is concurrent and if you have very heavy stuff you use background jobs. This doesn't only work for Rails, this is what java, .net, php etc etc are all doing and it works. I'll be interested intellectually to see what Elixir can do but I just don't see how it solves anything that isn't solved already.
Re:An Interview with Jose Valim, Creator of Elixir by jonesetc on Thursday October 17, 2019 @04:23PM (#21286004)
I'm not preaching the elixir word here either. I've never used it for anything real and just dabbled a bit as a toy. I'm just trying to help get this conversation going because I'm also interested. My experience is in java, node, and python primarily which covers a good bit of ground as far as the different concurrency approaches.

Anyhow, your characterization there I don't think is quite right. For one Java does not typically use a background job set up, because it is a first-class multithreaded runtime so it seems more likely prepared to use a threadpool for some concurrent processing before it say tosses things out to a task queue. Similarly as most java web servers are on a thread pool model for concurrency as opposed to async IO, you'll also have true in request concurrency for things like making a few calls to the DB and then collecting them. This thread pool is not well abstracted typically, and the mutable object model leads you to writing classically tricky multithreaded code with data races and the like.

For something like node where you are not really likely to be using threads, you are pretty hard tied to async IO as your method of concurrency. So you have a really easy job if all you're doing is async calls to say a DB with no need for data processing. Here once you need real computation you will have essentially no option other than using a task queue.

Then when it comes to python you have essentially the worst of all worlds. it's not easy to do concurrent IO or computation without some form of background processing.

I believe that when it comes to the elixir runtime the idea is that they have removed async IO from the mix and instead put up a concurrency API that is as simple to manage as async IO in something like node. Under the covers is all delegating out simple blocking code to a thread/process pool, but the immutable data model and API makes it so that data is not shared across the pool, trying to keep the classic concurrent mistakes hard to make.

Nothing that can be done in elixir seem to be impossible or even astoundingly hard in some other technology, but the unified API for all forms of concurrency seem like a nice way to make it a runtime that can handle many different types of workloads in a simple and cohesive way. That simple way also seeming to not need you to bring in things like a redis task queue where you generally would need to use it or some other external solution.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @01:16AM (#21288879)
"Java does not typically use a background job set up, because it is a first-class multithreaded runtime " : Is there really no equivalent of Sidekiq in java world, or that's just rarely used? I would assume a separate process would need to run over the jobs (so can be scaled easily) so then you need to write the jobs to some shared memory like redis. Is this rarely used? https://docs.spring.io/spring-integration/reference/html/red...
Re:An Interview with Jose Valim, Creator of Elixir by lfn716 on Friday October 18, 2019 @04:55AM (#21289732)
The advantage of Java and Erlang the author was referring to is that you don't need extra technology. With sidekiq, you must setup Redis and often separate instances to process the job queues. With Node and websockets in Ruby/Python, you typically must move any CPU task to jobs/task queues.

Sure, you may want to move your Java/Erlang jobs to Redis/SQS/etc for different reasons, but it is not your starting point. And given you were explicitly talking about CRUD apps, being able to have everything you need with only your app + database, without a need for Redis, workers, or tasks queues, leads to operational simplicity.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @06:03AM (#21290015)
But part of the idea behind a queue job is not to overwhelm the server with heavy jobs that aren't urgent. Even with a thread pool, in java, you may still overwhelm the server with heavy jobs like sending emails, if you do not clog the threads you may still spike the memory - do you really want your server and your background jobs to share the same memory and resources?. So the separate instance make sense to me - they are a feature in fact. I really want to know from someone from the java ecosystem more about how they handle heavy background jobs. I get that Elixir may have this part done in a nicer way, but still ,Sidekiq is a VERY polished tool.
Re:An Interview with Jose Valim, Creator of Elixir by cpursley on Saturday October 19, 2019 @06:24AM (#21297767)
> do you really want your server and your background jobs to share the same memory and resources

Erlang/Elixir processes don't share memory (Actor model) like Java threads do, giving it a distinct advantage (see Akka for Actor model in Java).

But yeah, for heavy stuff even in Elixir, you might want to outsource that to a Job server (which there are many libraries in Elixir for this).

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @05:59AM (#21289985)
I'm really asking because I don't know - in java world background queues are actually rare?
Re:An Interview with Jose Valim, Creator of Elixir by jonesetc on Sunday October 20, 2019 @08:09PM (#21308238)
probably a bit of loose wording there. It's probably not what either of us would call objectively rare, but it is comparatively rare compared to many other runtimes. There's quite amount of this that can be avoided with some vertical or horizontal scaling depending on what you are doing with these events.

For instance you linked the spring application events integration with redis, while that is definitely an option it's not one you'd immediately reach for. Instead you'd more likely set up and use application events and/or domain events (if using spring data) handled locally with thread pool. The benefit here is that of course way less set up and complexity, but you can also handle these events sync or async.

Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @01:23AM (#21288911)
"This thread pool is not well abstracted typically, and the mutable object model leads you to writing classically tricky multithreaded code with data races and the like" : If each request gets its own thread I don't really see the problem (they will not override each other's shared objects). Yes you sometimes run into stale reads/writes which you can solve with db locks etc.
Re:An Interview with Jose Valim, Creator of Elixir by joelbluminator on Friday October 18, 2019 @01:18AM (#21288888)
btw Sidekiq also works by using a thread pool as far as I know
Re:An Interview with Jose Valim, Creator of Elixir by cpursley on Thursday October 17, 2019 @04:27PM (#21286038)
Elixir can run concurrent background tasks without additional tooling. Can the technologies you mentioned do this (ie without setting up and maintaining a background job server, etc)? Ditto on pushing websockets. With Elixir, you don't need additional servers and caching for holding the the socket state (redis + node, etc). Hope that makes sense.