Skip to content

Add comments to all algorithms #630

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Closed
raklaptudirm opened this issue Jul 3, 2021 · 7 comments
Closed

Add comments to all algorithms #630

raklaptudirm opened this issue Jul 3, 2021 · 7 comments
Labels
code quality Code quality improvement feature Adds a new feature help wanted Needs to be worked on

Comments

@raklaptudirm
Copy link
Member

raklaptudirm commented Jul 3, 2021

One of the main purposes of this repository is education. But for that, a comprehensive explanation of the various algorithms along with the mentioned references is required. This is achieved through well-commented code, but that is missing from many algorithms. This issue tries to start work on commenting on all the algorithms and establishing a good format for commenting. We also should check all new Pull Requests for code quality and comments.

A format suggestion for commenting:

/*
* Complete explanation of the given steps of the algorithm
* along with manual word wrapping.
*
* Using paragraphs, diagrams, and tables wherever
* required.
*
* ┌──────────┬───────┐
* |   Row 1  | Row 2 |
* ├──────────┼───────┤
* | Column 1 |  1,2  |
* ├──────────┼───────┤
* | Column 2 |  2,2  |
* └──────────┴───────┘
*
* References:
* List of references used in the above-given explanation
* from various sources.
* Each on a separate line.
* https://en.wikipedia.org/wiki/Box-drawing_character
*/
@cclauss
Copy link
Member

cclauss commented Jul 5, 2021

Is this largely duplication of https://github.com/TheAlgorithms/Algorithms-Explanation ?

@raklaptudirm
Copy link
Member Author

raklaptudirm commented Jul 5, 2021

@cclauss That is still not an excuse to have uncommented code in my opinion. But I am open to suggestions. A discussion would be welcome.

@codefuncode
Copy link

@cclauss That is still not an excuse to have uncommented code in my opinion. But I am open to suggestions. A discussion would be welcome.

True

@nimidsin
Copy link

nimidsin commented Sep 2, 2021

/*

  • Complete explanation of the given steps of the algorithm
  • along with manual word wrapping.
  • Using paragraphs, diagrams, and tables wherever
  • required.
  • ┌──────────┬───────┐
  • | Row 1 | Row 2 |
  • ├──────────┼───────┤
  • | Column 1 | 1,2 |
  • ├──────────┼───────┤
  • | Column 2 | 2,2 |
  • └──────────┴───────┘
  • References:
  • List of references used in the above-given explanation
  • from various sources.
  • Each on a separate line.
  • https://en.wikipedia.org/wiki/Box-drawing_character
    */

@cclauss
Copy link
Member

cclauss commented Sep 2, 2021

In my opinion we are much better served with self-documenting function and variable names so that the entities and intents of each algorithm are as clear as possible without comments. This means that comments should be reserved for areas where clear code is impossible.

Vertical lines and manual spacing seems like a waste of valuable developer time and focus.

@raklaptudirm raklaptudirm mentioned this issue Sep 5, 2021
11 tasks
@Sin-Sumit
Copy link

In my opinion we are much better served with self-documenting function and variable names so that the entities and intents of each algorithm are as clear as possible without comments. This means that comments should be reserved for areas where clear code is impossible.

Vertical lines and manual spacing seems like a waste of valuable developer time and focus.

True, add comments where clear code is impossible. And for writing the algorithm use respective variables, array, data structure names, so it will be easy to understand and no need to write comments at every algorithm.

@appgurueu
Copy link
Collaborator

In my opinion we are much better served with self-documenting function and variable names so that the entities and intents of each algorithm are as clear as possible without comments. This means that comments should be reserved for areas where clear code is impossible.

Vertical lines and manual spacing seems like a waste of valuable developer time and focus.

Well put. A full plain-english explanation is better left to the algorithms-explanation repo.

@appgurueu appgurueu added the code quality Code quality improvement label May 4, 2022
@cclauss cclauss closed this as completed May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
code quality Code quality improvement feature Adds a new feature help wanted Needs to be worked on
Projects
None yet
Development

No branches or pull requests

6 participants