Jeremy D. Miller -- The Shade Tree Developer

Sponsors

The Lounge

Syndication

News

Advertisement

Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Evolution of a Developer (in regards to DI/IoC)

I’m putting together a new quickstart for StructureMap tonight.  In looking over my notes, I found a draft from earlier this year where I was trying to argue the value proposition of an IoC container.   I’m scrapping most of that post, but I wanted to share some thoughts on dependencies and structure in software designs.  My advice is to get yourself to bullet number 4 below in order to make your design, unit testing, and coding efforts more efficient – regardless of whether or not you use an IoC container.

I think the evolution of a developer's mindset towards structuring applications goes something like this:

  1. Just gotta make this work.  There isn't any separation of concerns.  Code responsibilities tend to fall wherever the developer happened to be in the code when he or she realized they needed something (what I refer to as stream of consciousness coding).  For myself in the late nineties, this trait manifested itself as popping open an ADO connection and grabbing an ADO recordset anytime, and anywhere, that I needed some data in the middle of a long ASP page.  I've worked in a couple different development environments and read code in twice that many since, but in my experience nothing leads to a big ball of mud faster than the combination of ASP Classic and developer carelessness.  The code worked, and that's definitely something, but large amorphous code modules tend to be difficult to troubleshoot, maintain, and modify.  Plus, they can easily lead to duplication because code isn't structured for reuse.
  2. The next stage is learning to put things in their place.  The developer has progressed enough to internalize the value of separating concerns into cohesive modules.  The developer is thoughtfully asking the question to himself or herself "where should this code go?"
  3. Wait, I've separated my concerns, but everytime I change one module changes ripple into other modules.  Each concern seems to know too much about the details and functions of other concerns.  Now we start to worry about being able to change how the system behaves by making isolated changes that impact the fewest number of modules as possible.  To make this happen we need to make sure the different modules are loosely coupled from each other.  At this point we begin to make much more use of interfaces and abstractions to reduce the coupling between modules.  We also strive to build modules that do not incorporate any knowledge of the other modules that the first module depends on.
  4. The developer is fully cognizant of dependency relationships in his or her codebase.  At this point we're ready to consider using Dependency Injection and Inversion of Control to both further encourage loose coupling and exploit the seams in our application.
  5. The developer finally learns some completely new way of building software and feels like they've started all over again at phase #2.

I think the leap from #1 to #2 is huge chasm that many developers will fail to cross in their careers, but every following transition becomes easier. 

 

The following is a partial repeat of an older post, but I think it applies here:

Coder to Craftsman

When people first learn how to write code they necessarily focus on just making the code work, with little or no thought for style or structure, and certainly no thought for the future.  Any particular piece of code tends to land wherever the coder happened to be working when they realized that they needed that piece of code -- or wherever the RAD wizards felt like dropping the code. 

I think there is an inflection point where a coder mindlessly spewing out code transforms into a thoughtful software craftsman capable of creating maintainable code.  That inflection point happens the day a coder first stops, lifts his/her nose out of the coding window, and says to him/herself "where should this code go?"  That might also lead to questions like "how can I do this with less code?" or "how can I write this to make it easier to understand?" or even "how can I solve one problem at a time?"  The rest of a developer's career is spent pursuing better and better answers to the question "where should this code go?"


Posted Tue, Nov 11 2008 10:14 PM by Jeremy D. Miller

[Advertisement]

Comments

Jim Kinter wrote re: Evolution of a Developer (in regards to DI/IoC)
on Tue, Nov 11 2008 11:21 PM

I think you're spot on Jeremy, but finding craftsmen is a daunting task. I think that it's incumbent on each of us to evaluate our work practices (individually and corporately) to continue looking for better and more efficient ways to achieve our ends. It's this ongoing personal and professional commitment to process improvement that gives us, as software pros, a certain latitude and freedom that most other (IT) pros don't have. I also believe that this is the core of the Agile movement that will ultimately [and finally] establish some credibility for our professsion, because although not perfect, when executed consistently and intentionally, in my experience, more regularly results in feature complete applications that are delivered on time and under budget...which creates a self-perpetuating loop. As a corporate ADM in a shallow talent pool, I REALLY want to see the adoption of DI/IoC, TDD, Agile, DDD, Palermo's Onion architecture, etc. take off like wildfire because these things all help me to deliver better products, more consistently. The challenge that I have is that developers who "get it" are few and those who have had he chance to actually use it are even fewer...and then trying to be picky because I don't want any egomaniacs, posers, or lone wolf personalities on the team leaves even less room to filter based on whether a candidate has made it to stage 4 or not...

Steve wrote re: Evolution of a Developer (in regards to DI/IoC)
on Tue, Nov 11 2008 11:22 PM

Thank you Jeremy - I love these type posts of yours.

As I reflect, I see those steps very clearly - the continual desire to create good code.

I ask that question all the time nowdays  - so something must be working  :)

Thanks again

Ray wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 12:47 AM

