Hi David,

> The problem that I had highlights a common problem for me with the  
> Restlet API:  It doesn't follow the "standard" structure for 
> Java APIs  
> where getters and setters are used for data.  It is rather 
> unintuitive  
> (at least for a Java coder) to use a getter to access a data 
> structure  
> that is modifiable in place.  It would have saved me quite a 
> few hours  
> when working with Restlet if the syntax were more like:
> 
> Cookie cookie = new Cookie("PreferredLanguage","en-us"));
> request.setCookie(cookie);

This might seem simpler and more intuitive at first sight, but how do you
deal with several cookies, how do you iterator over them, add several ones
in a single call, etc. If you add new methods you end up writing a façade to
an internal collections object. When you consider the fact that there are
several collections on a Request object, you end-up bloating your class. 

So, I prefer to have a deeper graph of objects and leverage the existing
data structures directly. That's a design tradeoff, it might not be widely
used but it seems good to me.

Any other opinions?

Best regards,
Jerome  

Reply via email to