News for hackers. Stuff that matters.
Re:Phoenix – Elixir Web Framework by klibertp on Friday November 28, 2014 @05:52PM (#8672426)
I tried using Phoenix for a simple web app I wrote last month. It was a couple of static html/js files and a single WebSocket connection, so nothing fancy. Unfortunately, I found the documentation lacking, and the framework much too "magical" for me to quickly understand and make use of. I have no experience with Rails but rather with Django, so that may explain a lot. Anyway, in the end I used Erlang and Cowboy instead. I checked out Cowboy from github master which is "almost 2.0" now, and I had no problems at all setting basic project up. Defining routes was straightforward and explicit (which I like), upgrading connection to websocket and handling incoming data was simple and explicit too. I added eredis and jiffy to the project and that's basically it, it did everything I wanted it to do splendidly, with little magic and very little overhead.

Now, I know Erlang much better than Elixir, and I worked with Cowboy before and I needed to make this app quickly, which resulted in me not spending too much time on learning Phoenix. Between controllers, routes, views and channels I got an impression that Phoenix has too many moving parts and that it would take me too much time to fully understand what's going on. Especially because I really didn't need most of these, just a static file server and a single WebSocket.

However, I see Phoenix potential for more complex projects, where investing the time to learn it is going to be worth it. It looks like Phoenix provides an awful lot of conveniences and makes a project much better structured than my "a couple of files in a single directory" approach.

I guess what I want to say is that I almost used Phoenix this time and that I would probably use it if it had better docs - especially a solid tutorial(s) for use cases similar to mine. And that, while I didn't use it this time around, I'm certainly going to keep an eye on it and consider it next time I have to write something similar. It looks very promising and - like Elixir itself - very interesting, I hope for it to only grow in the future :)

Re:Phoenix – Elixir Web Framework by lancehalvorsen on Friday November 28, 2014 @06:30PM (#8672516)
I'd just like to say that Phoenix documentation is getting better all the time. The core team has put a lot of effort into documenting modules and functions, which you can see on http://hexdocs.pm/phoenix.

I am also coordinating the Phoenix Guides project which, while still incomplete, is adding information all the time. https://github.com/lancehalvorsen/phoenix-guides

Sorry these didn't help for your last project, but maybe they'll help for your next one. :)

Re:Phoenix – Elixir Web Framework by klibertp on Friday November 28, 2014 @06:42PM (#8672545)
I've seen the API reference, but while it's good to have it, it doesn't help very much in the beginning. You need to know what is it you're looking for, and it's very hard to guess it with just the reference and no prior knowledge on the metaphors used. The guides look very nice, they probably would have helped me a lot, but I didn't find them last time as they are not linked from Phoenix main page. Anyway, looks like I will have something to read later this weekend :)
Re:Phoenix – Elixir Web Framework by therockhead on Friday November 28, 2014 @06:30PM (#8672515)
Regarding documention, did you see the following guides https://github.com/lancehalvorsen/phoenix-guides ?
Re:Phoenix – Elixir Web Framework by klibertp on Friday November 28, 2014 @06:37PM (#8672531)
No, and after a quick look at them I see that they'd help. Would be nice to have this mentioned in the project main readme under "Documentation" - do you know why it isn't there (yet)?
Re:Phoenix – Elixir Web Framework by lancehalvorsen on Friday November 28, 2014 @06:51PM (#8672572)
We're working on a way to gather a lot of good info about Phoenix and make it available in a single place.
Re:Phoenix – Elixir Web Framework by sntran on Friday November 28, 2014 @10:29PM (#8672991)
This. I can not put my words any better than this.

I used to dislike Rails, since it seemed to be too much abstraction that would require time to learn. I now have the same feeling about Phoenix. I could put up a simple web app quickly with Erlang and Cowboy. With Phoenix, I needed to read documents and the source code to figure out what all the imports are doing.

Re:Phoenix – Elixir Web Framework by drewolson on Saturday November 29, 2014 @10:03AM (#8673870)
This whole "framework fatigue" thing is going reductio ad absurdum. Convenience is not bad. _Too_ much convenience traded for opacity is bad.

As someone with a Phoenix app running in production, I can tell you that this framework hits the sweet spot of providing lots of value without requiring the user to learn too much. The abstractions it provides, especially the router and rendering layers, are very welcome. And I'm saying this from the perspective of someone who has built a few smaller vanilla plug applications.

Let's not throw the baby out with the bath water here just because rails went a little too far with the magic.

Re:Phoenix – Elixir Web Framework by chrismccord on Friday November 28, 2014 @10:39PM (#8673010)
I think Phoenix strikes a really great balance with its abstractions. I also think great things happens when a community adopts the same conventions. Rails has shown that beyond anything in my opinion. Things like our project bootstrap command `mix phoenix.new my_app` lets you get a bare app up and running in seconds. With a quick guide on the Router and Controller layer, most folks can get up and running very quickly, but our guides have lagged behind development. It's something we're working hard to improve. Lance has been working hard on full-featured guides and we should have them live very soon.
Re:Phoenix – Elixir Web Framework by krick on Saturday November 29, 2014 @02:17AM (#8673312)
For me it's not even about "time to learn", but the fact that I never can be sure I know how something like this works. Even that little detail about how `resources` automatically defines so many routes… yeah, it's kinda convenient, but I would be more comfortable if I'd have all of my routes explicitly defined somewhere, at least in a framework with scaffolding. When an app written like that grows, and I'm not the only developer, and that guy before me was clearly using drugs — well, that really becomes scary much quicker than in a simple Flask-style framework.
Re:Phoenix – Elixir Web Framework by josevalim on Saturday November 29, 2014 @05:20AM (#8673508)
Curiosity: is that a concern only with routes? Or would you also like to have a explicit control of which middleware you are using too?

Because if the latter, it feels like a web framework isn't for you. But you should definitely consider Plug (http://github.com/elixir-lang/plug), which has all the pieces and you just need to put them together (a simple router, a bunch of "middleware", etc).

Re:Phoenix – Elixir Web Framework by Xixi on Friday November 28, 2014 @07:40PM (#8672672)
I think what you were looking for is Plug: https://github.com/elixir-lang/plug

I don't think there's a plug for websockets out of the box, but it's not hard to hook them on Cowboy directly.

Re:Phoenix – Elixir Web Framework by HashNuke on Friday November 28, 2014 @11:25PM (#8673073)
Going by my experience, if you are using Websockets, choosing Phoenix would be a really good choice. There's a lot of work that's gone into transport adapters in Phoenix (websockets and recently polling support was also added). @peregrine and @chris_mccord did a lot of work as far as I can recall. I've been noticing that @JoseValim has joined in too.

That said, I would love some websockets stuff refactored out of Phoenix into a Plug so that it can be used even without Phoenix. I'm not sure about the amount of work that would require.