Live data from Hacker News

Phoenix 1.3.0 Released

phoenixframework.org

111–120 of 143 posts

Re: Phoenix 1.3.0 Released

#111

Earlier quoted context omitted.

I believe these are referred to Railway-Oriented Programming. I've seen several other examples for Elixir (incl. ones using macros), but by far this is the 'cleanest' syntax :) Here's a similar construct in Scala: (for { user ... }

Or you could just call it what it is: a monad

"Railway-Oriented Programming" is a lot more specific than "monad".

Re: Phoenix 1.3.0 Released

#112

Phoenix is great! I only wish there was one recommended way for authentication and authorization - there are so many [1] different libraries that I got stuck in researching the options - I am confused, do not know which one to use. What is your preferred way? I would like to avoid to implement every little detail on my own - to get security done right was the main reason for me using open source libraries. It would b…

I agree with you. Most of the web apps required authentication with email + social(google, fb twitter, github). In most of the rails app people would be using Devise + omniauth and these both works seamlessly and very easy to integrate.

As of now there are no libraries available to implement above functionality easily for Phoenix framework. For me also this is one of the main reason to go ahead with Elixir + Phoenix

Re: Phoenix 1.3.0 Released

#114
post #10

Earlier quoted context omitted.

I'm a django guy. I have no experience with functional programming. What would a transition to phoenix + elixir look like for me?

I've used both and honestly it probably wouldn't change much. Unless you're building an application that deals with tons of persistent connections and websockets there aren't really that many advantages. The Python ecosystem is also much, much bigger than the Erlang and Elixir ecosystem and it has far more mature libraries. If you really want to learn a functional programming language I'd strongly suggest looking at…

The difference between Elixir/Erlang and a statically typed functional language is that it's built for distribution.

In a distributed system where machines register on a cluster and messages are passed constantly across isolated heaps, processes and entire machines transparently all of the assumed protections of a static type system break down. You can't enforce static types across a cluster anymore than you can across a JSON requests to somebody else's API without a lot of extra overhead.

Static types are essentially contracts and in order to enforce a contract like that on a cluster of different machines that would mean you'd have to exchange contracts everytime a new machine joined the cluster...for all modules and functions...with every machine on the cluster. And then you have to determine how to handle contract violations.

Clustered message passing operates more like request routing in that regard. Send to this machine, to this module, to a function named this, with this arity, that matches this pattern.

The Elixir gradual typing approach balances this reality extremely well in my opinion. You get type checking if you want it and can specify it in more detail...but it won't promise something that it can't guarantee across the cluster, across deploys and across changes.

Re: Phoenix 1.3.0 Released

#116
post #34
post #25

Earlier quoted context omitted.

Could you give some examples of 'neat' things that needed to keep going no matter what on django (thus switching to Phoenix)

I should have said Python instead of Django. The problem is that I was/still am a rookie of a programmer. I could not wrap my head around async in Python. I just wasn't getting it. I had a nagging sense that it was going to fail in the middle of the night and there was nothing I could do about it. So, enter Elixir, which actually has a syntax that is kind of close to Python. It made immediate sense. If you want to do…

This isn't your fault. Python doesn't get the asynchronous stuff particularly right, nor does it make it as straightforward as it should. I've moved to Elixir and one of my employers has moved to Go as a direct result of Python's concurrency model (and the hilariously needless and recondite primitives attached). Your reasons aren't particularly superficial; I'd pick the Actor model over systemd and uWSGI for anything critical!

Re: Phoenix 1.3.0 Released

#117
post #102

I use Phoenix with all my newer projects. The performance is stellar. I single-handedly was able to create what many startups out there have built with 100s of thousands of engineers[1] in a short period of time. This may be possible with Rails too, but then, I found a lot of things are much more convenient to get done in Phoenix than in Rails - For example, Contexts (nested models), Routes, etc. When I started with…

Interesting. I've been trying to decide which language to learn next. Between Scala, elixir, and haskell at the moment. Was leaning Scala, but all the praise here is starting to convince me to go elixir. What problems did you run into with Scala?

Re: Phoenix 1.3.0 Released

#118
post #117
post #102

I use Phoenix with all my newer projects. The performance is stellar. I single-handedly was able to create what many startups out there have built with 100s of thousands of engineers[1] in a short period of time. This may be possible with Rails too, but then, I found a lot of things are much more convenient to get done in Phoenix than in Rails - For example, Contexts (nested models), Routes, etc. When I started with…

Interesting. I've been trying to decide which language to learn next. Between Scala, elixir, and haskell at the moment. Was leaning Scala, but all the praise here is starting to convince me to go elixir. What problems did you run into with Scala?

In Scala, there are many ways to write a function. I wish I can share some code snippets, but, I'll just summarize for the sake of simplicity:

1) Functions have different forms and even nomenclature based on how many parameters they accept, how they are represented, etc.

