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

Opinion on class names #88

Closed
JanSchneider1 opened this issue Feb 27, 2019 · 2 comments
Closed

Opinion on class names #88

JanSchneider1 opened this issue Feb 27, 2019 · 2 comments
Labels
refactoring Enhancements to code quality requires discussion Needs to be talked about

Comments

@JanSchneider1
Copy link
Member

JanSchneider1 commented Feb 27, 2019

I'm currently reading 'Java By Comparison' and I noticed how hard it can be to understand code, that has really long variable/class names. I think our situation isn't as bad as it was with 'SingleEliminationTournament' or 'MatchResultVerificationRequestRepository'. But still the name 'MatchVerificationRequest' bothers me. Specially when you have the connecting parts like 'MatchVerificificationRequestRepository', I think its really hard to understand what 'MatchVerificationRequest' stands for. The class is supposed to allow the users to verify if a team has won a match, lets take a look which words of 'MatchVerificationRequest' conway meaning:

Match -> The class is about a match, but how is the match relating to this class?
Verification -> The class is about verification, but this is not what it does this class 'verifies' a match
Request -> Is request necessary? Does it add any meaning? I don' think so.

So I personally would suggest changing the name to 'verifyMatch' as it is less confussing, and directly says what the class is suppossed to do to verify a match.

This suggestion might be a bit late, but reading this book, makes me really think about how hard it would be to read our code. I kindly look forward to your opinion and if you have other names that we should disuss to change

@JanSchneider1 JanSchneider1 added refactoring Enhancements to code quality requires discussion Needs to be talked about labels Feb 27, 2019
@ccaylak
Copy link
Member

ccaylak commented Feb 27, 2019

I've already read the book a few days ago aswell as @czarnecki. We already did some kind of refactoring Issue#72 based on Java By Comparison. Those classes are named like that because they represent entities for JPA/Hibernate. The Book also mentioned that every public class should contain a comment do describe the usage for this class. But I agree that our services should be named more active, not passive like your example.

@Flo4l
Copy link
Collaborator

Flo4l commented Feb 28, 2019

Yes, we should add some JavaDos at least for the class explanation.
Like Cem said the word request describes what kind of entiy the class is so we shouldn't change it.
I think it is important to to have short names for the classes. But I also think it is even more important to give names, that are complete self explaining. verifyMatch would not express what kind of object the class is about.

@ccaylak ccaylak closed this as completed Mar 4, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
refactoring Enhancements to code quality requires discussion Needs to be talked about
Projects
None yet
Development

No branches or pull requests

3 participants