darkma773r commented on pull request #116:
URL: https://github.com/apache/commons-imaging/pull/116#issuecomment-963083902


   @kinow
   
   I agree with @gwlucastrig, that we should try to keep the API simple. It 
might be helpful to take a step back and enumerate all of the use cases the API 
should cover and then decide how they should be handled. Below is what I see 
(from my limited perspective) as the main use cases. Please add any I've missed.
   1. The user wants to read/write an image and does not know or care about the 
format.
   2. The user wants to read/write an image and does not know the format but 
wants to apply some format-specific parameters if applicable.
   3. The user wants to read/write an image in a specific format.
   
   For the first use case, I think @gwlucastrig's idea of removing 
format-specific parameters from `Imaging` applies. The caller would use the 
`Imaging` class and then either pass no parameters or pass a very basic 
`ImagingParameters` instance.
   
   For the second use case, I think the responsibility for creating the correct 
parameters object could fall to the user. For example, the user would use 
`Imaging.guessFormat()` to get the format and then use the format-specific 
parser directly to access additional features. The `Imaging` class would not 
play a role after the initial determination of the format.
   
   For the third use case, I think users should use the format-specific parser 
directly. 
   
   So, what I'm picturing basically boils down to this:
   - Do you want to read/write images and only care about the most basic of 
image parameters? Great! Use `Imaging`.
   - Do you want to read/write images in a specific format and access low-level 
format features? Cool. Use the parser for the format.
   
   This approach would remove some of the design headaches we keep running into 
with `Imaging`, where we're trying to allow access to format-specific features 
from generic code. If we can agree on how the API should address these use 
cases then we can move on to deciding how to make the API readable and 
user-friendly.


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to