Jeff Atwood has blogged about Avoiding Dependencies
and links there to an old article
by Joel Spolsky, defending the Not-Invented-Here Syndrome
. I think that Joel has made his point well. He emphasizes on “If it's a core business function -- do it yourself, no matter what.” But I cannot agree with all of what Jeff is saying (and that’s not just because I am one of those developers “trolling downloads and experimenting with every tool listed on The Daily Grind
It is just a matter of trustworthiness. I trust in most things Microsoft produces, but I also trust on many of the third party software vendors – many of them have proven that their quality is superb. I also trust in many open source projects. You just don’t have to dive in them blindly, but you should develop evaluation skills and start with looking not only the current state but also predicting the future of the project. I can fairly quickly decide if a library looks reliable by looking at its code and by searching what other people say about it (well, I confess I have been tricked about a POP3/MIME component recently
But Jeff talks here not about OSS, but rather about commercial third party tools where you can be overwhelmed with licensing problems and patches. There is definitely a cost of getting those right, but IMHO the benefits are often greater.
Let’s say that you are developing a desktop app that has to look professional. I really don’t think you can do it in a reasonable amount of time with the standard WinForms controls. They were pretty primitive in .NET 1.1 and have slightly improved in .NET 2.0 (there are some very nice new ones). But no wonder there are hundreds of third party replacements of the classical DataGrid
. I have used a DataGrid in a real app and had to dig into Google just to complete somewhat trivial tasks. In my next project I had used third party controls which where very nice and required little or no coding for my part. Well, they have a learning curve and had some quirks here and there, but I find this acceptable. Since I have never written complex UI controls myself, I am sure that I would have spent months trying to get things the way I wanted them and the GUI would have been very hard to tweak and improve on later stages. And if you write business apps like me, your core competencies should include deciding wisely what dependencies to choose and how to manage them well. I often wonder if my coding is mostly making components and libraries play together nicely, but actually there is a lot more than it.
Even if one of your dependencies fails you consistently and you can get it fixed, you can replace any time with your self-made solution or another vendor’s. It will not be always easy but it won’t be impossible either. Just ensure that you have have covered your code with tests and that you have isolated dependencies in a way that makes it easy to drop them anytime.
Jeff also gave the MSFT Patterns as example of a giant, complex frameworks
. And probably he is right that the Enterprise Library
should be used on truly enterprise solutions, where it will pay off. The downside in using it is that you have to learn a lot. You have to get good in discovering functionality and the right way to use APIs. Another potential downside is that the next version may have breaking changes, but that pretty much sums the negatives. But while using it, you learn about good design and that will definitely pay off in the long run. You will also end up with a code that will be easily extendable, because this library is designed by pretty smart people and surely it has some desirable qualities such as orthogonality and extensibility. Actually in my current project we considered using it, but we didn’t find enough reasons to do so, and I think this was the right decision. The only problematic area in which we struggled a bit was our data access layer code, which was a legacy from another system. We should have started clean and do it by probably using the ideas and code by the Data Access Block.
But I got some refactoring practice and I feel great about it.
OK, I am going very much off topic, so if I have to sum it: Manage dependencies wisely instead of avoiding them.
P.S. You may also like to read Jon Galloway
on the topic.