Discussion:
Spring Developers Dissects XAML
Gerald Bauer
2004-12-21 05:42:23 UTC
Permalink
Hello,

Allow me to highlight Erik Radmall's analysis how XAML compares to
Spring. Erik writes:

Another area I've looked into is using Spring in a XAML world. I have
MS XAML on my system (along with MyXaml and Xamlon), and have
investigated ways to make XAML play nicely with Spring, since for
myself and many others I suspect this will be important when XAML
officially ships. It certainly makes sense for me to use XAML for
parts of my application, and I've even tested wiring my application's
entire window structure using XAML, but will realistically have to
wait for MS to release the official version to deploy it.

One inescapable conclusion of this exercise is that there is a lot of
overlap between XAML and Spring. XAML, for example, provides component
wiring and dependency resolution of object graphs like Spring, along
with event wiring like Spring, along with a bunch of other useful
features to the UI layer, like event routing that includes event
bubbling and tunneling to UI controls which Spring does not provide
(which are really UI specific).

Overall I think there are areas where XAML is really nice. You can
insert "code behind" in the XML declarations, which incidentally might
be a nice addition to Spring. There are also areas where XAML is not
so hot, with its broken XML syntax of dot notation for compound
properties, which is a design choice I find difficult to understand,
and its lack of object lifecycle semantics such differentiating
between singleton or prototype, or init-method or destroy-method
lifecycle features provided by the Spring container, which something I
was not able to find in the XAML documentation or examples. It does
not seem that XAML has been seriously considered as a platform beyond
the creation and hosting of Windows forms controls, so this does not
appear to be an oversight, rather a design choice. I should mention
that the lifecycle features Spring provides are essential to our UI
application, so replacing Spring with XAML as the container will not
work for us, and if I were to use XAML is it, I would still need to
find a way to XAML and Spring cooperate. If XAML were extended to
provide Spring's lifecycle features, then it would be an obvious
choice as a container strategy, since it would then provide the same
vital services as Spring provides my application now.

As part of the investigation I also took a look at the source for
MyXaml, and even hacked it a tad to allow the MyXaml to instantiate a
Spring object via the XAML ref="object" tag within my .xaml
definition. This was entertaining, if perhaps a little silly. It did,
however, serve to illustrate just how similar the two ideas are--that
if XAML just did X, or Spring just did Y, you could dispense with
using two overlapping technologies and simply use one. One real
possibility is to allow Spring to use its config in the same way XAML
does. I will plumb this in a bit and see what's feasible--the only
issue I see currently is there is no way to identify the main
window(s) within the Spring config, but if this issue were resolved
somehow it would be possible to use Spring in the same was as XAML.

One thing that seems pretty apparent is that XAML by itself is not a
terribly advanced or amazing technology--and it's certainly weaker in
the areas of object lifecycle semantics than Spring. One advantage it
does have over Spring is that it's going to be supported by the Big
House as a core platform, and that means there will be a slew of
integration tools and general industry support for its model, and this
is always an important consideration.

I'm still looking into the plugins idea as well, since there may be
something useful there--my only concern is not wanting to reinvent any
wheels, and consider any UI-related issues in light of the roadmap for
.NET, which includes XAML as a core strategy.

Source: http://article.gmane.org/gmane.comp.windows.dotnet.spring.devel

What's your take? Do you agree with Erik Radmall's assessment that
XAML by itself is not a terribly advanced or amazing technology--and
it's certainly weaker in the areas of object lifecycle semantics than
Spring?

- Gerald

-----------------------
Gerald Bauer
United XAML - http://unitedxaml.org
XAML Forum & News - http://xamlnews.com





------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
marc_clifton2000
2004-12-21 12:43:48 UTC
Permalink
I've only just briefly looked at Spring. Interesting project.
There are some good concepts here. A few observations reading
through the docs:

1 - the assembly name is part of the class attribute. In .NET, I've
found that a fully qualified assembly name is often necessary and
this will make the markup incredibly verbose. Using xml namespaces
to map to .NET assembly/namespaces is a lot more elegant, I think.

2 - the singleton mode in MyXaml is supported using the ref: tag.

3 - the factory idea is very interesting, though I feel that it is
inappropriate to implement the intelligence of the factory into the
parser via xml attributes. I'd much rather see it implemented as a
tag, like:

<MyFactory class="MyClass"/>

Using type converters, this construct can be embedded directly in
the object graph.

4 - the nice thing about XAML syntax is that it's easy to read the
object graph, since the tag is the class. In Spring, the tag is
always "object" and you have to look at the attributes to figure out
what class it's instantiating. Similarly, instead of using xml
attributes to set properties, a property tag is used. This seems
unecessarily verbose and upside-down.

5 - the constructor-arg tag is interesting. One of the problems
I've encountered is classes that don't support parameterless
constructors.

6 - MyXaml supports a null value assignment similar to Spring. I
don't think XAML does, BTW.

7 - the "depends-on" tag is interesting. I've found that the best
solution for handling dependencies is to implement
ISupportInitialize, rely on the MyXaml late binding resolution, and
use the ref tag to complete initialization if necessary. It's an
interesting concept, but I'm concerned that it alters the object
graph construction sequence. How is circular depends-on handled?