Unfortunately it seems that in big companies where software development isn't their primary offering, or where theres some organization that only does internal LOB development, most management only cares if a developer can get projects done. This ends up leaving most developers to hover around #1 and the few that are around #2 or #3 wanting to tear their eyes out with rusty ladles. In my experience, at least. Guess which one I am :-/

Jeff Doolittle wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 2:22 AM

I think a key stepping stone for me was when I began to branch out and learn how to use other dependency injection frameworks.  This really helped with grasping the  concepts of IoC and DI on their own terms, rather than in the context of a particular implementation.  I've always come back to StructureMap, but I'm working on a Compact Framework project now, and it looks like understanding other DI frameworks is now going to be a necessity for me.

www.agilification.com/.../Dependency-Injection-for-the-Compact-Framework.aspx

Evolution eines Entwicklers - Leading Edge @ .NET wrote Evolution eines Entwicklers - Leading Edge @ .NET
on Wed, Nov 12 2008 3:08 AM

Pingback from  Evolution eines Entwicklers - Leading Edge @ .NET

2008 November 12 - Links for today « My (almost) Daily Links wrote 2008 November 12 - Links for today « My (almost) Daily Links
on Wed, Nov 12 2008 4:29 AM

Pingback from  2008 November 12 - Links for today « My (almost) Daily Links

Rasmus Kromann-Larsen wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 5:15 AM

Excellent post Jeremy - you've really got those evolution steps down.

I'm guessing this can also be tied into the steep learning curve of TDD, simply because this forces you out of #1. But it's also been the one thing that has moved me the most.

Kyle Szklenski wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 7:13 AM

Hey Jeremy,

Great post, as usual. It brings back a lot of memories. I recall thinking, "Where does this code go?" in my C++ days, and deciding that it went into a global function in a header file, which modified/worked with the class that was also in that header file. As Scott Meyers says, that function should be considered part of the class interface, so I feel okay about doing it!

On the other hand, at my last place, there didn't seem to be a single coder who cared about where code went except myself. I think one possible variant that you missed, though, is the coder who evolves too quickly from 1 to 3 and goes overboard - trying to put everything into interfaces and/or abstract classes, and flaming out on the overall design of the system. Other than that, you've made me really want to try out StructureMap quite badly - I do not really use DI/IOC containers because they simply aren't necessary for what I'm working on right now, but I am definitely going to start using them in my personal projects when the time for them is appropriate!

You are an inspiring coder my friend.

Dew Drop - November 12, 2008 | Alvin Ashcraft's Morning Dew wrote Dew Drop - November 12, 2008 | Alvin Ashcraft's Morning Dew
on Wed, Nov 12 2008 9:00 AM

Pingback from  Dew Drop - November 12, 2008 | Alvin Ashcraft's Morning Dew

Ben Scheirman wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 9:28 AM

I certainly agree that most developers never make it to #2.  Why is that?  It's not that we have to try that hard to convince people that the big ball of mud is not the best way to do thinks?

Is it professional apathy?  9-5 mentality?  I'd really like to brainstorm on ideas on how to shorten this "chasm."

Good post.

Interesting posts of the week at { null != Steve } wrote Interesting posts of the week at { null != Steve }
on Wed, Nov 12 2008 9:35 AM

Pingback from  Interesting posts of the week at { null != Steve }

Jim Cooper wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 11:22 AM

I'm often struck by remarks like this one:

"make much more use of interfaces and abstractions to reduce the coupling between modules."

Use of interfaces and abstract classes can indeed lead to reduced coupling, but so many people seem to think that somehow their code is automatically better just because they've used an interface somewhere - and they quote comments like that to support their case :-)

Similarly, I've seen IoC frameworks used to replace one line of code to create an object with 20 lines of code instead. Some people don't seem to realise they are only really moving a factory from one place to another, and that there is no need if there isn't a factory in the first place.

I think these people go through some phase that you don't have in your list :-)

Karthik Hariharan wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 11:26 AM

Great post.  I agree with the major challenges involved in getting developers to cross the first chasm.

Unfortunately there is a whole group of management types who think "getting it done" is the most important thing. Subsequently this leads to those who "got it done" being rewarded for what is perceived as "heroic efforts".  This thinking keeps many developers with a strong work ethic on the wrong side of the chasm for many years.

I also feel that if you don't cross the first chasm quickly, you won't cross the second one at #3 to #4 at all.

Bryan Reynolds wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 12:33 PM

A good generalization of what happens.

Kyle Szklenski wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 1:03 PM

@Jim: That's what I was trying to say, Jim. I think that rather than an evolution, most people go through a stage of reaching equilibrium - they go back and forth before finally settling on 2 or 3. Some of us go toward 4, and hopefully everyone reaches it! But we know that just doesn't happen.

As for professional apathy, I think that's it. I've known enough people who were just "content" being the people hacking away. They have never really been interested in learning more, and they are very, very 9-5. Somehow, it made me want to quit my last job. That's why I work for Infusion now, and happily at that!

