Repository navigation
"#1081 Removed public class modifiers" - #1082
Conversation
FridaTveit
left a comment
There was a problem hiding this comment.
This looks great @c-thornton :) There's just one more thing which can be made package private :)
| class Meetup { | ||
| private final LocalDate startOfMonth; | ||
|
|
||
| public Meetup(int monthOfYear, int year) { |
There was a problem hiding this comment.
This can also be package private :)
There was a problem hiding this comment.
Sorry for missing that one @FridaTveit, thought I got them all. Thanks for the feedback on this. I will get that one modified in a couple hours when I am in front of my computer again and modify the PR.
sjwarner-bp
left a comment
There was a problem hiding this comment.
I've just looked over your last few commits - we're so close here!
None of MeetupTest needs to change, as the JUnit tests and class need to be public - but as @FridaTveit has said, on line 8 in Meetup you can remove the public modifier. We can't make it private as it needs to be accessed by the tests (I saw you tried this and it didn't work out), but package-private should be fine 🙂
|
Thanks @sjwarner-bp for the tip. I was wondering what I was doing incorrectly there. I should have read what @FridaTveit had written better. This is a learning experience for sure. The tests are running again now so hopefully it will pass this time and we should be good. |
sjwarner-bp
left a comment
There was a problem hiding this comment.
So so nearly there! I think I was a little unclear in my last comment. 'package-private' is an access level, but to specify this level of privacy you don't need any keyword (i.e. you can delete the access modifier on line 8).
Access modifiers are super useful to restrict access to certain areas of code, and they help promote proper encapsulation! If you want to read up here is a good link 🙂
|
Doh! I should have known that honestly. Thanks for the link, I will read up on that tonight. I will make the correct change shortly and push it to my fork. Thanks for the guidance @sjwarner-bp and for being patient with me. |
|
That's no problem! Thanks for the speedy updates 👍 |
|
So one thing I just thought about @sjwarner-bp was consistency with the style. Since the Meetup method will not have a private declaration should I go ahead and remove it from the cycleToPrev method as well so that the style is consistent within the Meetup class? |
Removed package-private from Meetup method and removed private from cycleToPrev and cycleToNext methods.
|
That's a good question! While changing the Because these methods are only used in Meetup (i.e. nothing outside of their class calls them), we can keep them as Remember - package-private is more accessible than |
Per feedback on pull request #1082 added the private access levels back to these two methods.
|
Awesome, thanks for the link and the info. So I removed private from cycleToPrev and cycleToNext with the commit that I just pushed on my side. I added them back in a pushed again and the checks just finished up for this one and were succesful. Thanks for the extra guidance and patience while working with me on this pull request. |
|
Awesome! Thanks @sjwarner-bp. Now time to do some reading before tackling some other issues. Thanks for all the feedback. |
Removed public class modifiers from the Meetup.java and MeetupSchedule.java src and .meta folders.
Reviewer Resources:
Track Policies