Evaluating Enterprise Library 2.0

Because, I didn’t have an inflammatory post in nearly two days, and I’m feeling faint

Anyway, I’m working at the moment at a highly Microsoft focused client. Which means that they consider the Enterprise library as Mana From Heaven. This forced me to raise from my own pile of tools and take a look at the Enterprise Library.

I can’t say that I am overly impressed. Here is my quick summary:

Name

Opinion

Configuration

Not sure why we will need this now. There are strongly typed accessors for configuration, and they are flexible enough to do whatever I need. If I need to pull the configuration out of the database, I can do this in one line of code (using Active Record).

If I need to do complex configuration, including object graphs, I will either use a data base and Active Record, which make it a breeze, XML Serialization or just rethink what I’m trying to do.

For me, all those lengthy configuration files are death-by-XML.

Instrumentation

They mention event log, performance counters and WMI events. I’m not sure why the event log is in instrumentation, and I’m clueless with regard to WMI events, but why do we need another layer on top of performance counters?

I just did a project that required some heavy use of performance counters, and the API couldn’t really be simpler.

Object Builder

There is something very wrong in Microsoft building their own IoC container.

The Object Builder looks like a reasonable implementation of Dependency Injection and Inversion of Control container, but I don’t see any reason to use it except that it got “Microsoft” in its name.

Logging

Again, I have a problem with this, mainly because of log4net. It was there first, after all. Why do the same thing again?

Data Access

I got NHibernate, enough said

This looks like a whole lot of work to get what I have seen Oren Ellenbogen do in about five minutes and 15 LoC using delegates.

Exception Management

This one I like in concept, but not in practice. The problem that I have with this is code such as this: “if(ExceptionPolicy.HandleException(ex,”Foo”)) throw;” This presume that under some circumstance I will want to swallow an exception. This kind of stuff gives me ticks. You have no idea how big a bug-fest can get when such a thing is happening. Errors are vanished into the night, and so is sanity, soon after.

What is interesting about the exception handling is that it supposed to prevent you from leaking sensitive data to remote callers on error conditions. It is a notable goal, I just got a design problem with solving the problem this way.

Depending on the application, I would either hook an OnError event (ASP.Net) or provide a service decorator that handles this (web services / Remoting).

Beyond that, I suspect everything that has boilerplate code in it.

The real problem is that all the things that it is trying to achieve are not something that could change safely without affecting all calling code.

Caching

This one looks cool. A durable cache that survives application restarts is something very interesting. Of the top of my head, the only kind of applications that I would use this is for partially connected applications, like smart clients, etc. A cache is something that takes care & feeding, not something that you can just use without thinking about.

(Cache invalidation policies, for instance. Concurrency issues, etc. )

I would generally not bother with those issues unless I had a partially connectivity scenarios.

Cryptography

Um, why? None of the services that they offer can’t already be had from the framework in five lines of code tops.

Security

It looks nice, but I don’t know enough on the subject to talk.

 

One thing that annoys me about the Enterprise Library is that at least two of the core components are duplication of outside effort. I can think of at least two well known logging framework for .Net (log4net & NLog ), both of which existed before the Logging Application Block saw the light of day. I can’t think of all the IoC containers for .Net, and that is because there are so many of them.

I got an issue with this because it creates an artificial segmentation of the tools. As far as I can say, those tools were not created because of some need that Microsoft could not meet using the open source equivalents. Nor because of some licensing issues (like NAnt / MSBuild) since most of the IoC containers for .Net as well as log4net are free for the taking. Including for commercial use.

Print | posted on Tuesday, May 30, 2006 8:48 PM

Feedback


Gravatar

#  5/30/2006 11:58 PM Kevin White

1. Criticizing MS for not using Open Source products is kinda idiotic and tired.

2. Replacing one block with an outside tool like Log4Net is super simple.

3. The real PIA with EntLib is that after using it for a while you realize the developers are primarily concerned with WinForms applications. Despite "Enterprise" in the title, many of the blocks do not function well in a disconnected environment. The Security block is particularly brain-dead in this regard.

4. The Data Access block is really only useful to the other blocks. .NET 2.0 has much better data access objects than what's available here. Using DAAB to fetch & bind a DataSet is a total waste of time.


Gravatar

#  5/31/2006 12:40 AM Paul Wilson

