Phoenix isn't Rails

I don't know Elixir very well at all. But I've started to learn Phoenix now. The first thing to know: Phoenix is not Ruby on Rails (nor is it "Elixir on Rails").

I began my learning experience by dutifully crunching through the tutorial and making my share (at least) of newbie mistakes. (Disclaimer: I'm not a web guy. I don't natively "think" in those terms and perhaps never will.)

At some point in the hello-world example, I stopped and did a count of the files under my tree. It will become clear in a moment why this was a little naive and careless.

At any rate, I think find . | wc -lreported 11,648 files to me. I found this a bit confusing and puzzling, and I didn't think it through.

I chatted with Chris McCord and another guy I don't think I've met. This is a summary:

    hal_9000: chrismccord: I have a question about the philosophy/design 
              of phoenix - if you have time/inclination and the answer is not too involved
    chrismccord: hal_9000: shoot
    hal_9000: first of all, i’m not a web guy - i’ve played with rails and several 
              other things - wrote a few small apps.  One thing that appealed to me 
              about Sinatra was how “lightweight” it was compared to Rails — you can 
              write a primitive Sinatra app in a single file.
    hal_9000: i “sort of” expected that Phoenix might be that way — but a find piped 
              to wc showed me that a hello-world app has more than 11,000 files in it. 
              why in general is that?
    chrismccord: hal_9000: remove the node_modules folder and re-run ws
    chrismccord: it's all nodejs for the asset building
    chrismccord: hal_9000: we are lightweight. It's a misconception I have to keep correcting. 
                 We are much closer to sinatra than rails

    hal_9000: hmm, i don’t even know nodejs of course
    hal_9000: chrismccord: thanks, i had a feeling i was missing something for sure

    chrismccord: hal_9000: you could write an app in a single file, but no-one does that, 
                 because we don't write production software in a single file
    chrismccord: hal_9000: It is also worth mentioning there is also nothing global in 
                 phoenix. We are not a monolith like rails
    jeregrine: hal_9000: something to keep in mind here is that phoenix assumes you are 
               writing production software. Eventually you will need to touch every file, otherwise 
               it wouldn't generate the file 
    hal_9000: chrismccord: ok, thanks, i will look more closely. i’m impressed with what i see
    jeregrine: hal_9000: if you are like me and have used sinatra for production software you 
               probably discovered you ended up writing a slightly smaller version of rails 

    hal_9000: jeregrine: that makes perfect sense
    jeregrine: hal_9000: if you only need a single route/api call, and are certain it will never grow, 
               you could VERY easily get away with just plug and it's router
    jeregrine: hal_9000: for reference.
    hal_9000: chrismccord: i grasp it now, sorry for the noise  

    jeregrine: hal_9000: lemme know if you have any questions, this is something we need to be better at 
               communicating. We are not rails

    chrismccord: hal_9000: no worries. Sorry if my response was rash too. I just have to fight a lot of 
                 "phoenix is bloated" comments because people assume it is given my Rails background and 
                 the comparisons with rails

    hal_9000: chrismccord: no, your response was not rash at all

So first of all: I didn't pay attention to what I was doing when I did my file count.

But the real takeaway here is: Phoenix isn't bloated, and more importantly, Phoenix isn't Rails. The philosophy seems to be more "minimalistic" as I had hoped.

And of course, we all know that Elixir isn't Ruby. I won't belabor that point.

On the other hand, I do find (so far) that Plug is a lot like Rack. That's a good thing, because I always thought Rack was sheer genius. More on that as I learn.

Back Home