-
Notifications
You must be signed in to change notification settings - Fork 104
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
Refactoring and formatting of the codebase #54
Conversation
data structures are initialized a lot faster this way
compatible editors can be found in EditrConfig website
Wow, this is a very large change list! it will take me a long time to go through these, since MANY files are changed... hahaha. So, please give me time for this! ;) Also, btw, some of those commits are great, but a few others I would like for them to remain as they currently are. Is there a way to selectively choose which of these to accept? |
You can pull my This is independent of this pull request, though. I don't think you can selectively accept commits through there. If you show me which commits contain undesired changes, I can try to create a new branch (and pull request) with only the changes that would be accepted to master. |
Thanks a lot Douglas!! Some of these commits are great contributions, so,
thank you very much! I'll prepare a list of the commits that I'm ready to
accept when I get back home from work later today and get back to you! :)
…On Mon, Nov 18, 2019 at 9:56 AM Douglas De Rizzo Meneghetti < ***@***.***> wrote:
You can pull my douglasrizzo:refactor to another branch of your repo,
then selectively apply my commits to your master branch using git
cherry-pick <https://git-scm.com/docs/git-cherry-pick>.
This is independent of this pull request, though. I don't think you can
selectively accept commits through there.
If you show me which commits contain undesired changes, I can try to
create a new branch (and pull request) with only the changes that would be
accepted to master.
—
You are receiving this because you commented.
Reply to this email directly, view it on GitHub
<#54>,
or unsubscribe
<https://github.com/notifications/unsubscribe-auth/AAIEJPOAU4LCZAMQ4ZYLNVLQULJMPANCNFSM4JOEAVEQ>
.
|
Hi Douglas! I have finally had time to look through this pull request in detail. I think the best would be to start with a few of these commits, and then we can look at the other ones bit by bit. So, I am going to reject the current pull request. But if you could do a pull request that includes these commits, I'll accept right away:
The following ones I want to accept, but I need time to look into them to make sure they don't break anything. So, once the previous pull request is accepted, if you could do pull requests one by one with these, I can look at them separately:
These ones I would not like to have them in the code. Thanks for the suggestions though!
|
I don't think I'll be able to create a pull request right now. I'll get our newest version of master and see if I can easily apply the existing commits to it. Otherwise, I'll have to do the work by hand, but that's no problem. Give me some time to prepare. I think you should consider the "using addAll, fill, clear, arraycopy and constructors to avoid loops" commit, because I found many instances where one data structure was simply being filled with all elements of another data structure. I believe that using built-in methods from Java may be faster than using for loops in these cases. |
Yes, the "using addAll, fill, clear, arraycopy and constructors to avoid loops" is one of the ones I want to include, but I put it in the second list, since it's one I want to look at each change, just to make sure nothing gets broken :) But yeah, take your time. Your pull request rate is really fast, hahaha. |
This PR provides a refactored and reformatted code base. Formatting was done following the Google Java Style Guide, especifically a Google-provided configuration file for Intellij Idea. The Google style was changed for 4 identation spaces instead of 2.
A
.editorconfig
file is provided to enforce the style in compatible editors and IDEs.As for the refactoring, all fixes are separated in individual commits in order to be better reviewed. I have only changed what did not seem to serve an explicit purpose. Some pieces of code seemed to exist intentionally (empty
if
andelse
statements,ArrayList
objects that are populated but never used). In these cases, I decided to not change what was present.I made sure to keep the code compatible with the oldest possible Java version (8 or 9).
The code still compiles and runs.
Here is a list of what I considered relevant to refactor:
addAll
,fill
,clear
,arraycopy
and data structure constructors to fill the structures in bulk, avoiding lots of loops;StringBuilder
where many string concatenations occur, such as when creating JSON and XML content;break
), where possible;if
,return
andswitch
statements;println("")
toprintln()
;int[] x
), instead of C-style (int x[]
);@Overrides
come first, then methods are list by usage, according to a breadth-first search);new Integer(1)
);public
andabstract
);throws
.