Spring.NET QnA with Aleks Seovic and Mark Pollack

| by James Vastbinder Follow 0 Followers on Nov 07, 2006. Estimated reading time: 1 minute |

InfoQ had a chance to sit down with Aleksandar Seovic and Mark Pollack the co-creaters of Spring.NET.  Spring.NET is an application framework that brings AOP, a Dependency Injection container and data access framework to .NET.  It is not a complete port of Spring to .NET, yet it preserves the main tenets of Spring.

Aleks shares this thought on the need for Dependency Injection in .NET:

"Dependency Injection implies that an object's dependencies will be "injected" by external means. There is no need for an object to look up anything - it simply declares private fields for its dependencies and allows for them to be provided externally, either via a constructor argument or via a property setter. This makes objects very clean and reusable, and if dependencies are declared in terms of interfaces instead of specific classes, it also makes them very easy to unit test."

 Mark talks about where a developer might choose Spring.NET's data access framework on top of  ADO.NET:

"Spring.NET's Data Access Framework (Spring.Data) provides lots of added value above ‘plain' ADO.NET. One of the key components is a transaction management abstraction that allows you to easily switch between different transaction strategies, i.e plain old local ADO.NET, EnterpriseServices distributed transactions and the new System.Transaction namespace. All the strategies can be used to perform declarative transaction demarcation either via embedded attributes or non-invasive XML configuration. Our extensions to the ADO.NET framework make most ADO.NET operations a one-liner and take care of the connection/transaction resource handling - which would otherwise still require some extra work on the part of the developer in common scenarios, even with the new System.Transactions namespace."

The bottom line is Spring.NET allows developers familiar with Spring or Dependency Injection to become very productive in .NET quickly by capitalizing on a framework they are familiar with. 

Rate this Article

Adoption Stage

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Spring.NET - QnA by Pieter Greyling

"Dependency Injection"
- Raise your hands all practicants. I need to be convinced of the newness of this term. So, here goes...

"If you think about it, there is nothing new about Dependency Injection per se. "
- Is this related to when a function call has a structure address instead of a void pointer as one of it's arguments?

"I could find similar examples in older technologies as well, such as VB6 or COM."
- Gray hairs in my beard. I made the survival choice in the early '90s to Win as the better and under-marketed OS/2 took the brunt of the backlash against Big Blue. Beauty sunk. VB2/3 those days. Give D/COM/++ the hat it deserves today. A modern and relevant technology with a resilient design by perhaps the best mobile and survival oriented object framework implementors. COM remains the inspiration and parent of .NET. Without COM, .NET cannot load on Win32. .NET has still to prove that it can cross the road, stay over for the night, deal with the neighbours, and return as naive as it left the night before. All with a smile.

"However, what made Dependency Injection so popular in the recent years is the rise of lightweight containers such as Spring, Pico and HiveMind in Java, and Spring.NET, Castle, and more recently Microsoft's ObjectBuilder in .NET."
- Word-play? Lightweights with mandatory big brothers whether they be a JVM or a .NET runtime, A "nothing new" thing so old that it influenced a whole generation of popular offspring I am guilty of only having read about lately? Some code examples ?

"These containers allow you to configure object-wiring rules within your application and based on those rules they will create and wire your application's objects together, providing you with automatic dependency injection."
- Which world are we referring to? How does this handle interoperability between dissimilar factions? This surely relates only to the "protected" and custom and super modern programmed super intimate, well-known/static/designed-after the fact/non-scaleable interface handlers within the domain of the J2EE / .NET world? This can surely not relate to the real world of tightly coupled high-performance and often blundering peculiar and by historical definition distinct protocols. Sockets blasting away at each other all over the place in different-speak no matter what is at the other end? Mainframe LU6.2, DB Call Interfaces, DCOM, CGI, ODBC, Netware etc. Even if everything would be TCP/IP, how does this equate to compatible and discoverable perhaps alive object instances outside J2EE and .NET lingo?

Re: Spring.NET - QnA by David Skelly


I don't quite see what point you are trying to make here. Perhaps you could rephrase it with a little less bitterness and a little more clarity.

Re: Spring.NET - QnA by Pieter Greyling


There are many young and old programmers who could benefit from my post as it stands. Perhaps you could pinpoint an area of my post that offended you.

Re: Spring.NET - QnA by Aleksandar Seovic

Hi Pieter,

As David pointed out, it is not very clear what in the article you disagree with. If you could point us to the specific points we are making that you don't agree with, Mark and I will be more than happy to respond.

In the meantime, let me try to answer to some of the things you seem to disagree with:

1. Dependency Injection

The term itself is fairly new, and it was coined by Martin Fowler in early 2004. The containers that have made DI so popular in the recent years are also fairly new. The principle, however, is not new and can be used on any platform and in any language, as it is simply a way of designing loosely coupled OO systems.

2. .NET vs COM/DCOM/COM+/VB2-6, etc.

Without getting into discussion which one is better, which would be pretty pointless exercise, I'd just like to say that the article's intended audience are .NET developers. It was not our intention to position it as "everyone should switch to .NET" propaganda, and as far as I can tell it doesn't read that way either. Sorry if you interpreted it wrong.

3. Lightweight vs. Heavyweight

When we are saying that Spring provides a "lightweight" container, we are not comparing it to JVM or CLR. "Heavyweights" are actually EJB container in Java and COM+/MTS on the Microsoft side. All of these containers provide some services, but some are much lighter than the others, and that's where the term came from.

4. Object wiring and cross-platform interoperability

When we are talking about "object wiring", for the most part we are talking about objects on the same platform. There are ways for .NET, Java, C++ and other objects to call each other, but that usually involves some kind of proxy/stub mechanism that bridges platform differences. For example, Spring.NET allows you to create a proxy to any CORBA object, so technically you could wire objects on different platforms together by injecting proxies into your application objects.

Re: Spring.NET - QnA by Pieter Greyling

Hello Aleksandar,

First off, all kudos go to your project. Credit earned.

As I pointed out, many programmers can benefit from my post; and the follow-ons. Whether it is perceived to be left or right or not at all is up to them to decide.

Per your numbers:

1. Dependency Injection

This term is of no practical use.

All practical programmers understand it already and do not need a new name. Where I was born, making new names for old things and then selling them is a cheap way of making money one does not deserve.

Startup programmers that are already intimidated by the perceived smoke and mirrors complexity of software development in modern world should not be educated in this way.

Programmers need intelligent tools that are free of dependency on external factors like re-invention of existing terminology. I recall an English term about throwing fish (Scottish fish, Herring? (free Nordic fish?) ) in the air to distract enemies.

Writing software is difficult enough yet most of us started and are starting out to have fun whilst being creative. So we choose programming.

2. .NET vs COM/DCOM/COM+/VB2-6, etc.

It seems I made a mistake by invading a ".NET" space?

3. Lightweight vs. Heavyweight

Ths word "light" surely misguided me. Do you mean an undemanding layer over the .NET framework?

I believe it will misguide techno-informed business-oriented managers and new programmers which we value.

It leads to unrealistic expectations and then over budget projects delivered apparently on time due to pressure. After that a piece of cow-dung has to be supported by the developers due to its quirky nature and cannot be fixed without business paying even more.

4. Object wiring and cross-platform interoperability

I must admit that I have not read the Spring.NET source code and this makes me feel like an outsider. Sorry, I do have a life. This is the part I am most interested in. My previous post stands as is on this subject.

Re: Spring.NET - QnA by Aleksandar Seovic

Hi Pieter,

1. I do agree with you that terms such as "Dependency Injection" can scare new programmers, or even experienced programmers who encounter the term for the first time. However, I do think that Dependency Injection is a much better name than "Inversion of Control", which is the name that was, and to a certain extent still is, used to describe the same concept.

As for "practical programmers" not needing a new name for it, I'd agree with you if there was an old name for it. If we exclude above mentioned "Inversion of Control", which is really a much broader term, I'm not aware of an old name for the thing we are describing as Dependency Injection today.

If you are saying that you don't think we need a name at all, I disagree. Having a common name for something makes discussions much easier. Design patterns have been around for a long time, but it wasn't until GoF compiled them and gave them meaningful names that such a wide audience was able to understands them and discuss them. Short and meaningful names really do make communication much simpler.

2. I don't think you invaded .NET space at all. All I was saying is that article's intended audience are .NET developers and that we are not trying to say that .NET is either better or worse than other technologies out there. We are simply saying that the average .NET developer can greatly benefit from the services provided by Spring.NET -- that's it.

Neither Mark nor I are "territorial" when it comes to technology. I use both Java and .NET on a regular basis, because that's what most of my clients want me to use and what I'm most experienced with, but I have used many other languages and platforms in the past, and will probably use plenty more as long as I'm doing this job. As I pointed out in the article, there is no single tool that is the best choice for every job, so unless the client dictates what to use I tend to choose whatever will work best for the particular application.

3. What I mean by "lightweight container" is an undemanding, fairly simple, configurable and extensible container for application objects. So lightweight in fact that you can bring many of them up when you need them and destroy them when you don't. There is a lot of value in having objects within a container, but that's a topic for whole another article...

