đŸ§” Thread

Avatar

Share

 ‱ 

You know when a code is a bad code, you have a gut feeling, so you feel the necessity to critics that code and propose changes. Ok before doing that, let's do an exercise, why do those changes make the code any better?

Is it because you like it more and somehow that does it make better? Do you have any measurable argument that justify such a change? After a code review, the code is simpler because it is better or because you have more context?

I think we need a collection of properties we can use to express how good is a code.

I would say one thing that make a code better is understandability. Easier to understand, better the code. One property we can use is cognitive load,

if the cognitive load of a piece of code is under a threshold chances are that that code is easier to understand that one that surpass the limit. Does the code use language and team idioms? More idiomatic, the code is easier for the team to understand it.

The same happens with domain concepts, is the design influenced by domain concepts?

Another thing that could make a code better is how easy is to change that code. Here we can talk about coupling, and we can use connascence to compare one solution with another, removing subjectivity and personal preferences.

Dependencies are easy to count as well, fewer dependencies the better. I think we have some good tools to argue in a less dogmatic way, we only need to start using them. Which other do you think we can use?