8 - autowire is interesting. I prefer though to explicitly set an
attribute to the fields that are auto-wired. I found that without
this attribute, I didn't know whether the field was being
initialized automatically or not, which led to a lot of confusion.
By using an explicit attribute on the field, MyXaml can also emit a
warning when a field isn't wired up.

9 - I thought the IInitializingObject was interesting. Very similar
to ISupportInitialize interface provided in .NET. In fact, in
MyXaml, I had initially (no pun intended) written a separate
interface very similar to what Spring is doing. It finally dawned
on me that ISupportInitialize was exactly what I needed and built
into .NET, so I threw out my original implementation.

10 - IDisposableObject. Why not just implement IDispose, similar to
ISupportInitialize? A separate interface doesn't really seem
necessary.

11 - the child object definition concept is interesting. There's a
couple issues here. Is the child object initialized with a deep
copy or a shallow copy of the parent's properties? Also, a similar
concept is implemented in MyXaml with styles. In XAML, the concept
can be implemented with VisualTree, I think, which allows an object
to acquire a complete object graph from a definition.

12 - Listener tag. My only comment here is that it's quite
verbose. An attribute of the event name being assigned to a class
method as the attribute's value is a lot simpler.

Well, that's my brief review. Spring is interesting but it's too
verbose for my tastes. Erik may accuse XAML of not being terribly
advanced or amazing technology, but MyXaml seems to do almost
everything that Spring does in a less verbose format, and I also
think that loading up the parser with too many smarts is not the way
to go.

What's advanced and amazing is the capabilities that you can bring
to declarative programming via the classes that the parser
instantiates, rather than putting features into the parser itself.
The parser can be extended this way (especially with the power of
type converters) and MyXaml also provides tag and attribute
extensibility along with hooking collection management. This allows
the parser to remain stable while interesting features like
factories can be implemented as extensions completely separately.

Whether Microsoft's XAML will allow this kind of extensibility is
yet to be seen. However, it's already built into MyXaml.

Marc





------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
luxorxul
2004-12-22 00:50:13 UTC
Permalink
Hello,

for those of you how don't follow along the discussion on the
Spring .NET mailinglist allow me to repost Mark Pollack's response to
Marc Clifton's comments.

Mark writes:

It is very interesting to see the overlap in more detail.

Just some quick comments, but not item by item. The verbosity of the
xml is an area to work on for sure, the Spring.Java guys are pressing
hard in that direction. I would also agree with the preferred usage
pattern not being autowire. That feature was put in primarily to be
feature complete with other java based IoC containers and we just
picked it up along the way. Just a note that we will be will be
implementing IDispose instead of IDisposableObject ;) The only thing
to clarify on Marc comments was about Spring.NET "putting features" in
the parser itself. I didn't quite follow that especially because the
example he gave about factories point #3. To have new factories you
don't need to extend or modify the core parser.

One area where the project diverege is that Spring has other
features not related, but leveraging the core object factory, such as
AOP, database, web support etc. That synergy is what differentiates
it in the Java world from other IoC offerings.

- Gerald

PS: In case you're new to Spring you can find out more online @
http://www.springframework.net





------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
marc_clifton2000
2004-12-22 01:58:58 UTC
Permalink
Hey Gerald,

where did you post my comments? I can't seem to find them on the
spring.net forum. I thought I'd have a dialog with Mark directly.

Marc





------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
Gerald Bauer
2004-12-22 04:20:15 UTC
Permalink
Hello Marc,
Post by marc_clifton2000
where did you post my comments? I can't seem to find them on the
spring.net forum. I thought I'd have a dialog with Mark directly.
Sorry for leaving out the source. I've posted a short notice to the
Spring .NET *mailinglist* to highlight your comments. See
http://news.gmane.org/gmane.comp.windows.dotnet.spring.devel You can
subscribe/unsubscribe @
http://lists.sourceforge.net/lists/listinfo/springnet-developer

- Gerald





------------------------ Yahoo! Groups Sponsor --------------------~-->
$4.98 domain names from Yahoo!. Register anything.
http://us.click.yahoo.com/Q7_YsB/neXJAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
frankhileman
2004-12-21 21:37:04 UTC
Permalink
This lifecycle management is better than ISupportInitialize?
ISupportInitialize is critical in .NET for any serialization format,
not just xml based formats

- Frank Hileman
Post by Gerald Bauer
What's your take? Do you agree with Erik Radmall's assessment that
XAML by itself is not a terribly advanced or amazing technology--
and
Post by Gerald Bauer
it's certainly weaker in the areas of object lifecycle semantics than
Spring?
------------------------ Yahoo! Groups Sponsor --------------------~-->
Make a clean sweep of pop-up ads. Yahoo! Companion Toolbar.
Now with Pop-Up Blocker. Get it for free!
http://us.click.yahoo.com/L5YrjA/eSIIAA/yQLSAA/nhFolB/TM
--------------------------------------------------------------------~->
Loading...