What can elixir be used for?
What can elixir be used for?
Web Dev is something of a broad category these days, in that a whole lot of things happen to have a web interface.
So for example, we use Elixir to manage the upgrade and configuration of industrial sensors. We’ve got a raspberry pi with an Elixir service on it that watches for sensors to connect, handles queueing up data files on them for upload, and then manages state machines for each sensor as they’re upgraded or conditioned.
It also has a web UI powered by phoenix channels so that it can show the status of each sensor live. So it’s sort of web dev, but it may help answer your question.
I have IRC and Discord bots, some servers that manage game servers, a static site generator, and a few more things actively running in either Elixir or Erlang right now that are not web servers.
Telephony of course
I’m using it to send messages to mod_kazoo on FreeSWITCH (but of course this is so that we can interact with it from a web front-end)
I have written a number of non-web projects including:
If Elixir doesn’t work on it right now it’s probably just a matter of time.
Forgot one… I have also done some embedded Elixir on a BeagleBone Black board.
Can you point to some good information on how to use Elixir for “day to day” scripts?
For example, I tend to write little programs and integration scripts in Linux shell or Python just because they’re so easy and they’re readily available. However, since I already have Elixir on my servers (because I have a couple of small web apps built and running there), I would like to try writing my glue programs in Elixir.
And taking that a step further, many of my scripts are fired off by cron. The simplicity is great, but I wonder if there’s some BEAM scheduler type pattern I could use with a bunch of satellite Elixir scripts instead?
For Elixir command line scripts, I’d look into escripts. I find myself writing them often (for all but the most trivial scripts) instead of bash, ruby, or python despite the erlang dependency because my productivity in Elixir is much higher. They are easy to use… the official docs are here: https://hexdocs.pm/mix/Mix.Tasks.Escript.Build.html#content and you can google to find many helpful articles and blog posts.
I guess you could look into something like https://github.com/c-rack/quantum-elixir for the cron-like functionality or just keep using cron to fire off your compiled escripts.
I think elixir could be good for developing an AI.
Perhaps. The multi-threated nature maybe? One of the really interesting things about AI development is I really think the conceptual underpinning of a language are likely to influence the personality of the AI…
Yeah I would never use something like Scala or Java for this type of work despite working as a Java/Scala consultant for many years. I always found myself reaching for Python, and I’d never, ever consider Erlang for system scripting work, no matter how enthusiastic, that would be just crazy. Elixir on the other hand, I’d happily use, it’s got really good string handling, easy to shell out to system and robust when performing concurrent tasks. Boot time is fast enough, I’d certainly consider it for use as a cron task - when it comes to that sort of stuff, it’s well enough understood that I’d rather leave the configuration to operations staff, cron is something every nix user knows well and understands.
Thank you so much. My background is in web development so I think that if I can use Elixir for web development, it would ease the transition to a new language. That would help we really understand all that the language offers and then who knows? I may decide to dive deeper!
Do you know of any other great use cases for Elixir outside of Web Development?
Elixir is a programming language for working in the Erlang ecosystem. The Erlang system is applied to any number of things where reliability (fault tolerance), concurrency and distribution are key features. Erlang was originally created for telecom systems, like phone switches, but has been applied to creating databases (e.g. Riak, CouchDB, Cloudant), online games, sports entertainment systems, systems for placing wagers, online communication systems like WhatsApp, media distribution applications… lots of things.
Now in some of those cases folks are using the Erlang language (rather than Elixir) but Elixir would be just as applicable in those cases as well.
Phoenix is the archetypal framework, written in Elixir, for creating an application with a web server. I’ve used Phoenix with Absinthe to create a web application that presents an GraphQL interface… but I’ve also used Elixir for “middle tier” systems (systems that handle the flow of information between a front-end application and a back-end system). I’ve also created utility applications that do things like scrape GitHub Repos and generate reports (scraping the repos in parallel).
Even more through the “Nerves” project you can create embedded systems that use Elixir. I have a Raspberry Pi based system I’ve been working on which interfaces with thermocouples and a fan to provide a barbecue controller (yes… you could go buy one of those, but where is the fun in that?).
So there are lots of uses outside of web development. The hallmarks of the platform are concurrency, resilience, and distribution - Elixir is a great fit for any system that needs those things.
// Have split the above two posts here from: Need Recommendation on Learning Elixir //