Code quality is a critical aspect of software development, encompassing various practices and principles aimed at producing clean, maintainable, an...
For further actions, you may consider blocking this person and/or reporting abuse
Nice article, good to see AI as well. I would add code linting tools as well, that helps to maintain readability and consistency.
Iām kind of disagreeing with comments. They are optional and can be on top of everything else. We need to keep them up to code all the time, otherwise they are dangerous
agree, I don't like comments either but as I said, comments are like tour guides. This will help other new developers, especially the new Devs coming in. And it can also work like a note, so that if you come back to the code after a long time, at least you know what is for. Comments are really good, and it also gives linting for your IDE:
Just updated the comment section now for example.
That comment is proving the case for no or minimal commenting. If a getInactiveItemsOnAccount method, notice the prefix, did anything but what it says there are bigger issues at play.
Sorry for the context, here is a context:
"The function is quite old and is being used in different places. With old developers out, and with new developers on board, we felt it was important to add comments to make things clearer for everyone. š"
Good write up, just wouldn't entirely agree on comments part, it depends, but if you can make your code clear enough that it doesn't need comments, the better.
I agree with writing super readable code so that others can easily understand it, but I still think writing good comments are helpful. I want to make sure that whoever is looking through my code can quickly understand what they are looking at and then intentions behind. Sometimes, over communication isn't a bad thing in my opinion.
As long as the comment is maintained its fine, keep in mind that comments also need to be maintained when code changes, and nothing actually enforces the comment to be true, so it might be lying
So I would recommend to use them sparingly, when something really needs an explanation, for other stuff tests can be documentation
Agree It depends. I don't like comments either but as I said, comments are like tour guides. This will help other new developers, especially the new Devs coming in. And it can also work like a note, so that if you come back to the code after a long time, at least you know what is for. Comments are really good, and it also gives linting for your IDE:
Just updated the comment section now for example.
If you can properly type your methods (depends on the language), you shouldn't need those nasty @param @return comments, as they are already defined in the code, unless you're actually "typing" the code with comments :/
Yup, totally agree with you. It's true that well-typed code can reduce the need for comments in many cases. And, comments still play an essential role in programming for several reasons which can be for clarification, documentation, API library usage, maintainability, and collaboration.
It's better to reserve code comments for cases where you need to explain specific business logic/rules. At function level you should almost never need a comment, because the name and parameters should be descriptive enough themselves. If it needs further comments, its often a sign that the function needs a better name, or is trying to do too many things and should be split into smaller functions.
agree, Im going to put this above
I agree with the comment, this really important for all developer
practice, practice and practice. Build some good projects.