I think the question you should ask yourself. Is this class responsible for what it does? The ability to identify and share responsibility is the cornerstone of OOP. You can have a Security class with only one method that creates a random password, for example.
I think (and this is my opinion) that if a random password is used only in the register, instead of creating a private method of this class, I would separate this method from the new Security class, because I do not think that this is the responsibility of the Register class.
Also, since your application is small, it's okay to have several methods for each class.
Edit: Having seen your code, I could do some advice, but keep in mind that I do not see the whole picture.
If you haven’t done this, you should read the MVC pattern ; you may not have a view in the application, but sharing controllers with models is good practice.
Your DogFeedController is represented by the controller and GeneralFeedStrategy model. I like to end the names of my classes with what they are. For example, UserController , UserView and UserModel . I think this is all clear, but then again, this is my opinion.
I see no reason to have iDogFeedStrategy , but then again, I have not seen the whole picutre. The main applications of the interface are to ensure that a group of classes, regardless of how different they are from them, will have the same API and encapsulate the details of each class that implements the interface.
eversor
source share