Mike Moore wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 1:22 PM

If you are at the point where you are worried about where to put your code, then you should really look at Ruby. Ruby gives you a full OO object model and allows you to put your code in the exact right spot. And you don't need a framework to manage the complexities you language introduces because it doesn't allow you to put your code in the right place. Just sayin'...

Jeremy D. Miller wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 1:51 PM

@All,

I think Mike is referring to this from Neal Ford:

memeagora.blogspot.com/.../ruby-matters-place-to-put-your-stuff.html

Evolution of a Developer « Random Code wrote Evolution of a Developer « Random Code
on Wed, Nov 12 2008 2:55 PM

Pingback from  Evolution of a Developer « Random Code

Jeremy Gray wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 3:37 PM

Great post all around, and will be promptly forwarded to my team as a reminder. That said, "Wait, I've separated my concerns, but everytime I change one module changes ripple into other modules." makes me want to say "Then you haven't separated your concerns, have you." ;)

Mike Moore wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 3:42 PM

@Jeremy Exactly right. You can find links to all of Neal Ford's "Ruby Matters" blog posts off of the Alt.NET Podcast page on Ruby's object model.

altnetpodcast.com/.../10-oop-in-ruby

Ryan Gray wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 4:42 PM

It seems like TDD plays on the instincts of coders in phase 1 - 'just get this test to pass' is sort of like 'just get this thing to work'. The problem is, you sort of have to see the bigger picture (IoC, DI, ORMing, etc.) from the outset in order to really see TDD shine. I think this is where the leadership of 'architects' comes into play; they have to say to the junior devs, 'code it this way, kid... you'll see how it all comes together later.'

Mike wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 12 2008 8:01 PM

So how do you recommend training an eager kid out of college with little or no experience to get through these steps quickly?

Doni Grande wrote re: Evolution of a Developer (in regards to DI/IoC)
on Thu, Nov 13 2008 2:44 PM

>>> So how do you recommend training an eager kid out of college with little or no experience to get through these steps quickly?

There is no quick fix other than to make mistakes, admit them, and learn from them. You can't teach experience. Ultimately you understand good code by reading and writing good code. You usually learn to write good code by writing, and rewriting lots of code. And that takes time.

If you look at the steps above, all but 1) involves active thought and effort on the part of the developer. It is hard work, but work worth doing.

WOMBAT wrote Useful Links
on Sat, Nov 15 2008 4:48 AM

Useful Links

Weekly Links #27 | GrantPalin.com wrote Weekly Links #27 | GrantPalin.com
on Sun, Nov 16 2008 2:02 AM

Pingback from  Weekly Links #27 | GrantPalin.com

Jeremy D. Miller -- The Shade Tree Developer wrote A Train of Thought – QCon San Francisco 2008
on Fri, Nov 21 2008 1:21 PM

I’ve been at QCon San Francisco most of the week, and I think I can say that content wise, it’s the best

Community Blogs wrote A Train of Thought – QCon San Francisco 2008
on Fri, Nov 21 2008 2:01 PM

I’ve been at QCon San Francisco most of the week, and I think I can say that content wise, it’s the best

Lalit kale wrote re: Evolution of a Developer (in regards to DI/IoC)
on Wed, Nov 26 2008 11:34 AM

Hi jeremy!

Excellent Post on how developer's thought process evolves!

Unfortunately,In Outsourcing world,as a developer I am forced to write a code which goes into #2 of this post.

whether in my mind,I am already advanced to #3,the problem is I got isolated and appears isolated and get those dirty looks (he is so wicked,why he want to refactor when everything is working fine and concerns are isolated!!)

Ah! Passion for writing better code is yielding me emotional storms!!

Wish somebody who understand could hire me!!

Jeremy D. Miller -- The Shade Tree Developer wrote My “Best Of” for 2008
on Wed, Dec 17 2008 9:06 PM

I haven’t been nearly as prolific a blogger as I used to be this year, so this one is going to be short

Community Blogs wrote My “Best Of” for 2008
on Wed, Dec 17 2008 9:14 PM

I haven’t been nearly as prolific a blogger as I used to be this year, so this one is going to be short

My ???Best Of??? for 2008 - taccato! trend tracker, cool hunting, new business ideas wrote My ???Best Of??? for 2008 - taccato! trend tracker, cool hunting, new business ideas
on Thu, Dec 18 2008 2:10 AM

Pingback from  My ???Best Of??? for 2008 - taccato! trend tracker, cool hunting, new business ideas

Michael S. Jones wrote re: Evolution of a Developer (in regards to DI/IoC)
on Thu, Feb 26 2009 4:37 PM

This is among my favorite blog posts of the year. You elegantly put into words what I think most experienced developers intuit regarding the progression of developers wrt loose coupling. I posted recently about loose coupling and included a reference to your post.

www.thesoftwaredevotional.com/.../loose-coupling-is-good-tight-coupling-is-the-devil.html

Add a Comment

(required)  
(optional)
(required)  
Remember Me?