You are right on the mark. EL only makes things harder than other better tools, or harder than they were to begin with. And with each release they make more things that might have been useful depend on one of the other blocks for no good reason.


Gravatar

#  5/31/2006 6:19 AM Ayende Rahien

@Kevin,
The problem of duplicating an effort for no good reason is a big one.
I wrote my own mocking framework when I found that they lacked features that I wanted.
So it is not like I'm not capable of doing this myself. The difference is that I did it because of a feature that I wanted, not because I wanted to have the exact same thing (or near enough) that has my name in it.

This is a problem because many developers will take whatever comes out of Microsoft as gospel, and suddenly you see that you are _required_ to use a certain tool because it is from Microsoft. I even got a case where I have been told "We know that it doesn't support all of log4net features yet, but it may in the next version, and it is Microsoft, so we are going with it."

And I _really_ don't see the problem with MS using open source projects where the licensing fits them. Do you?
The FTP.exe that ships with windows was not written by windows, nor was the first TCP/IP stack that Windows NT had, etc.


Gravatar

#  5/31/2006 9:14 AM WH

"This is a problem because many developers will take whatever comes out of Microsoft as gospel, and suddenly you see that you are _required_ to use a certain tool because it is from Microsoft."

I agree with you here and Im pretty tired of this. But on the other hand, is it a problem that involves MS really?

Isnt the problem the Developer(s)? There are tons of interesting framework, you mention a couple, and I find it pretty rare that people even try out those frameworks, because they dont know or understand where/how to use them. But once MS release a IoC framework its interesting and a must have.

