15 ms·
Phoenix 1.3 is pure love for API development
- Exuma 10y ago<3<3<3 for Elixir / Erlang / Phoenix I learned about it about 20 days ago and have spent every day since then absorbing, reading and learning. I LOVE this language / framework / OTP / methodology / community
- swanros 10y agoI experienced the same. Once you start, it's hard to stop. An amazing community around this awesome language is hard to let go.
- Exuma 10y agoDo you find it's a lot of extra writing for the contexts? I'm new to Phoenix and my first thought is it seemed kind of verbose to define every single 'meeting point' across 'models'. For simple apps it seems OK but I have some complicated apps with many models and interactions
- _asummers 10y agoOne of the things that is being stressed in this release of Phoenix is that, to paraphrase Chris, your entire application is a model of your domain -- that "models" are really just Ecto schemas, so data, and your web part is really just a shim over your larger application. I encourage you to watch this[0] talk. [0] https://www.youtube.com/shared?ci=Muyt0zSUAbQ https://www.youtube.com/shared?ci=Muyt0zSUAbQ
- kkirsche 10y agoI've wanted to use Phoenix a few times but every tutorial to get me started relied 100% on ecto which for something like a transformation API was frustrating. I didn't want the complexity of a database I wanted to learn the request lifecycle in it. Overall, it was challenging with too many resources being out of date or just so focused on a different type of API than I needed to build
- fghgfdfg 10y agoReally? I had a very different experience. I mostly just used the official Phoenix docs and never touched ecto. It was a strictly optional thing I didn't need, so I didn't touch it. I did look at some other tutorials and I don't recall ever having issues because I wasn't using ecto. Either they weren't using it or I got what I needed anyway. This was probably about a year ago or so. Maybe things changed at some point?
- bphogan 10y agoI did a short video series for Pragprog.com on Phoenix that does not use a database, but does get you started. It looks like it'll all be out of date by the time 1.3 hits though. :( Anyway, it's at https://pragprog.com/screencast/v-bhphnx/build-real-time-web-apps-with-phoenix https://pragprog.com/screencast/v-bhphnx/build-real-time-web... if you're interested.
- plainOldText 10y agoI'm working on a big Elixir project, and at first Ecto was frustrating (I was learning both Ecto and Elixir). However, upon spending a bit more time with it and learning the basic blocks that defines it, I can say it's a pleasure to work with. I think this is the case whenever we encounter some new language or new framework/library. In the beginning it's frustrating because we don't master the basic building blocks and cannot write code fast enough. But once we have a solid foundation, a whole new world opens.
- Dangeranger 10y agoIf you don't want to deal with a database and ecto then you should just learn Plug first as Phoenix requests and responses are built upon it. https://github.com/elixir-lang/plug https://github.com/elixir-lang/plug https://elixirschool.com/lessons/specifics/plug/ https://elixirschool.com/lessons/specifics/plug/
- lilactown 10y agoI've had the same experience. Coming from Express/Node.js and other micro-frameworks in other languages, I yearn for a `mix phoenix.new --no-ecto --no-brunch --no-view --no-controller ...` Basically the bare minimum to serve a piece of HTML or JSON down a pipe. I ended up doing what Dangeranger said and used Plug, but now I'm finding that phoenix channels would be a lot more ergonomic for the project I'm working on...
- the_common_man 10y agoBest part for me is the new fallback controller plug. Really well done. That and the centralized error list. This is one of the things which is miss in Go (I think this is the same in Rust, but I am not an expert).
- philfra 10y agoBe careful: that is a framework, not a language feature.
- the_common_man 10y agoIs a language useful without useful frameworks around it?
- namelos 10y agoI believe at least most of those lisp dialects are useful without any frameworks. You get view template with s-expr for free instead of erb/ejs/eex. And you are basically composing everything like plug in elixir very easily. However, the down side of not having a major framework is community does not have same context to discuss and share, which keeps almost every lisp dialect remains out of mainstream.
- philfra 10y agoMost of the time not, but the comparison of a specific feature of phoenix and go as a programming language is not valid.
- bharani_m 10y agoaction_fallback seems like a great addition. It is helpful to expose all your error codes in a single place. However, I am not too convinced about having a context for each resource. I think that should be optional, meaning that I should be able to specify a context for some related resources but at the same time, I should be able to have resources outside of any context.
- josevalim 10y agoIt is not a context per resource. The context should group all resources and responsibilities that belong to that context. For example, if you are building Github, you could have an IssuesTracker context where you would find the issues, labels and other all issues tracker related resources in there.
- deleted 10y ago[deleted]
- autoreleasepool 10y agoI can't wait until May[0] for the new 'Programming Phoenix' book. I found the first edition to be a great learning experience. [0] http://shop.oreilly.com/product/9781680502268.do http://shop.oreilly.com/product/9781680502268.do
- jon-wood 10y agoProgramming Phoenix is one of the few programming books I've read cover to cover. Not only does it cover the nuts and bolts of how to do things it also goes into why things are as they are because it was written by the same team responsible for Phoenix itself.
- cyberferret 10y agoThanks for the tip - just bought a Kindle copy. I was going to get the hardcopy, but Yikes, WHAT has happened to the cost of freight recently?!? It was going to cost minimum $45 to ship a $35 book to Australia!!
- JimmyAustin 10y agoI can only assume continental drift...
- deleted 10y ago[deleted]
- angelofm 10y agoI love elixir and phoenix, I have started learning it around a month ago and it has been a eye opener, the only thing that I struggle are the error messages, sometimes I spend more time than I should try to understand where I made a typo, I am not sure if it's just me because I am so new to this technology or many ppl have the same problem.
- auxbuss 10y agoRaise an issue. José pays a lot of attention to providing great error feedback. And yeah, we've all had incomprehensible messages en route when learning elixir. Things aren't perfect, but they'll only get better when folk point out the shortcomings.
- tchow 10y agoWhile action fallback sounds pretty useful, it feels like a framework solution to a language problem. The language just doesn't handle nested if statements very well. Also writing elixir always feels like the lines of code are longer than the width of my IDE. It is so much text... My Elixir (and phoenix) experience so far, has been far from amazing contrary to all the hype on hn all the time.
- pmarreck 10y ago> The language just doesn't handle nested if statements very well One of the advantages of this language I've found is that I specifically DO NOT need to nest "if" statements anymore! Hie thee to pattern-matching and private functions that take different states (which are normally handled by nested ifs). Also, nested ifs are REALLY hard to test well, and breaking them out into separate functions with the same name but different clauses makes it MUCH easier to unit-test.
- pawelduda 10y agoInteresting. While Elixir syntax definitely requires writing more code, than for example Ruby which I use the most, I have not been struggling too much. Could you give some examples of these long, problematic snippets? Also, what are the other things you did not like about Elixir/Phoenix? I am really curious to hear about them since, here on HN they are mostly praised and I wonder myself what are the cons (my experience has been great so far).
- pmontra 10y ago$ irb [1, 2, 3, 4]. select {|n| n % 2 == 0}. map {|n| n * n}. reduce {|sum, n| sum + n} # 20 vs $ iex [1, 2, 3, 4] \ |> Enum.filter(fn(n) -> rem(n, 2) == 0 end) \ |> Enum.map(fn(n) -> n * n end) \ |> Enum.reduce(0, fn(n, sum) -> sum + n end) That Ruby code is so compact that I split it on multiple lines only to make the comparison easier. Even Python is more compact even if it's harder to read because of the reverse order (I'm sure that there is a nested comprehension for that but it's beyond my comprehension skills) from functools import reduce reduce(lambda x, sum: sum + x, \ map(lambda x: x * x, \ filter(lambda x: x % 2 == 0, \ [1, 2, 3, 4]))) # 20 The problem here is having to type Module.function(value) vs object.method OO languages have a more compact notation because objects act as namespaces. Elixir has alias but it doesn't help much and must be used wisely. alias Enum, as: E would only confuse people and gain little. Then Elixir has too many do end compared to Ruby (coming from Ruby I feel them unnecessary), but that's not a big deal. Moving from syntax to programming patterns, having to define twice my functions in GenServer (internal API and public API) is too much boilerplate. I'd like to have time to study macros really well and end up with a DryGenServer that lets me def the external API with the internal implementation. Maybe I'll defmacro a defasync and a defsync, that generate the standard "double" GenServer functions.
- jsmeaton 10y agoCan anyone point me to a decent fully contained example of a smallish app in Phoenix on something like github? I've spent a couple of hours reading some of the Elixir docs and getting familiar with some concepts, but I still have no idea how an Elixir app or a Phoenix app would actually look.
- djm_ 10y agoSure! Josh Adams of Daily Drip recently did a Kickstarter [1] to build an open source forum in Elm, Phoenix & Elixir. You can follow the progress either with Daily Drip or just by watching the repository [2] as all the work is happening in the open. For other repos, Elixir and Phoenix both have "topics" on github now so you can filter a search by repos which are tagged with those topics and order them by stars (obviously this does not sort the wheat from the chaff or the libraries from the projects though). [3] Welcome to the community :) [1] https://www.kickstarter.com/projects/1003377429/firestorm-an-open-source-forum-in-phoenix-from-eli https://www.kickstarter.com/projects/1003377429/firestorm-an... [2] https://github.com/dailydrip/firestorm https://github.com/dailydrip/firestorm [3] https://github.com/search?o=desc&q=topic%3Aelixir+topic%3Aphoenix&s=stars&type=Repositories&utf8=%E2%9C%93 https://github.com/search?o=desc&q=topic%3Aelixir+topic%3Aph...
- hansihe 10y agoI have worked with Elixir quite a lot, and I think I have a fair idea of how the language works in general, and how OTP apps are structured. Even so, I find myself having the exact same issue as you are having when using Phoenix and Ecto. The way I like learning something new is by looking at something someone else has made. This gives me a much better view of how things are done than just reading getting-started guides and docs. I have looked, but I haven't found a lot of examples that actually applies to the latest versions of Phoenix and Ecto.
- brightball 10y agoFor what it's worth, this is generally where the "build a blog" type examples come in handy. It's a simple, repeatable process that gets you through the basics of the architecture across the board. You'll get a couple of routes, a couple of controllers, a little bit of database access, a bit through the view layers and by the time you're done you'll have a simple app that you can experiment with. It's generally my go-to "learn the language" process for anything. I didn't open source it, but here's a little write up on mine. http://www.brightball.com/articles/insanity-with-elixir-phoenix-postgresql http://www.brightball.com/articles/insanity-with-elixir-phoe...
- ricardobeat 10y agoIs there an actual reason for shortening everything to "phx"? I would guess the same rules as naming variables would apply here.