You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@ofbiz.apache.org by Suraj Khurana <su...@hotwax.co> on 2020/05/16 07:30:00 UTC

XML to Groovy conversions

Hello team,

Recently we are working on a major refactoring task of minilnag to groovy
conversion, which is commendable. I would like to add following points to
be taken into consideration while doing the exact changes in the service:

- Check and think of possible conversion to entity-auto.
- Handle service error responses, in xml usually we skip it. It would be
great if while conversion if any service is called, its error response
should be effectively handled. Like in a single line:

serviceResult = run service: "createCustomer", with: parameters
if (!ServiceUtil.isSuccess(serviceResult)) return
error(serviceResult.errorMessage)

- Avoid unnecessary declaration of variables and the same 'serviceResult'
map can be re-used in case of multiple service calls inside the same
service.

IMO, these are very small best practices that can directly be taken care of
while conversion, will improve code quality.

Please share your thoughts on this.

--
Best Regards,
Suraj Khurana
Senior Technical Consultant

Re: XML to Groovy conversions

Posted by Jacques Le Roux <ja...@les7arts.com>.
Hi Suraj,

Thanks for your suggestions, I want to add an obvious one:

Please test your changes, at least manually or by adding JUnit tests.

OFBIZ-11986 is a good example of what needs to be done else after  :/

I was actually looking for a recent more complaining message on the same subject but I could not spot it. I guess I confused with your which is not 
really complaining :)

Jacques

Le 16/05/2020 à 09:30, Suraj Khurana a écrit :
> Hello team,
>
> Recently we are working on a major refactoring task of minilnag to groovy
> conversion, which is commendable. I would like to add following points to
> be taken into consideration while doing the exact changes in the service:
>
> - Check and think of possible conversion to entity-auto.
> - Handle service error responses, in xml usually we skip it. It would be
> great if while conversion if any service is called, its error response
> should be effectively handled. Like in a single line:
>
> serviceResult = run service: "createCustomer", with: parameters
> if (!ServiceUtil.isSuccess(serviceResult)) return
> error(serviceResult.errorMessage)
>
> - Avoid unnecessary declaration of variables and the same 'serviceResult'
> map can be re-used in case of multiple service calls inside the same
> service.
>
> IMO, these are very small best practices that can directly be taken care of
> while conversion, will improve code quality.
>
> Please share your thoughts on this.
>
> --
> Best Regards,
> Suraj Khurana
> Senior Technical Consultant