tag:blogger.com,1999:blog-2744072865491516720.post3705754907225124429..comments2023-05-03T06:35:33.259-04:00Comments on Higher Logics: Object/Relational Mapping and FactoriesSandro Magihttp://www.blogger.com/profile/05446177882449578817noreply@blogger.comBlogger2125tag:blogger.com,1999:blog-2744072865491516720.post-88503480257131735092010-11-04T22:21:38.321-04:002010-11-04T22:21:38.321-04:00I believe I added that edit over a year ago. Can&#...I believe I added that edit over a year ago. Can't even remember specifically what misleading parts I was referring to.<br /><br />Regarding your suggestions, I agree it would be ideal if the language or its runtime could optimize these cases automatically. No sense making the user specify information that is already semantically available.<br /><br />I suppose factories in the kind of data-driven programs I was thinking of could have internal mutable state modified during the construction of an object, though I haven't come across such a situation myself.Sandro Magihttps://www.blogger.com/profile/05446177882449578817noreply@blogger.comtag:blogger.com,1999:blog-2744072865491516720.post-52108283976525873222010-11-04T20:33:29.579-04:002010-11-04T20:33:29.579-04:00Saw your edit just now... not sure when you added ...Saw your edit just now... not sure when you added it, but:<br /><br />If the Factory doesn't retain any state, then every method it exposes should allow for combinator composition so that the object it materializes can be composed in terms of its facets.<br /><br />In this way speaking about Singleton's doesn't necessarily make sense; TableFactory will only need to have one instance when it doesn't retain state, because it is sealed. The combinators don't need to retain state, either.<br /><br />If state is retained, it is Monostate, due to uniquing object references based on object identities. It is not a good use case for Singleton, either.<br /><br />If anything the runtime should manage this by realizing all the methods are static and only exist to provide combinators for materializing a concrete object. If it can see that the class is sealed and the methods are static, then it can automatically apply a Singleton, possibly through a Flyweight runtime VM service.John Zabroskihttps://www.blogger.com/profile/17294832205855394228noreply@blogger.com