mmport80

mmport80

Obviously I am playing devil’s advocate a litte - but -

I see incredible power when using abstract code. One can do a lot in a little space, pick out bugs easily, etc.

Sure, explicitness is good when you are learning.

But when you want write something reliable and maintainable you probably should be reaching for a suitable abstraction and that means explicitness is kryptonite in such cases.

What do you think?

Most Liked

josevalim

josevalim

Creator of Elixir

I think you would have to first define what is explicitness.

Some could say that managing your own memory is very explicit but I am sure we would collectively agree that we don’t want to allocate memory by hand. Doing so would get in the way of other things, such as your business logic.

Explicitness is not about lacking abstractions. Often those things go together: macros are a high form of abstraction, so we want their use to be explicit.

Explicitness is not about outlining all of the configurations to a function or a library instead of relying on good defaults. It is not against convention over configuration.

Explicitness is about making the choices clear when we believe those choices matter. It is about readability. We use explicitness when we believe omitting information is harmful to the understanding of the software compared to clearly spelling it out.

We will likely agree on many things that need to be explicit but others things will be guided by opinions and/or personal experience.

13
Post #4
LostKobrakai

LostKobrakai

For me explicitness is not about “not using abstractions”. It’s that the code I use is explicit in what it does (no matter how abstract it is) and it does not do anything I don’t expect. Take elixir macros for example. I don’t need to know how a macro is implemented to have a macro, which is explicit in what it does. E.g. in a project of mine I’m using macros to setup breadcrumb texts/urls. I still need to supply url/title/parent in the macro for a page, which is the things I need to deal with, but how the elements of the breadcrumb are build up and merged is hidden in the macro. Compare that to an implicit calculation from e.g. a module name. There I’m bound to a naming schema or something and can no longer explicitly set e.g. a different parent. I’d consider both “abstract” ways to build up a breadcrumbs list, though.

Also a functional language goes a long way here, as side effects are not littered all over the place to begin with, so the chance for unexpected results is smaller than in oop.

michalmuskala

michalmuskala

I would say that in general, macros belong to libraries. There are very few cases where I would consider defining a macro in an application.

For libraries my rule of thumb is to first define an interface of only functions and data structures and then evaluate if it needs macros to make it less verbose or nicer to use. The important bit is that macros shouldn’t be the first thing you start with. This leads to a much more flexible design.

Last Post!

mmport80

mmport80 OP

good pt!

Where Next? Top

Trending in Discussions Top

AstonJ
As the title says, please share what you’ve been up to with Elixir. Whether that’s been learning it, looking into it, making stuff with i...
2977 92995 915
New
cblavier
Hey there, It’s been more than a year since we started using LiveView as our main UI library and building a whole library of UI componen...
New
caslu
I want to open this thread for you all to discuss and help those who really like Ash but are still hesitant to use it in a real project. ...
New
mudasobwa
I am happy to introduce the very α version of the new programming language compiled to BEAM. Welcome Cure. It has literally three kille...
New
GES233
I’m posting this in response to Jose’s recent tweet (Cr. link) : People are sleeping on Elixir for a coding harness: Hot-code swappi...
New
marciol
It would be helpful to have a list of companies worldwide that hire engineers without prior experience in Elixir. Often, it can be quite ...
New
durvia
Anyone running long-lived stateful processes on BEAM? We’re building an AI agent runtime and would love to compare notes. We’re a small ...
New

Other Trending Topics Top

marciok
Hi there! We created Gust: A task orchestrator inspired by Airflow. For those who have never heard about Aiflow, it’s a Python-based wor...
New
jimsynz
Beam Bots (or just BB for short) is a framework for building fault-tolerant robotics applications in Elixir using familiar OTP patterns. ...
New
Dmk
Xamal is a deployment tool for Elixir apps that deploys native releases to bare metal servers over SSH. It’s a port of GitHub - basecamp/...
New
Damirados
Hello everyone. After busy few months I am happy to announce v0.1.0 of Emerge & Solve. They are GUI (Emerge) and State management (S...
New
netoum
Corex is an accessible, unstyled UI component library for Phoenix that integrates Zag.js state machines using Vanilla JavaScript and Live...
New
webofbits
Aludel - LLM Evaluation Workbench Aludel is an embeddable Phoenix LiveView dashboard for evaluating and comparing LLM prompts across mult...
New

We're in Beta

About us Mission Statement

Options

Thread Display Mode




Thread Preview

Skip Thread Previews