Your Web News in One Place

Help Webnuz

Referal links:

Sign up for GreenGeeks web hosting
August 9, 2022 07:30 pm GMT

The most important code smells every developer has to know

In a previous post we have discussed why "clean code" is so intangible and subjective phenomenon.

Image description

We also mentioned that many common "code smells" are usually heuristics and not hard tests.

Are there any objective ways to differentiate good and bad code? Luckily, some of the original "code smells" are quite objective and hard to argue with. For example:
Mysterious Name: functions, modules, variables or classes that are named in a way that does not communicate what they do or how to use them.
Cyclomatic complexity: too many branches or loops; this may indicate a function needs to be broken up into smaller functions, or that it has potential for simplification/refactoring.
Data clump: Occurs when a group of variables are passed around together in various parts of the program. In general, this suggests that it would be more appropriate to formally group the different variables together into a single object, and pass around only the new object instead.
Too many parameters: a long list of parameters is hard to read, and makes calling and testing the function complicated. It may indicate that the purpose of the function is ill-conceived and that the code should be refactored so responsibility is assigned in a more clean-cut way.
Long method: a method, function, or procedure that has grown too large.

In the following posts I will explore every one of them, so don't forget to click "follow" button to not miss out!

cleancode #softwarecraftsmanship #programminglife #programming


Original Link: https://dev.to/dadyasasha/are-there-any-objective-code-smells-1hm6

Share this article:    Share on Facebook
View Full Article

Dev To

An online community for sharing and discovering great ideas, having debates, and making friends

More About this Source Visit Dev To