I worked for a company a couple of years ago where I tried to introduce resharper. There was no interest in this tool as there was find/replace in vs.net, but once visual studio 2005 was released the same ppl was amazed but the refactoring tool. Seen same thing with o/r -mappers, Borland has great O/Rmapper which my boss was amazed by. He was so amazed that I had to see it so I traveled over 1000 km just to see a demo of the concept.When I got back i told he that it was the same concept that i had showed him 5 months ago. But when i showed it they told me that you dont build applications with that kind of tools. (But I did it anyway to prove and I'm not sure they still know if it uses NH)

wh


Gravatar

#  5/31/2006 4:21 PM Jeff Handley

I turned away from the Enterprise Library when it first came out because I was really frustrated with the configuration block, and all of the other blocks were relying upon it. I didn't like that I was forced into using the block in order to use anything else. I have used the Exception Management block as a standalone (from before the EL was released) and I've been happy with it in each of the 2 applications where I used it (I've only been on 2 projects in the past 3 years). With that one, we plugged it in, and forgot about it... but it has produced great results for us. I am not sure how much the EL changed that block though, because as I said, I've turned the other way.

I'm glad to hear that I'm not alone in my dislike of the Enterprise Library in general.


Gravatar

#  6/1/2006 4:21 PM RealExperience

if any of you morons had actually used Ent Lib for any amount of time (not just version 1 which everyone agrees was crappy) then you would actually have real facts instead of just Microsoft bashing conjecture and propoganda. use it for more than two days, in a real enterprise class application implementation, and then formulate your opinions on real experince not just the premise that "doing what Microsoft says is bad".

btw - if you don't like it move on or use one of the 5000 Java frameworks


Gravatar

#  6/1/2006 5:55 PM Mike Griffin

I was told to offer solutions and not just problems, so I offer this. Matt Noonan has a great system for EntLib Developers called EasyObjects.NET that make things a whole lot easier, See http://www.easyobjects.net


Gravatar

#  6/1/2006 7:47 PM Ayende Rahien

@WH,
This approach really sucks.
I like to think of those people as purposely putting the MS Blindfold, since looking around is too hard.
We will see the same thing with DLinq, I know.
Annoying


Gravatar

#  6/1/2006 7:57 PM Ayende Rahien

@RealExperience,
Have you actually read what I said?
I _am_ using it, and I don't find that it does anything special at all. I find that I can often do _much_ better by using other tools, most of them predate the EL.


Gravatar

#  6/2/2006 2:57 AM Tom Hollander

Hi Ayende -

I'm the Product Manager of Enterprise Library so I can't help myself from joining in on this discussion.

First, we have never suggested that any or all blocks in EntLib should be used in every enterprise application. We talked to a lot of customers to understand what kinds of challenges they were facing, and we know that many of the features are useful to many customers. But if you have different requirements, it may not make sense to use the blocks at all.

Second, we don't consider EntLib to be competitive to open source offerings. The comparison between the Logging Application Block and Log4Net comes up a bit, but we were originally focusing on providing a migration path and addressing the shortcomings of Microsoft's earlier Enterprise Instrumentation Framework offering. There are several features in the Logging Application Block that aren't in Log4Net and vice versa. Choose the one that works best for your requirements.

To address some of the other block-by-block comments:

Configuration: We actually got rid of the Configuration Application Block in EntLib 2.0 for precisely the reason you mentioned - .NET 2.0 now has much better configuration out of the box. We did build configuration helper classes to meet several requirements that we had in our own blocks, but we aren't positioning our config helpers as something which you should use from your own apps instead of System.Configuration.

Instrumentation: Again, this isn't a block but some helper classes we use to implement a consistent, event-driven and configuration-controlled instrumentation solution in the EntLib blocks. You can use it in your own apps if you want, but if you don't have the same requirements then it may be better just to use EventLog, WMI or Perf Counters directly.

Object Builder: Again, this isn't a block but something we built to support our code. While building both EntLib and the Composite UI App Block we realized the code could benefit from dependency injection approaches so we built some code to support it. Use it directly in your apps if you like it, ignore it if you don't care.

Logging: See above

Data Access: This block is addressing a different need to NHibernate. If you want an object/relational mapping framework, NHibernate is something you should definitely consider. The goal of the DAAB is (and always has been) to cut down on code and common mistakes (eg connection management) when writing your own data access logic.

Exception Handling: Fair points, although there are valid reasons why exception swallowing can make sense, and at least it's very explicit when you do this as it's all in one config file. The block is designed to work at any layer in your application, but it may make sense to use specific platform features if you know you are hosted in ASP.NET.

Caching: Yes, this block is most interesting in occasionally connected smart client apps. For connected apps, the ASP.NET cache is usually appropriate.

Anyway, thanks for the feedback - we appreciate it and it's how we know what to focus on in the future. Stop by at my blog (http://blogs.msdn.com/tomholl) or the EntLib community (http://practices.gotdotnet.com/entlib) any time :-)

Tom


Gravatar

#  6/2/2006 12:55 PM kevin

The moment I read the title of this post I knew you just created one of your most heated blog posts. Just mentioning Ent Lib tends to fire up a heated conversation in almost any room of .net developers.

Personally, I find programmatically interfacing with EntLib is much more succesful than completely replying on the config files and config manager. The config files are great for real quick setups/deployments of Ent Lib (and yes it does take some time to get to understand all the pieces), but once I dove into the code, I was able to create the solution I was looking for with greater ease.

The real benefit I have found is that for any project moving forward, or if at some point during an existing project, I want to switch out some EntLib functionality for a different tool (log4net for example) now I have my own interface I can program to, and very easily switch out the logging framework my application is depending on. That's the benefit of programtically interfacing with EntLib.

(dhayden has a nice article about this here: http://davidhayden.com/blog/dave/archive/2006/02/18/2805.aspx )

I know I sacrifice flexibility here by not going the EntLib config route, but the functionality the Ent Lib provides are integral pieces of an application that, after a proper development cycle, I don't see myself needing to change too often.

David Hayden has a great series on coding to the EntLib api and using EntLib 2.0 tutorials here:
http://davidhayden.com/blog/dave/category/50.aspx?Show=All


Gravatar

#  6/2/2006 1:24 PM Ayende Rahien

@Tom,
First, you seem to highly under appreciate the "It is from Microsoft" affect. Closely related to the "No one got fired for buying IBM" axiom, I guess.
Second, great response.

Now to the guts of it:
What is thought process that goes behind building something as a enterprise block, or putting it in the EntLib, versus using existing functionality from outside.
For example, what were the reasons that you choose to build your own DI framework (for internal EntLib use) instead of use one of the many existing ones?
I can guess that licensing comes into play, but what other things do you consider?
Do you see Microsoft taking advantage of OSS offering that has the same functionality?

The reason it is important is that I need to learn everything that is out there, evaluate it, and then decide what a project should use.
I'm going to have problems with DLinq when it is out, since people will want to use the Microsoft offering even when it is not appropriate (not having many to many, for instance).


Gravatar

#  6/2/2006 5:10 PM Matthew Noonan

One I don't see mentioned in the discussion about the DAAB, is the inclusion of the performance counters and WMI info. O/RMs based on the DAAB get this functionality automatically, while others would have to add this manually. It's not a knock on NH, but if you need this type of functionality, it's not trivial to add.


Gravatar

#  6/3/2006 12:59 AM Tom Hollander

Hi Ayende -

I understand the "you must use the Microsoft solution" mindset does exist. I guess we consider it a good thing if we have a reputation of coming up with good solutions, but when talking to customers I would never suggest that they shouldn't consider alternative guidance/framework offerings as well. p&p is free for customerrs, so Microsoft gets the same amount of direct revenue whether you use p&p or an open source .NET solution - so our primary interest is that you choose a solution on our platform that meets your needs and sets you up for future success. When customers ask us for new deliverables or features, we'll listen - but generally people will do this if they find alternatives such as open source don't meet their needs, whether for technical or licensing reasons.

Regarding p&p use of open source, we have a policy of not using any code unless we can verify its origin and have a appropriate license. This is necessary to protect both Microsoft and customers from knowingly or unknowingly using IP that somebody else owns. This doesn't mean we write every line of code ourselves - we have licensed and used external offerings in the past, including community projects such as Mvp.Xml and commercial offerings such as ACA.NET - but this policy does limit our options with reusing existing solutions. However we do try to design our offerings so it's relatively easy for you to replace parts of our code with alternative solutions.

Tom


Gravatar

#  6/3/2006 1:45 PM Ayende Rahien

@Matthew,
Can you explain what you mean about perf counters and WMI in DAAB?


Gravatar

#  6/6/2006 6:09 PM Miguel

This article is interesting for me since I have both used open source frameworks and created my own (Java and .NET). The truth of the matter is that if there is a tool out there that is open source and does "most" of the functionality I need, I will at least consider using it. The fact that there are choices is not bad, it can be overwhelming of course, but chances are you will feel more confortable and understand the design of one solution more than the other. I have to agree that the EL provides similar functionality that other frameworks already provide, but is this really a bad thing? I have been using 2.0 for a couple of months now and these are the things I like about it:

1) The configuration tool: This is great because it makes it a lot easier to manage your configurations. Sometimes I get tired of editing XML files and this tool is just a gift from heaven for me (Note: I am not saying Microsoft is heaven either).
2) Is extensible: I have written a couple of application blocks of my own (mostly code ported from frameworks that I wrote before) and hooking them up with other applications blocks is simple, plus I can also make them configurable with the configuration tool.
3) I still have the source: This was useful for me since I needed to GAC the EL so I created my own EL installer.
4) I can also hook up anything that is configurable via XML to the configuration tool and other application blocks: This is useful if I find that log4NET, NHibernate or Spring are a more natural choice for me.

I summary I think the EL is a good option in some cases and an excellent attempt from Microsoft to provide enterprise level tools for developers. The one thing I don't like is the way that they manage open source projects and I still think source forge is a lot better for both management and collaboration.


Gravatar

#  6/7/2006 3:52 PM gozh2002

I belive .net is only possibly thriving with more and more open source camp support, not just worse things re-invented under microsoft brand.


Gravatar

#  6/7/2006 7:13 PM hammett

"but when talking to customers I would never suggest that they shouldn't consider alternative guidance/framework offerings as well."

This is so much untrue. More than once, on Castle forum and mailing list, desperate people came pursuing help as the companies they work for was advised by MCS to replace the OSS solution with the MS' alternatives. The arguments used were like "we can't help you if you go with open source solutions", "there are no support", which is also untrue.

I had about 17 interviews at MS, long time ago, and I think I know the mindset. MS can't use existing open source solutions as they can't take the risk of promoting them and later having someone knocking at their door saying "hey, I used that 'insert oss solution here' and it was crap"

It's also hardly true that EL is proposed as just another option. Just check the EL website.


Gravatar

# Interesting Finds: May 31, 2006 AM edition 2/3/2007 7:48 AM jasonhaley.com


Gravatar

# Enterprise Library 2.0 2/3/2007 7:48 AM techies.teamlupus.hu

Comments have been closed on this topic.