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

Code quality improvements. #3

Open
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

aman-txt
Copy link

Basically I have done 5 types of refactoring to the code to improve the overall design and code quality.

SET-1
Extract Method-> readingJavaFile(configuration) new method in java2c#mojo

RenameVariable->conversionConfigurations->conversionConfig
charsetEntry->charset
sourcePathEntry->sourcePath

customFileASTRequestor-> FileAstRequestor, same with CustomASTResolver-> AstResolver

SET-2

Extract class refactoring-> CSharpFileWriter was also printing which was out of scope for the writer so introduced new class called CSharpFilePrinter. moved 3 methods, removed unused object O from CsharpPrinter from csharp folder.

pull-up variable/method-> CSCastExpression and CSConditionalExpression both were using the same _expression variable of type CSExpression, so instead of making it redundunt, i moved that to the super class and created a getter method.

move-method -> 2 methods moved from CompilationUnitExtended.java to CSharpFileWriter, because of 2 reasons, 1st as they are getter and setter for the filke n ame, it makes more sense to keep them into the fileWriter class and the 2nd reason is that tghe methods been used there more likely then into the CompilationUnitExtended.java as getting and setting file name is more appropriate in that class.

The reason why i did that is because I wanted to contribute to any opensource and I liked your project. For academic purposes I selected this one.

In future I am looking forward to reduce code Smells in your program without affecting the actual code.

…he overall design and code quality.

SET-1
Extract Method-> readingJavaFile(configuration) new method in java2c#mojo

RenameVariable->conversionConfigurations->conversionConfig
			charsetEntry->charset
			sourcePathEntry->sourcePath

customFileASTRequestor-> FileAstRequestor, same with CustomASTResolver-> AstResolver

SET-2

Extract class refactoring-> CSharpFileWriter was also printing which was out of scope for the writer so introduced new class 					called CSharpFilePrinter. moved 3 methods, removed unused object O from CsharpPrinter from 					csharp folder.

pull-up variable/method-> CSCastExpression and CSConditionalExpression both were using the same _expression variable of type 					CSExpression, so instead of making it redundunt, i moved that to the super class and created a 					getter method.

move-method -> 2 methods moved from CompilationUnitExtended.java to CSharpFileWriter, because of 2 reasons, 1st as they 			are getter and setter for the filke n ame, it makes more sense to keep them into the fileWriter class 			and the 2nd reason is that tghe methods been used there more likely then into the 							CompilationUnitExtended.java as getting and setting file name is more appropriate in that class.
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.

1 participant