Wednesday, April 17, 2013

Re: RequestFactroy dilemma when entity id is null.

Thanks Stefan. But in my opinion method with too many parameter of same type will require a developer to be more careful.

SearchAPI.lookup(Integer, String, String, String, String, String)

One has to be careful with parameter positions like 2nd is for name and so on. Although IDE like eclipse is there for little help but still we may not call it a best practice.

On Wednesday, 17 April 2013 20:06:41 UTC+5:30, Stefan Ollinger wrote:
It isnt exactly a use-case of RF to construct existing entities on the client side.
Either you create a new one, or load an existing one form the server.

Alternatively you can create a search API which expects simple parameters instead of objects:
searchApi.lookup(id, name, ..)

Putting everything in objects adds sometimes only another layer of indirection.

Regards,
Stefan

On 17.04.2013 16:22, Aryan wrote:
Thanks Jens, This is exactly how I am doing right now. I am having something like EmployeeSearchProxy extends ValueProxy for EmployeeSearch class which wraps up Employee and have an additional field for id.

But it seems to me as workaround for a perticular case which solves a perticular problem. A few workarounds are not bad but if they grew large enough, they may haunt you back in maintainance.

The real problem is control and communication which developer can do with GWT-RequestFactory framework.

If I could have said at runtime to RequestFactory
    "Hey RequestFactory, chill !!!, don't make any checks and don't throw any exception, this one is just for search purpose"

I guess it could might have been a better design and more compiling to object oriented principles.


On Wednesday, 17 April 2013 17:50:20 UTC+5:30, Jens wrote:


Is there any way I can tell RequestFactory:
    'Hey RequestFactory, chill !!!, don't make any checks and don't throw any exception, this one is just for search purpose'

Use ValueProxy instead, e.g. EmployeSearchCriteriaProxy extends ValueProxy. ValueProxies do not have an identity and RF should not care about IDs and Versions. 
At first it may sound stupid to duplicate all the methods from your EmployeeEntityProxy because you can filter all properties of your Employee but in the future you may need to filter employees based on more complex data that is not directly available on EmployeeEntityProxy.

-- J.
--

 

--
You received this message because you are subscribed to the Google Groups "Google Web Toolkit" group.
To unsubscribe from this group and stop receiving emails from it, send an email to google-web-toolkit+unsubscribe@googlegroups.com.
To post to this group, send email to google-web-toolkit@googlegroups.com.
Visit this group at http://groups.google.com/group/google-web-toolkit?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

No comments:

Post a Comment