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

Doriane Olewicki: implementation of the two challenges #12

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

olewicki
Copy link

@olewicki olewicki commented Feb 4, 2019

Good afternoon,
Here is my implementation of the two challenges. I am a student of Bram Adams, I know you were in contact with him.
Thank you in advance for the attention you will give to my implementation. There is some comments at the beginning of the README.md about my code.
Best regards,
Doriane Olewicki

Copy link

@lbajolet lbajolet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @olewicki,

I have a few comments regarding your submission; these are general comments on the results and the quick glance I performed on your code:

  • The results are off, in terms of files, diffstat for example reports 1284 files over the 3 diff files we provide with the challenge, your challenge accounts for 921 files modified

  • In terms of indentation, 2 spaces isn't really my preference, though it is a personal choice on which I don't really have a say; however, I do prefer when code is evenly indented, and in files such as DiffResult.java, tabs and spaces are mixed, leading to weird indentation depending on the tab width (on Github for example, tabs are 8 spaces)

  • The time results are expressed using seconds, where they should be milliseconds

  • Some function calls have negative number of references, why is that?

  • In terms of organization, there is very few factorization, which coupled with the 2 spaces for indentation makes it hard for me to understand the code; nesting is quite deep also

  • I think handling errors systematically with a try/catch + print is inefficient when it comes to software reliability

  • Kudos for the Makefile

DiffResult.java Outdated
int regions = 0;
//How many line were added total
int lineAdded = 0;
//How many line were deleted totla
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Small typo here totla

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I just noticed this typo was actually already in the DiffResult.go file. I corrected it in my file.

Main.java Outdated
StartTime = System.currentTimeMillis();
System.out.println(computeAST());
EndTime = System.currentTimeMillis();
System.out.println(String.format("%s took %d s", "compute AST", EndTime - StartTime));
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I feel this was meant to be factorized; why the litteral string as format argument otherwise?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I modified my code to have a factorization at that point, as well as in the rest of the code.

@olewicki
Copy link
Author

olewicki commented Feb 7, 2019

Regarding the number of files, I corrected it and found 1248 files. The error was in my regular expression were I forgot to grab the files without extensions.

For the indentation, I forgot to verify it was uniform over the files. I am sorry for that mistake.

The millisecond error was corrected.

For the number of calls, I counted initially the number of added calls minus the number of removed calls, to have the net increase. I am not sure what the count should be so this time I put 3 versions of count, the first one counting each call (this one is the one with which I generated the results in out.txt) and two other versions are in comments and explained in the code it-self.

Regarding the factorization, I didn't put factorization at first because I thought it was readable enough. But looking back at the code I see how wrong I was and I factorized it. Now the functions are methods of the DiffResult and AstResult classes. Some instances where added to those classes to ease the use of the methods and limit the number of parameters.

I added the command "e.printStackTrace()" to the catches, which are in fact better practice than just printing the error.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants