Skip to content
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

What is "Java naming conventions"? #1581

Closed
yansheng836 opened this issue Oct 3, 2020 · 3 comments
Closed

What is "Java naming conventions"? #1581

yansheng836 opened this issue Oct 3, 2020 · 3 comments
Labels

Comments

@yansheng836
Copy link

Problem

I've noticed that a lot of people don't seem to notice this(Java naming conventions) during PR, so they be closed.
This problem often occurs with first-time PR and beginners (like students).

https://github.com/TheAlgorithms/Java/blob/master/.github/pull_request_template.md

All filenames are in all uppercase characters with no spaces or dashes.
All functions and variable names follow Java naming conventions.
All new algorithms have a URL in its comments that points to Wikipedia or other similar explanation.

Suggestion

Git a example for "Java naming conventions".

Here are two examples:

@yansheng836
Copy link
Author

yansheng836 commented Oct 3, 2020

Some conventions for java(use https://github.com/TheAlgorithms/Java/blob/master/Conversions/HexToOct.java for example):

  • Java filename should use .java as the file suffix, like HexToOct.java, not HexToOct.

  • All filenames are in all uppercase characters with no spaces or dashes.

    like HexToOct.java, not hexToOct.java, hextooct.java, Hex-To-Oct.java, Hex_To_Oct.java.

  • All new Java files are placed inside an existing directory.

    The HexToOct.java is in Conversions directory, import the package in the line one, like package Conversions;.

  • The plbuic class name should the same as the filename, like HexToOct.java --> public class HexToOct {, not public class OtherClassName{.

  • It is best to use a special method to implement the algorithm and the main method to test it. (In HexToOct.java)The hex2decimal() and decimal2octal() implement the algorithm, main method test it.

  • Add appropriate comments. Good code doesn't need comments if you're confident in your code. But more often than not, that's not possible. If this new algorithm is simple, then it may have been implemented already(please search directly in the repository). This is not new. Algorithms are generally complex, so it is necessary to add comments.

@stale
Copy link

stale bot commented Mar 20, 2021

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale label Mar 20, 2021
@stale
Copy link

stale bot commented Jun 29, 2021

Please reopen this issue once you add more information and updates here. If this is not the case and you need some help, feel free to seek help from our Gitter or ping one of the reviewers. Thank you for your contributions!

@stale stale bot closed this as completed Jun 29, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant