[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-07-15 Thread Rishi Solanki (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15380557#comment-15380557
 ] 

Rishi Solanki commented on OFBIZ-7272:
--

Few more classes needs to be taken care or discuss;
{code}
framework/entity/src/org/ofbiz/entity/transaction/TransactionUtil.java
framework/service/src/org/ofbiz/service/ServiceUtil.java
framework/service/src/org/ofbiz/service/calendar/TemporalExpressionWorker.java
DataResourceWorker.java
ProductUtil.java
CategoryUtil.java
StartupCommandUtil.java
ICalWorker.java
JNDIConfigUtil.java
{code}

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-07-06 Thread Rishi Solanki (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15364242#comment-15364242
 ] 

Rishi Solanki commented on OFBIZ-7272:
--

[~jacques.le.roux]: Thanks for review and feedback, it is like energy booster 
for us.

[~arunpati]: I have extracted few more classes which are under discussion, I'll 
sync with you on this in next week and try to complete the effort.

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-07-05 Thread Jacques Le Roux (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15363381#comment-15363381
 ] 

Jacques Le Roux commented on OFBIZ-7272:


I reviewed all the commits, thanks for the excellent and long work!

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-07-05 Thread Arun Patidar (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15362532#comment-15362532
 ] 

Arun Patidar commented on OFBIZ-7272:
-

Hi [~rishisolankii]

I have committed all patches available on sub tickets. Please let me know if 
some classes still remains to update in this effort.

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-06-18 Thread Rishi Solanki (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337947#comment-15337947
 ] 

Rishi Solanki commented on OFBIZ-7272:
--

Thanks Pranay for the note, we have plan the same to add details on confluence. 
We will surely add details around it soon.

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-06-18 Thread Rishi Solanki (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337946#comment-15337946
 ] 

Rishi Solanki commented on OFBIZ-7272:
--

thanks!

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-06-18 Thread Pranay Pandey (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337735#comment-15337735
 ] 

Pranay Pandey commented on OFBIZ-7272:
--

Hi Rishi, Arun

I think you should add details of tickets to Refactoring Effort document here 
in Confluence.
https://cwiki.apache.org/confluence/display/OFBIZ/Framework+Re-factor


> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-06-18 Thread Rishi Solanki (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337672#comment-15337672
 ] 

Rishi Solanki commented on OFBIZ-7272:
--

[~pfm.smits]:

Quick References:

{code}
Taher,

Thank you very much for your inputs. I was thinking to do the same to add 
private constructors first then do other things. But after your reply I think 
better to pick one class at a time, and check everything for that class which 
includes removing public modifiers, method and fields. Marking classes members 
as final and all your suggestions.

We would start picking classes one by one, and check all its references and 
finally make necessary changes for each class. In that way we would be able to 
match the classes with purpose. This is better way to fix this design flaw.

Thanks!



Rishi Solanki
Manager, Enterprise Software Development
HotWax Systems Pvt. Ltd.
Direct: +91-9893287847
http://www.hotwaxsystems.com

On Fri, Jun 10, 2016 at 5:00 PM, Taher Alkhateeb  
wrote:

Hi Rishi,

I would suggest when refactoring such classes to apply everything that has
to do with visibility including:
- Removing public modifiers if not needed on class, method, and field levels
- adding private where appropriate
- marking classes, methods and fields as final where appropriate
- marking method arguments as final where appropriate

So I would consider a private constructor to be just one of a suite of
activites that I call them collectively as visibility and mutability which
are important to provide real isolation between the components with minimal
dependencies.

My 2 cents

Taher Alkhateeb

On Fri, Jun 10, 2016 at 2:22 PM, Rishi Solanki 
wrote:

> Dear All,
>
> In past we did same for CatalogWorker, ProductWorker, CategoryWorker, and
> UtilMisc classed. Now I think for all the utility, worker, helper classes
> having only static members are eligible to have an private constructor 
with
> them to make them non instantiable from anywhere.
>
> We have log an JIra and added patch for the same. So requesting you to 
take
> a look at OFBIZ-7272 for more details and share your feedback in case we
> can do the same for more classes or if any classes we have added should 
not
> be in list.
>
> Thanks for your help in advance.
>
>
> Rishi Solanki
> Manager, Enterprise Software Development
> HotWax Systems Pvt. Ltd.
> Direct: +91-9893287847
> http://www.hotwaxsystems.com
>

{code}



One old ticket id - https://issues.apache.org/jira/browse/OFBIZ-4656

> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)


[jira] [Commented] (OFBIZ-7272) Enforce noninstantiability to all Utility classes

2016-06-18 Thread Pierre Smits (JIRA)

[ 
https://issues.apache.org/jira/browse/OFBIZ-7272?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=15337632#comment-15337632
 ] 

Pierre Smits commented on OFBIZ-7272:
-

If this has been discussed on the dev ml, please place the thread of that 
discussion in the description as well.


> Enforce noninstantiability to all Utility classes
> -
>
> Key: OFBIZ-7272
> URL: https://issues.apache.org/jira/browse/OFBIZ-7272
> Project: OFBiz
>  Issue Type: Improvement
>  Components: ALL COMPONENTS
>Affects Versions: Trunk
>Reporter: Rishi Solanki
>Assignee: Arun Patidar
> Attachments: OFBIZ-7272.patch
>
>
> I have discusses this in past on mailing list, that Utility, helper, worker 
> classes which contains only static methods should not be instantiable. Also 
> we can restrict it by adding a private constructor.
> Currently OFBiz has many such classes which should have private constructor. 
> Identify all the *Worker.java, *.Helper.java, and *Util.java which do not 
> have any non static method/member are eligible for having a private 
> constructor.
> Reference why we should do this : 
> http://www.informit.com/articles/article.aspx?p=1216151&seqNum=4



--
This message was sent by Atlassian JIRA
(v6.3.4#6332)