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

Git and Java Conventions #8

Open
annoy-o-mus opened this issue Feb 1, 2024 · 3 comments
Open

Git and Java Conventions #8

annoy-o-mus opened this issue Feb 1, 2024 · 3 comments

Comments

@annoy-o-mus
Copy link

The first question is regarding the git commit message subject
I want to follow the commit message subject styling Here, in addition to those mentioned in the SE-Education.

In it I add a commit type to each commit, and then capitalising the first letter of the description that follows.
Which essentially transform commit messages from

Add input handling
Update installation guide
Shift processing to Processing class

to

feat: Add input handling
docs: Update installation guide
refactor: Shift processing to Processing class

I would like to ask if this is allowed or is it not advised.

The second question is regarding Java styling conventions.
Should there be a space before the left brace of the array initializer, i.e

int[] X = new int[] {1, 3, 5, 6, 7, 87, 1213, 2};
int[] empty = new int[] {};

instead of

int[] X = new int[]{1, 3, 5, 6, 7, 87, 1213, 2};
int[] empty = new int[]{};
@adamzzq
Copy link

adamzzq commented Feb 1, 2024

... the array initializer, i.e.

int[] X = new int[] {1, 3, 5, 6, 7, 87, 1213, 2};
int[] empty = new int[] {};

Sorry I just wanted to tag along with your question as I have a closely related one.
Java seems to allow a shorter syntax for array initialization: int[] X = {1, 2, 3};, which I feel is more readable than the one with new int[]. I wonder which one is preferred in this course?

@okkhoy
Copy link

okkhoy commented Feb 1, 2024

Git convention: you are allowed to use prefixes in the commit message as per the example stated.

Java: Should there be a space before the left brace of the array initializer ...
Yes. For things not explicitly mentioned in the coding standards, we will follow the Google style guide. Though not explicitly mentioned, you can see the spacing is the same as what is asked.

For array initialization, you can use either method. There are no restrictions.

@okkhoy
Copy link

okkhoy commented Feb 4, 2024

reopening as PSA.

@okkhoy okkhoy reopened this Feb 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants