3 ms·
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. Unfo
by klibertp 12y ago
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 :)
- therockhead 12y agoRegarding documention, did you see the following guides https://github.com/lancehalvorsen/phoenix-guides https://github.com/lancehalvorsen/phoenix-guides ?
- klibertp 12y agoNo, 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)?
- lancehalvorsen 12y agoWe're working on a way to gather a lot of good info about Phoenix and make it available in a single place.
- lancehalvorsen 12y agoI'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 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 https://github.com/lancehalvorsen/phoenix-guides Sorry these didn't help for your last project, but maybe they'll help for your next one. :)
- klibertp 12y agoI'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 :)
- Xixi 12y agoI think what you were looking for is Plug: https://github.com/elixir-lang/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.
- HashNuke 12y agoGoing 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.
- sntran 12y agoThis. 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.
- chrismccord 12y agoI 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.
- krick 12y agoFor 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.
- josevalim 12y agoCuriosity: 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 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).