Earlier quoted context omitted.
It's more Rails than Django but once you've seen one MVC framework you've seen them all. I'd suggest: https://pragprog.com/book/phoenix/programming-phoenix In structure it reminds me a lot of the very first Rails book co-authored by DHH. It's a good way to get into the language/framework.
Thanks for the link. One thing I hated about Rails when I tried it was the level of magic involved. Does Phoenix suffer from that at all?
Phoenix 1.3.0 Released
41–50 of 143 posts
Re: Phoenix 1.3.0 Released
#42Phoenix 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…
Re: Phoenix 1.3.0 Released
#43Re: Phoenix 1.3.0 Released
#44Phoenix 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…
You want the whole enchilada? Use Guardian.
Need oauth? Use ueberauth.
Just want email and password? Use comeonin to hash your password.
It's liberating to know exactly how your system works and that it's not hidden behind some magical blackbox like Devise.
Re: Phoenix 1.3.0 Released
#45Re: Phoenix 1.3.0 Released
#46- Programming Phoenix by Chris McCord, Bruce Tate, and José Valim [1]
- The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao [2]
- Elixir in Action by Saša Jurić [3]
Phoenix initially attracted me to Elixir, I've stuck around for that and the OTP platform: pattern matching, process based concurrency (actor model), supervision, immutability, macros, and more.
"Elixir took the Erlang virtual machine, BEAM, and put a sensible face on it. It gives you all the power of Erlang plus a powerful macro system." – Dave Thomas
[1] https://startlearningelixir.com/r/programming-phoenix
[2] https://startlearningelixir.com/r/the-little-elixir-and-otp-...
Re: Phoenix 1.3.0 Released
#47I recently ported my app from 1.2->1.3 and moving away from Models to Contexts/Data was a simple transition that makes a lot of sense.
The `data` files (aka your new models) are basically where the schema for your model lives and the `context` (your models API) is the interface for your data.
For example when building a blog:
Instead of having User, Session, Post, and Comment models which contains your DB schema, business logic, and interfaces for getting/setting data all models directory ala Rails:
blog/app/models/comment.rb
blog/app/models/post.rb
blog/app/models/session.rb
blog/app/models/user.rb
blog/app/controllers/...
blog/app/views/...
you instead create a namespace for each group of data: lib/blog_app/accounts/accounts.ex
lib/blog_app/accounts/session.ex
lib/blog_app/accounts/user.ex
lib/blog_app/blog/blog.ex
lib/blog_app/blog/comment.ex
lib/blog_app/blog/post.ex
lib/blog_app/web/controllers/...
lib/blog_app/web/views/...
And in your data file `lib/blog_app/blog/post.ex` for example, you'd keep just your schema defining the fields like "title, permalink, body, etc" and code to handle validations and virtual attributes.Then in your context file `lib/blog_app/blog/blog.ex` you define the API that access your data. So from your controller instead of calling:
Post.all
Comment.all
Comment.find(1)
User.new({..})
You now call: Blog.list_posts
Blog.list_comments
Blog.get_comment(1)
Accounts.create_user({..})
It makes for a very logical structure for your MVC code.Re: Phoenix 1.3.0 Released
#48Earlier quoted context omitted.
As a .NET developer by day, I'm curious what you like about Elixir over C#/.NET? I have a copy of Elixir in Action on my nightstand, I just haven't had a chance to crack it open yet.
Pattern Matching makes it easy to write small, understandable code The Concurrency Model is simple to the point where creating a whole pubsub system to handle events, push out notifications, and handles backpressure can be done in Finally the pipe operator is like C#'s LINQ statements but with so much more power and flexibility, hard to explain but I highly recommend cracking open that book on your nightstand!
Re: Phoenix 1.3.0 Released
#49For anyone curious about Phoenix and Elixir, I can sincerely recommend the following resources to get you started: - Programming Phoenix by Chris McCord, Bruce Tate, and José Valim [1] - The Little Elixir & OTP Guidebook by Benjamin Tan Wei Hao [2] - Elixir in Action by Saša Jurić [3] Phoenix initially attracted me to Elixir, I've stuck around for that and the OTP platform: pattern matching, process based concurrency…
You build you a simple HTTP server using Elixir and learn a lot of the core language and architecture choices when writing Elixir code. It doesn't pester you with this is an int, this is a string. You just start building this HTTP server out and learn about Elixir along the way.
Re: Phoenix 1.3.0 Released
#50Would you suggest to choose Elixir / Phoenix for an api for a startup? Is it too risky now, or good enough + very attractive?