Should an image be able to resize itself in OOP?
- by ChocoDeveloper
I'm writing an app that will have an Image entity, and I'm already having trouble deciding whose responsibility each task should be.
First I have the Image class. It has a path, width, and other attributes.
Then I created an ImageRepository class, for retrieving images with a single and tested method, eg: findAllImagesWithoutThumbnail().
But now I also need to be able to createThumbnail(). Who should deal with that? I was thinking about having an ImageManager class, which would be an app-specific class (there would also be a third party image manipulation reusable component of choice, I'm not reinventing the wheel).
Or maybe it would be 0K to let the Image resize itself? Or let the ImageRepository and ImageManager be the same class?
What do you think?