This is just a feeler survey to see what people truly think about a few things. Answer as you wish, but try to include any reasoning behind your statements so others can ponder your points. If you don’t know the issues that each of the topics was created to solve, you may want to look into that before answering. I wlil assume all respondees are already aware of these issues. My own thoughts follow each question.
- Is dependancy injection / inversion of control really all that it is cracked up to be? Could you live without it if you’re employer announced that all future projects would use objects with multiple constructors instead?
When I began using mvc, I was not yet aware of DI / IoC, and so used the overloaded constructor method. Things worked as intended and so I never gave it a second thought. Later, when posting some of my code, somebody mentioned that it was poor man’s DI. I researched their alternatives and settled on using StructureMap for my DI needs. Over time (a very short time I might add), the library changed drastically, even between minor releases. This was just bad practice in my book, so I recently abandoned it, taking another look at Castle. While their code is more mature, I quickly became frustrated at some similar versioning errors, and the sheer number of dependant libraries. It seems to me that all that effort and headache could’ve been avoided by simply using overloaded constructors. This isn’t to say that you wouldn’t benefit from some custom factory / cache classes, but that maybe you should make these yourself and specific to your needs.
- How often do you find a project being significantly altered such that you actually see real benefit from using an orm abstraction layer such as nhibernate?
Personally, I’ve never seen such a thing happen in the nine years I spent in the field. Without exception, when the companies I worked for designed a product for a client, it typically went through a rigorous analysis period, sometimes over a year, just on paper. By the time we, the developers got our hands on things, it was simple a matter of bashing it out using pre-built interfaces. Once delivered that was it. Support was offered, but the product never changed on a fundamental basis. Never once did I hear of anybody coming back, wanting to switch from using MS SQL to Oracle, or MySQL. It just never happened. What is your experience with this?
- Is test driven design really worth the effort?
I am personally still not really clear on this one myself, but I’ll make a stab at it. While I can see certain benefits from it, usually in the testing of logic related objects, I see no real benefit of testing interfaces and simple dto classes. In one online example of TDD, part of the SharpArch docs, they demonstrate how to develop a business entity through testing. The impact of this fell on deaf ears with me. The things they tested for were just idiotic. The first test being: can we create an instance of the class? Well, using the test before code practice, or course not! The class hasn’t been written yet. This is just common sense. On the other hand, using an interface to create a mock concrete, and testing that for logical processing of data is a grand idea. Though again, this test would seem to be better done once the interface and classes are actually written. What are your thoughts on TDD and how has it impacted your efforts?
Again, this is a “what I have done and what I think” thread. Feel free to post opinions, just back them up.