lucasvegi / Elixir-Refactorings

Catalog of Elixir Refactorings
https://doi.org/10.1109/ICSME58846.2023.00045
MIT License
159 stars 1 forks source link

Contradictory suggestions are confusing. #3

Open RudolfMan opened 6 months ago

RudolfMan commented 6 months ago

I see that

This catalog of refactorings aims to improve the quality of code developed in Elixir, helping developers promote the redesign of their code, making it simpler to understand, modify, or even improving performance.

At the same time Introduce import explicitly calls out that it's a reverse of Remove import which is confusing.

Overall I feel the sentiment in the community is established to prefer aliases over imports for the reasons described in the remove import refactoring.

lucasvegi commented 6 months ago

Hi @RudolfMan ,

Here we revisit some points that I mentioned in the response to the other issue. A catalog of refactorings doesn't dictate rules about what is right or wrong; everything depends on the application context, which should be evaluated by the developers themselves. A catalog is like a toolbox: the choice of which tool to use is up to the user.

The example you found contradictory, of one refactoring being the inverse of another (Introduce import and Remove import attributes), is common in catalogs of refactorings, including Fowler's. For instance, Inline Method and Extract Method, which are two of the most traditional refactorings, are inverse of each other. In the catalog of refactoring we are proposing, this happens among many others as well.

lucasvegi commented 6 months ago

Overall I feel the sentiment in the community is established to prefer aliases over imports for the reasons described in the remove import refactoring.

All refactorings in the catalog were extracted from distinct sources, such as scientific articles, the 10 most popular Elixir repositories on GitHub, and publications from grey literature (often created by members of the Elixir community). At no point did we 'invent' a refactoring. As we conduct the survey, evaluations like the relevance of each refactoring will greatly help us quantify community perceptions. Therefore, it may be that within a few weeks, this feeling of yours will be confirmed (or not). 😄