[diary] A Year(++) With Elixir Building Drab

or: How I Learned to Stop Worrying and Give Elixir a Try

In the last November I’ve posted here the first mention about Drab library. Let’s do some annual recap then :slight_smile: I am putting it in the lounge, as it will be more on the history and my impressions about Elixir and the community.

Dark Age

Before being a humble alchemist, I’ve spent few years building Rails apps. I like Ruby, I like Rails: when you have some experience, you may create great applications with ease and fun. But, while building an app for my current employer (an app to take over my position, as I am a kind of administrator/dba), I’ve realized that there is a stuff, which is very hard to archive with the standard html/ajax architecture. In details, it was a part of an app, which runs long-running tasks in a background, step by step, with checking a step status and generated data, and user interaction (or not, if not needed), between the steps.

Finally, I’ve made this software, but I’ve realized that the effort I’ve spent on building communication between the interface and the backend was enormous. And ridiculous. Especially the part, when the background process finished the step and should communicate it to the browser. And the background must wait for the user’s answer. Hell.

This is why I wanted to build a software to communicate from the server back to the browser. When Rails 5 comes with websockets, I’ve even started to build Drab-like thingy in Rails, but I’ve quickly realized that I will drown in threads, processes, etc. I wanted to launch a thread/procces to each event coming from the client (just like the modern Drab does) and allow it to access the UI. I gave up.

Enlightenment Age

I really like to learn new programming languages and techniques, so I was on track with Elixir, but not very deep. I’ve got it installed, done a tutorial until OTP (I remember my first though on OTP was simply: WTF?). And then I’ve read a blog or saw a video about concurrency on Phoenix. It was about spawning tons of Erlang processes with ease. That was what I needed. I decided to give Elixir a try.

After few months of reading books, doing all the available tutorials, and asking stupid questions on elixirforum, I realized that I have the basic knowledge to start building Drab on Phoenix on Elixir (I was completely wrong about my knowlege ;)). First, I’ve built a simple Phoenix app, which has only one purpose: to send any JS back to the browser and have a result back.

Then I’ve designed a simple, jquery-like API (I’ve chosen jQuery because I didn’t want to deal with JS at the time) and started to implement Drab core libraries. It was still a part of the proof-of-concept app. I’ve decided to show the POC page to the community and then decide if should continue it or not.

Why “drab”?

In Polish, which is my mother tongue, it means a ruffian, a scoundrel. The name is short, easy to pronounce for almost everybody, and meaningless in English. Yes, I didn’t realize what “drab” means in English at the time, I was too lazy to check :wink:

Golden Age

At November 16th 2016, early evening Geneva time, I’ve posted the idea of Drab to elixirforum. I was afraid of the response. Sometimes you feel you are having a great idea, but it is great only for you, but not for others. So I just asked: “is it worth to develop further, or old good Ajax is good enough for everyone, and websockets are only for chats?”

And the response from the community was friendly and uplifting. It was way more than I expected.

Community

I’ve never saw the community like this in my long live. There is no bad questions asked, there is no anger to beginners asking stupid things, it is a harmony, happiness and hearts :wink:
For the future purposes of Drab, I’ve made a PR to Elixir’s EEx library. The approval process made me happy, it was so constructive and friendly. Show me another programming language where you can modify the stdlib for your purposes with such ease!

Modern Age

After this, I’ve decided to continue working on Drab, and this is where we are now!
Drab is not jQuery dependent anymore (it was a popular request here on forum), it has a magic Drab.Live module to do a live updates of assigns, and it has 268 posts on its thread on elixirforum :slight_smile: A lot of ideas were born here (but some of them died here as well).

Future Age

There is still a lot of work on Drab, but I can solve it step-by-step. Drab core needs refactoring, as the code is ugly and unreadable and overcomplicated. I need to develop the helpers for testing user’s commander functions. Also I need to rethink the whole broadcasting stuff. And finally to provide a stable, production version in the future. So say we all!

23 Likes

Wonderful account of your Elixir & Drab journey Grych!! And likewise, it hasn’t gone unnoticed how you have been helping members getting to grips with Drab :023:

Shall I move this to Elixir Chat btw? (It’s the perfect section for things like this ;-)). This section (the Lounge) is only visible to those who unmute it from their control panel - so not everyone will see it here.

4 Likes

@grych, thank you for all effort put into this project. I will happily integrate it in future Phoenix applications.

4 Likes

I saw your job a few weeks ago,
I never used it(drab), but I pretend to use.

It’s amazing to see a guy like you in Elixir community and doing a great work alongside the community,
congratulation for the amazing work,
I expect to test it in near future and I hope that will be a production release soon

5 Likes

You should consider submitting a talk proposal to the next ElixirConf with this kind of content :slight_smile:

7 Likes

Haha, for me it is rather a kind of speech for the apres-conf beer :wink:

3 Likes

When I was looking around trying to understand if I would like elixir I came across your lib and I was like, wtf, what kind of black magic is this? And decided to use elixir and drab - in the end I haven’t yet used drab because I made some other options, but I’m still looking forward to a project where I could put it to good use - I really like the idea, and glad to see it being developed!

3 Likes