A full stack engineer looking to get more people interested in programming and specifically get more Sikh girls interested in how to program. Writing at http://davi.codes
There are certainly scenarios where writing comments can be useful, though I would also argue that you should not use comments as a cruch. Anywhere your logic is complicated by all means write a comment, but if your logic is not complicated you should focus on giving the write name to your function. For example.
/**
* Applies filters in the following order if they are set
* Date -> Category -> Sub-Category
* @param filterObj {
* date: asc | dsc,
*. cat: asc | dsc,
*. subCat: asc | dsc
*. }
*. @return filteredList
*/functionapplyFilters(filterObj=null)
But comments don't make much sense in the following example
functionfilterListByDate(isAscending=true)
First preference in my opinion should be to name things properly, use the single responsibility principle as much as possible and then if logic is still complicated then add comment.
For further actions, you may consider blocking this person and/or reporting abuse
We're a place where coders share, stay up-to-date and grow their careers.
There are certainly scenarios where writing comments can be useful, though I would also argue that you should not use comments as a cruch. Anywhere your logic is complicated by all means write a comment, but if your logic is not complicated you should focus on giving the write name to your function. For example.
But comments don't make much sense in the following example
First preference in my opinion should be to name things properly, use the single responsibility principle as much as possible and then if logic is still complicated then add comment.