2) Scala still has OO, which means it needs to carry a lot of baggage. The breadth of Scala's nomenclature combined with OO will take you a long way to learn the language.

3) Scala still runs on JVM which means you need to learn some of the JVM concepts if you'll be using it in prod. If you're from a Rails background, this is completely a new arena, because this is usually the Java guys' arena.

4) I wanted to be able to simply open up the source code and be able to understand what's happening. This was possible in Ruby/Rails, and ultra easy to do in Phoenix/Elixir, but painful in Play/Scala. IF you open up the source code of a Play! framework project, there's code so succinct that you would need to be strong with the language's understanding to get the full picture. Case class, implicit, etc., just to cite a few. In Elixir/Phoenix, it's just modules and it's just simple, yet elegant.

5) That being said, it's still good to learn Scala because there are tons of libraries out there with special use cases which you can use Scala for - It's still a good strongly typed language to build a robust project on. IF I remember correctly, David Pollak mentioned in his book that he'd written an app in Scala that ran for years without any problems.

As for Haskell, I read this somewhere - "Haskell is nice and all, but it's no Erlang." Since Erlang also has a bit of a learning curve, the next best alternative is Elixir.

P.S, - languages should be chosen based on one's own philosophy and in this case, Elixir strongly resonates with my own philosophy and all this is just my own opinion on why I chose it :)

Cheers.

Re: Phoenix 1.3.0 Released

#119

Phoenix is great! I only wish there was one recommended way for authentication and authorization - there are so many [1] different libraries that I got stuck in researching the options - I am confused, do not know which one to use. What is your preferred way? I would like to avoid to implement every little detail on my own - to get security done right was the main reason for me using open source libraries. It would b…

If you're coming from a Rails background, you'll find Coherence[1] similar to Devise.

However, I was recently in need of implementing authentication for more than two models (Buyer, Seller) and that's where I hit a roadblock with these Devise-like libraries. Just by chance I found a really good, well designed library which I use in production as of now. The author is also the author of many other famous libraries in Phoenix-verse (Comeonin, for example). The library is called Phauxth. Check it out:

https://github.com/riverrun/phauxth

[1] https://github.com/smpallen99/coherence

Re: Phoenix 1.3.0 Released

#120
post #118
post #117

Earlier quoted context omitted.

Interesting. I've been trying to decide which language to learn next. Between Scala, elixir, and haskell at the moment. Was leaning Scala, but all the praise here is starting to convince me to go elixir. What problems did you run into with Scala?

In Scala, there are many ways to write a function. I wish I can share some code snippets, but, I'll just summarize for the sake of simplicity: 1) Functions have different forms and even nomenclature based on how many parameters they accept, how they are represented, etc. 2) Scala still has OO, which means it needs to carry a lot of baggage. The breadth of Scala's nomenclature combined with OO will take you a long way…

> I wanted to be able to simply open up the source code and be able to understand what's happening. This was possible in Ruby/Rails, and ultra easy to do in Phoenix/Elixir

While it is possible to look at source code in Ruby/Rails, in practice for me (even after a few years of production ruby experience) it was extremely painful to look at any number of libraries due to the amount of redirection and implicit state, and monkey patching. But Elixir has (almost always) been VERY easy to follow, sometimes the code is just so simple.

Post reply on HN