cess11 1 day ago

I tend to build my prototypes as single file Elixir scripts. These are sometimes rather bulky with a bunch of logic and IO modules with some helper modules on the side. It's only when I believe in the idea that I reach for phx_new and start writing tests and copying in code into a full Phoenix project.

When I started out with Phoenix I learned a lot from studying the boilerplate it can generate. If you just need a route and serve some JSON or a file on it you can turn off most of the code generation and do precisely that, in case you're sure that's what you want. I think the default being that you can immediately flesh out auth and CRUD for whatever tabular data model you want is rather sensible.

1
johnisgood 1 day ago

I typically use specific flags to "mix phx.new" that gets rid most of the files, especially JavaScript and whatnot. I am not at my PC right now and I forgot the flags, but I am sure you know what I am referring to.

I never tried starting with Elixir scripts, I will give that a try.

cess11 1 day ago

Someone linked the Plug docs elsewhere in this subthread, those show you how you can quickly launch a web server from a single file, including one with WebSocket capability.

In my opinion Elixir scripts punch way above their weight. It's trivial to pull in the same dependencies as you would in a full project and you can easily keep a set of five or ten template scripts just laying around and copy those when you want a quick start with some boilerplate for a set of dependencies that often comes in handy. You could do something similar with mix plugins but it requires a bit more effort.

johnisgood 1 day ago

Side-note: considering you like Prolog, how come you are not writing Erlang instead of Elixir?

devoutsalsa 1 day ago

I actually like Erlang, but I personally feel it has a lot of rough edges. I'd probably spend a lot of time polishing them to the point where I'd just reinvent Elixir, so I prefer Elixir for that reason alone.

The other reason I wouldn't use Erlang is that Elixir has a much more vibrant & active community. A lot of the Erlang libraries (as of a few years ago when I last looked) were quite old & there wasn't a lot of active development being doing on them. I like being able to track down answers to questions & documentation that is more current. And of course there are more likely to be off the shelf Elixir libraries available for download, too.

cess11 1 day ago

It's harder to teach to juniors with a background in stuff like JavaScript and Python. While it has a rather nice elegance and simplicity to it Erlang is a bit more demanding from a business and organisational perspective.

A clever intern with a rather shallow two year 'bootcamp' education and no work experience picks up Elixir and Phoenix in a couple of months. People with background in enterprise algolians like Java and C# can also get productive in Elixir kind of fast since it allows similar patterns.

In my experience Lisp-like languages prepare well for Erlang, and that's a very rare background where I live.

johnisgood 1 day ago

Where do you live if you do not mind asking? Europe? Western Europe, Eastern Europe?