This question is composed of two simple ones:
-
Is the latest document on Java naming conventions, the 1999 doc available at Oracle?
-
How would you call a method whose sole purpose is to create a new instance of a complex class called, for example,
XmlError?createXmlError()?generateXmlError()?getXmlError()?
Thanks!
Get methods usually mean ‘get me the value of a field` such as;
For methods that construct and return a new object, what you’re talking about there is pretty much a
Factory. The factories in the Java API use several naming conventions;createXXXmakeXXXgenerateXXXall appear in one standard-edition factory or another.I would say use whichever makes most sense to you, and stick to it. Save
getandsetfor simple field operations though.