-
Type:
Bug
-
Status: Closed
-
Resolution: Won't Fix
-
Affects Version/s: 5.2.2
-
Fix Version/s: None
-
Component/s: None
-
Labels:None
-
Environment:Win XP, MySQL
When using a *LocalServiceUtil objects methods, there are problems using the static method calls due to the complex number of parameters. For example see JournalArticleLocalServiceUtil static methods addArticle..
This causes a developer major problems:
1) Too many parameters in method calls anti-pattern
2) variant of Telescoping constructor anti-pattern - many methods doing the same thing
3) Difficulty in documenting which parms are required, and which are optional
4) Difficulty in grokking which passed values relate to which parm in method calls
5) Discerning how the multiple methods differ in signature and in their application/usage
It is my understanding that these *LocalServiceUtil classes are generated code, (hence the lack of comment JavaDoc in them).
Perhaps a better implementation would be if the code generated could implement the Builder pattern as extended by Josh Bloch in Effective Java:
See Google Books for the specific pattern, at http://tinyurl.com/dgguse
it's in the book Effective Java By Joshua Bloch Edition: 2 Published by Addison-Wesley, 2008 ISBN 0321356683, 9780321356680
This enhancement request is for the *LocalServiceUtil static methods to be re-generated using this extended builder pattern to make usage easier.
Refs:
Implementation examples and discussion: http://xavimiro.blogspot.com/2008/04/new-builder-pattern.html
and http://www.softonaut.com/2007/01/10/thoughts-about-builder-pattern/