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

Refactoring #59

Open
Jecanart opened this issue Aug 17, 2021 · 1 comment
Open

Refactoring #59

Jecanart opened this issue Aug 17, 2021 · 1 comment

Comments

@Jecanart
Copy link

Hey, as a part of a software desing curse I was tasked with searching for repositories on github and give refactoring ideas to the owner/s of the project based on code smells. I read you code and the only smells that i could find were "Long Method" and "Primitive Obsession"
The importance of refactoring is that it can make the code have better organization and lower dificulty to upkeep it, for more info on refactoring, https://refactoring.guru has a lot of info on this topic.
Here are the examples of the souce code and the implementation of refactoring tecniques.

Primitive Obsession
Initial code
image
refactored code
image
image

Here "Replace Data Value with Object" was used to reduce the amount of primitive data in the Player class by combining some of the fiend in a class that can be used.

Long method
Initial code
image
refactored code
image

Here "Extract Method" was used to make the method shorter by taking some parts in the partition() method and moving them to a new method and in their place there would be a call to that method.

Your code is still good and it thaught me some things about game development so I´m gratefull that your team wrote it with proper documentation.
that´s all, thanks.

@rmaes4
Copy link
Member

rmaes4 commented Aug 18, 2021

@Jecanart Wow! This is a project I worked on in High School many years ago. I was still learning then just as I am still learning now. I completely agree with your assessment, those would be two great improvements. I have no idea how you stumbled upon this old repo but I'm glad you did. Good luck to you with your studies!

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

No branches or pull requests

2 participants