something the elixir book i'm reading said was to give good names to the functions. i'm not sure any more how exactly they said it, but something like that.

But then they do something i've seen in pleroma too, which is using "maybe_do_thing", eg maybe_append_timeout. But i don't think that's a good name, bc i still don't know what it does. sure, it "maybe appends some timeout", but under what conditions? When can i expect it to be added and wen not? This seems like important info to me, but they force me to check the implementation details to know.

I think i'd prefer something like append_timeout_unless_no_more_quizes. This says very clearly what it's about and what the conditions are.

Maybe using the "maybe_" notation is a way to future-proof when other conditions are required later? But isn't trying to future proof your code like that also a bad habbit? Or maybe using maybe_ is some old habbit somehow, so deeply ingrained that seasoned devs, as I assume they are, don't realise this could also use an improved way of naming?

#ElixirDev

probably a lot of work, but i'm thinking about alternate database options for pleroma quetzal. postgres is fine, but what about couchdb? or riak? what if the whole system could run on an OTP cluster? i want to make local social graph analysis easy for end-user, so the data model will need to change. i like BEAM. #heropunch #theWorkshop #elixirdev
GitHub - lucasvegi/Elixir-Code-Smells: Catalog of Elixir-specific code smells

Catalog of Elixir-specific code smells. Contribute to lucasvegi/Elixir-Code-Smells development by creating an account on GitHub.

GitHub

Huh, apparently elixir can do nested maps. I didn't know that one. Since it's immutable, you can't do something like conn.assigns.user.tags = []. But it has a put_in function, such that you can do (among other things) conn = conn.assigns.user.tags |> put_in([])

As the article where I found it says: “It may feel like magic but it's just Elixir doing what it does best: blowing your mind.”

https://dockyard.com/blog/2016/02/01/elixir-best-practices-deeply-nested-maps

#ElixirDev #PleromaDev