b18 factory methods

2006-09-18 Thread Piyush Purang
Hi Jerome, I am trying to migrate my work to b18. Eventhough I have to unlearn a lot, it is much nicer to work with the API. I have a suggestion to make about some o.r.data classes. For Protocol you provide the method - create, that acts as a factory method. It would be very convenient to have

RE: b18 factory methods

2006-09-18 Thread Jerome Louvel
Hi Piyush, Excellent remark. I fully agree and have started renaming existing create methods and adding new ones to CharacterSet, Encoding, Manguage, MediaType and Status. The big advantage of using this static valueOf method instead of a constructor is that an existing constant can be returned

RE: Re: How to compromise when designing a RESTful API?

2006-09-18 Thread Jerome Louvel
Hi Vincent, You are indeed asking a good question, not because you are reaching any limit of the REST/HTTP style but because you have a case where there is no simplistic separation between REST and RPC styles. At the most abstract level, REST doesn't force the use of any protocol (though HTTP

Re: How to compromise when designing a RESTful API?

2006-09-18 Thread Vincent
Think about a Resource as the Object class in Java for example: anything is an Object, whether you want it or not. Yes, but objects have state *and* behaviour. All the REST articles I’ve seen so far conveniently ignore the behaviour part by carefully choosing examples where the server does not

Re: Re: How to compromise when designing a RESTful API?

2006-09-18 Thread John D. Mitchell
On 9/16/06, Vincent [EMAIL PROTECTED] wrote: [...] On the source account, you'd initiate a transfer with the arguments being the target account and the amount. The result on success would be that specific transfer's ID. Ah, but you're not saying how you 'initiate a transfer'. It's one of

Re: Re: How to compromise when designing a RESTful API?

2006-09-18 Thread John D. Mitchell
On 9/18/06, Vincent [EMAIL PROTECTED] wrote: [...] Yes, but objects have state *and* behaviour. All the REST articles I've seen so far conveniently ignore the behaviour part by carefully choosing examples where the server does not need to perform any business logic (e.g. the ATOM protocol, which

Re: How to compromise when designing a RESTful API?

2006-09-18 Thread Vincent
Okay, so this brings up the question of how pure do you want to be? More exactly, it brings the question of what am I gaining by trying to be 100% ‘pure’? To be much more pure, you'd do this in stages: PUT to e.g.: /authinfo/account/123/transfer and get back a transfer transaction ID. Then,

Re: Re: How to compromise when designing a RESTful API?

2006-09-18 Thread John D. Mitchell
On 9/18/06, Vincent [EMAIL PROTECTED] wrote: [...] Yes, I'm starting to see that (although it seems to me that you have your POSTs and PUTs backward: shouldn't you use a POST to create the transfer transaction, and a PUT to send the tx details?). Ah, yes, this is a major bone of contention