3 ms·
I've been hearing a lot of good things about Phoenix. I do web application development for a living, so I'm interested in learning more about it. I decided to
by scriptkiddy 9y ago
I've been hearing a lot of good things about Phoenix. I do web application development for a living, so I'm interested in learning more about it.
I decided to take a look at the official getting started guide. Looks pretty good. I like how rigidly everything is organized. Though, there are some things that put me off a bit:
* There are a lot of dependencies just to get a simple hello world app running.
* I need to have a Db installed even though the application doesn't touch a the Db? Does that mean the Phoenix stores its configuration in a Db? I don't like that. I try to keep config in file format.
* Honestly, working with ecto outside of initial model creation looks kind of nasty. I could be looking at this wrong though.
* I've never been a fan of functional languages for one reason: Too many damn symbols in the syntax! It appears that Elixir definitely does a better job having an understandable syntax compared to say, Haskell. That said, the one operator that always gets me is `|>`. I understand what it does, it's just difficult to type and I always felt like a simple `>>` would make sense as well as be easier to type. This is rather nit-picky, but I write a lot of code, so ease of syntax is actually a very important consideration for me.
* There seems to be a lot of lock-in if you want to use the CLI tools. What I mean by this is that the CLI tools, specifically `mix` seem awesome. However, it seems like that in order to use them, you need to use a very specific set of libraries. This isn't necessarily a bad thing, but I wonder if this would effect long-term flexibility.
* Did I mention the dependencies? It seems like every CLI command requires dependencies to be installed. This could be my own misunderstanding or a failing of the guide.
- enraged_camel 9y ago>>I need to have a Db installed even though the application doesn't touch a the Db? No. You can use an in-memory repo, or a flat file. Phoenix's initial configuration assumes you'll be using Postgres, but that's easy to change/remove. >>Honestly, working with ecto outside of initial model creation looks kind of nasty. I could be looking at this wrong though. Ecto is interesting. Coming from Rail's ActiveRecord, it definitely gave me a bit of trouble at first. But then I realized that was because I was thinking of it as an ORM, whereas in reality it's more like a library that maps the data in your database into data structures in your app (I say "data structures" because there are no objects in Elixir, remember). What that means is that it's functionality is not as tightly coupled to your data. Here's a more in-depth explanation (I'm not the author): https://www.amberbit.com/blog/2016/2/24/how-elixirs-ecto-differs-from-rubys-activerecord/ https://www.amberbit.com/blog/2016/2/24/how-elixirs-ecto-dif... Over time I've come to appreciate Ecto, because it forces me to think more explicitly about what data I want to fetch/insert and how. It also makes the code easier to reason about. RE: Dependencies, it's hard for me to say. I can tell you that compared to Ruby and Rails, Elixir and Phoenix are very lightweight. It's true that you need to install some of the underlying language tools such as Mix, but at the end of the day Phoenix follows a more a-la-carte approach compared to Rail's "everything and the kitchen sink" approach.