[saga-rg] Is there Factory in Java Binding?
Andre Merzky
andre at merzky.net
Wed May 17 08:30:57 CDT 2006
Hi Hidemote, Graeme,
please excuse my ignorance - as said before, I am Java
agnostic, and my question might be off target...
Hidemote mentioned the use of the factory pattern at GGF
already, and other people I know which do Java issued
similar statements.
How does that actually compare to other languages? E.g. in
C/C++, you can usually link your code against a specific
_API_ in a shared library - as long as a library implements
the same API, there is no need to recompile (just exchange
library).
Also, in C/C++ it is possible to implement an API with
plugins: so you create a thin API layer, which forwards to
dunamically loaded plugins, which can then provide different
implementations of the API calls.
The latter way is what we actually do in our C++
implementation (plugins are called adaptors though).
The difference I see is actually that in both cases, the
fact that the API is implemented by different vendors is
completely hidden on API level, w/o the need for any
additional patterns like factories.
So, is there a difference between these approaches? And if
not: what is the advantage of the factory approach?
Thanks,
Andre.
Quoting [Hidemoto Nakada] (May 17 2006):
>
> All,
>
> I have a question on the Java Binding.
> Does the current Java binding include explicit factory notion?
>
> Factory mechanism is important to
> - reuse a source code with several implementation of the API
> without modification of the code.
> - leverage several implementation simultaneously from one
> client code.
>
> One good example of factory design can be found in the Dom parser
> definition; org.w3c.dom.DomImplementation.
> When you create a Dom document
>
> - get a DomImplementation from org.w3c.dom.bootstrap.DomImplementationRegistory
> - then create a Document object using DomImplementation.
>
> This mechanism might be too complicated for SAGA, but
> I think some flavor of this is required.
>
> -hidemoto
>
>
>
>
--
"So much time, so little to do..." -- Garfield
More information about the saga-rg
mailing list