
Hi Thilo, all, I find the session.createXYZ slightly more beautiful, but I think that both approaches are perfectly fine, and I think that the second version is actually more consistent... Cheers, Andre. Quoting [Thilo Kielmann] (Feb 27 2008):
All,
from this week's meeting on the Java language binding, there is one issue left over that (to me) sounds like a matter of taste...
For all object factories, we have two flavors, one with an explicit Session parameter, and one with an implicit (default) Session.
Example:
with the implicit default Session:
File file = FileFactory.createFile(....);
for the explicit Session parameters, there are two proposals:
(a) have the create* methods in the factory classes, resulting in two create* methods each, with slightly different signature (Session parameter or not)
example:
File file = FileFactory.createFile(session, ....);
(b) make the Session class also a factory and add all the create* methods there.
example:
File file = session.createFile(....);
None of the people I've asked so far seems to have a strong opinion on this. Personally, I have a slight bias towards (a) as it seems to be conceptionally simpler. (objects are always created by the factories...) Also, that's as it is in the current language binding.
I hereby suggest that we keep it "as is" unless somebody can convince us of the superiority of option (b). (Of course, we will change once convinced ;-)
Regards,
Thilo
-- "We've got too much time to waste to stand around here doing things." - Tigger