4. There is no reason for you to read Spring.NET source code. You can download it and try the features you are interested in for yourself. There is documentation and a few sample apps that will show you how to configure Spring.NET client to access remote EJB, or any other CORBA-compliant object using IIOP.NET integration. Keep in mind that this particular feature is more in the experimental state and there is a lot more than can and needs to be done, but it wouldn't be too difficult to do if there is more user demand for it.

Re: Spring.NET - QnA by Pieter Greyling

Hi Aleksandar, Mark,

I am not going by the numbers this time (:-)

In short, based on my experience I believe words and terms are (re-)invented too often in this industry.

Too many times this is done for the benefit of creating new business opportunities and/ or markets for the biggest guns of the time.

I have not seen the terms nor technology stick around long enough to add real value, teach better individual personal programming ability, confidence in continuity, nor provide a skills growth path that builds instead of re-inventing.

The worst is that most of the best ideas never achieve real corporate penetration. So in the longer term, they do not provide job opportunities for aspiring programmers with sustainable demand for their improving skills.

It is mostly the individuals with skin-deep knowledge on the latest hype that get a job and thus experience until the next best thing comes along.

Essentially, in my humble opinion, by far most modern code is still implemented in, at best, the same way as 20 years ago.

What has changed is the sheer number of people from all walks of life willing to write a bit of code. This has changed the world irreversibly and surely for the better.

However, this is mostly attributable to technologies that empowered individuals (for example the internet, mobiles, games etc.) and individual "nobodies" like the GPL'ers that proved everybody has the right to be a "hacker", indeed a successful one.

I honestly cannot say that I think software development practices and methods have advanced to keep pace with the challenge. It seems more of a "Wild-West" now than when I started. Not that I am personally ignorant of the allure of being a gunslinger myself.

Based on our discussion so far, perhaps I did not make a mistake posting ("invading") here after all.

At least, this is the kind of forum and the kind of post (to your credit), that corporate pioneers will be reading and thus might help to remedy some of my misgivings.

Re: Spring.NET - QnA by Srdan Srepfler

Peter, the term Dependency Injection (DI) has a justified place in the programming space. It's perhaps something that people could do since forever but they didn't. Let me try and coin a metaphor as you seem to prefer using them to technical arguments.
Before DI people were trying to build houses by concentrating on creating the best bricks. Nothing wrong with superb, technologically advanced bricks. However in those days people would have to worry a lot thinking about how well do these bricks fit together (in those days the bricks didn't fit well because every time you'd do a better, improved, different brick you'd have problems in fitting them with the old bricks),after DI they stopped worrying on how well the bricks fitted as it suddenly became easy and standard for you to connect all these different bricks so people started focusing on the building instead of the bricks.
Or, as a teacher of mine would put it, before we were thinking as westerners and trying to be reductionist, now people are starting to think as easterners and taking a more holistic view of the world.
We know that the concepts of how to implement DI are not radical, intrusive or something that wasn't possible before, but, if something changes your view of the world, it deserves a new name.
Plus, and I don't know where you live if you don't use them already, these frameworks go a long way from just doing the basic dependency injection and offer pre-made blueprints to build solid, hospitable, pretty,...,houses and it costs you less to build a house that will sell for more.

Re: Spring.NET - QnA by Pieter Greyling

Hi Srgjan,

You are right; I suppose I did open the door to more than mere technical arguments.

Re: Spring.NET - QnA by robert li

Hi Mark & Alex,
I am an .Net developer, but new to Spring.Net. You mentioned that you are writing a book for Apress. My I ask what this new book about? I, as .Net developer, really need a book for Spring.Net. If yes, when is it going to publish?

I know Manning is going to publish "NHibernate in Action" this year.

Re: Spring.NET - QnA by Aleksandar Seovic

Hi Robert,

Yes, the book is on Spring.NET and it will cover all major areas of the framework. It is a bit harder to answer when it will come out...

At the moment, we are working very hard to get the final release out, so there really isn't that much time to work on the book. Hopefully we will have more time to work on it once Spring.NET 1.1 is released, so we might be able to get it done by the end of this year.

That said, Spring.NET reference docs are fairly complete and will be a good starting point for anyone new to the framework. We are also planning a series of articles on Spring.NET for InfoQ, which should cover quite a bit of ground as well. In addition to that, we will start offering public and private Spring.NET training pretty soon as well.

Hope this helps,


Re: Spring.NET - QnA by Alessandro Gambaro

Hey guys,

Is the book ready? I couldn't fount it on the Apress site.



Re: Spring.NET - QnA by Duraid Duraid

your post is rubbish

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

13 Discuss