Devlico.Us
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @devlicious

Tim Barcz

Why use nails when a screw is the more reversible choice? Have Twitter, follow the conversation there at @timbarcz


Flattening The Learning Curve - Your Input Needed

Roy Osherove is one of my favorite .NET personalities.  Having had the chance to spend some time with him in Seattle this past April at the Alt.NET conference I came to see him as someone who is very well thought out on many of his positions.  Roy posted this last weekend a post on mocks and stubs that resonated with me.  The premise of the article is that the learning curve to write tests is too great:

One of the main reasons most developers still today don’t really take to unit testing (and TDD) is the really high learning curve that is forced upon them. That is not to say that learning about

mocks, stubs, dependency injection, IoC containers, Extract & override technique, Record\Replay, AAA and more

-- is not useful, but it is a big obstacle to get people into the habit of doing something which they know is good for them – test their code, verify their assumptions, automate, integrate, be confident, get feedback, define behavior – all those and many other benefits are being thrown away by developers all over the world because the entry fee to this world is too high, for all the wrong reasons.

Jimmy Bogard, who's been on a bit of a TDD kick lately, wrote a post giving ten tips to maximize the return on TDD, #6 on the list:

Get everyone on board.  Quality needs to be important to your team, as should be good design.  Accepting less is a team decision, but that decision needs to keep in mind the cost of technical debt.  One person can subvert an entire team's intention to start TDD, and it's up to the team leader to ensure that everyone moves together.  If a team member refuses to cooperate, then it may be time to escalate the issue to HR.  A team's success is more important than one team member's ego.

These two seem to be somewhat at odds.  Jimmy is absolutely correct, everyone should be on board, but the fact is that getting them on board is difficult due to the learning curve (to Roy's point).  When talking TDD it is easy to quickly bring up SoC, DRY, SRP, IoC, DI, and a myriad of other acronyms, each of which your team will have varying degrees of understanding of.

Currently on my team I'm bringing some of these ideas to my team.  Some seems to stick while others seems to be tougher to grasp

Here's the question I have for you, dear reader.  If you are new to TDD and seem to have "gotten it", what was it that made it all come together for you?  If you are struggling with TDD what seems to be the thing that isn't clear?  Are there certain concepts that you have found valuable to know to aid your learning?  Are there other concepts/principles that while good intentioned, only muddied the waters for you when it came to testing and TDD?

In general I believe that as much as we are different many of us are the same.  Where one struggles my guess is that many struggle.  In my very first blog post on the devlicious site I stated:

Therefore as I engage you I ask that you engage back by leaving comments, emailing me, ect.  The goal for me is to ultimately provide useful content to you and improve myself in the process.

I believe that if we can get to the heart of the confusion and break down some barriers we can flatten the learning curve.  That isn't to suggest we dumb down TDD or cheapen it by turning it into something else, but rather through our collective experiences come up with a pathway through which the "zen" of TDD is understood for all who desire to learn.


Published Sep 22 2008, 09:01 AM by Tim Barcz
Filed under: ,

Comments

DotNetKicks.com said:

You've been kicked (a good thing) - Trackback from DotNetKicks.com

# September 22, 2008 10:05 AM

LukeB said:

It's simple.

Provide a non-trivial application built with best practices so that developers can see the progression of the application through the change control logs.

# September 22, 2008 11:30 AM

Mark Nijhof said:

I second that, keeping it simple, as simple as possible. Make separate examples that later can be combined to each other. But don't make them in the Hello World style, it should mean something to those that you want to teach, so simple but relevant. Also someone that knows (tech lead) should maybe be given time just to teach and help others. People don't always ask when they don't understand, so just some presentations are not going to be good enough, help them practice it.

Don’t just ask them to invest, the company should also invest. Anyway those are just my 2 cents :)

# September 22, 2008 12:59 PM

Jason Meridth said:

One of my favorite quotes is from Linus Torvalds, "Talk is cheap.  Show me the code."  No matter how much talking we do, we always have to show the code.

Not taking anything away from Jimmy or Roy, but the best way to teach *most* developers who are new to TDD (+other acronyms) is by code.  It is how the green light went off in my head.

And the first time TDD, saves you from putting a bug into production is when you will never look back, IMO.

# September 22, 2008 1:37 PM

Mark Nijhof said:

Another thing that might help with some parts is the lessons they provide at Innerworkings (no relation to) this is very code orientated learning.

-Mark

# September 22, 2008 1:54 PM

Tim Barcz said:

@LukeB and @Jason

Do those interative code examples exist anywhere already?  Are you using anything that I can piont some of my team members/friends/other developers to?  Or is is this something that has yet to be developed?

# September 22, 2008 2:46 PM

New to proper OO and TDD said:

I'm new to TDD and proper OO.

The #1 thing I want to know (which is something of a conundrum, so I don't expect a real answer), is how do I know if I've overengineered something?

When I go from procedural-style code, to an explosion of classes? How do I know when to stop refactoring?

When I really REALLY follow the Single Responsibility Principle, and my classes multiply like bunnies? When does YAGNI kick in?

I think the answer lies in "read more (quality) code, write more code"--i.e., blog posts can't help me.

# September 22, 2008 6:21 PM

Reflective Perspective - Chris Alcock » The Morning Brew #185 said:

Pingback from  Reflective Perspective - Chris Alcock  » The Morning Brew #185

# September 23, 2008 2:50 AM

Steve E said:

I've been trying to pick up TDD for about the past year.  Those where I currently work don't seem to want any sort of buy in to changing away from the "I don't care how you do it, just code it ASAP and get it out to production before lunch 3 days ago" type of development.  I've been following plenty of blogs about the topic, attending user groups about the topics, and reading through some of the "must read" books that people have listed on the topic.  This includes a 3 hour drive down to catch a Chicago ALT.NET meeting last month.

All the principals make sense from a high level, and I see the benefit of all of them, but I just can't figure out where in the world to start with it.  Watching webcasts like Rob Conery's MVC Storefront (blog.wekeroad.com/mvc-storefront) is great, but it throws so many things into the mix that just go whizzing by.  Just so much thrown in there that it's hard to pick out the actual useful parts to trigger the light bulb.  

What I think needs to be done (outside of actually doing a pair programming session with an "expert") should be a really straight forward app and all the steps starting at Iteration 0.  Assume that Subversion and CC.NET (since they're both free, because not everybody has TFS and all those nifty tools) are set up already with absolutely nothing in them and need to be configured.  Set up the directory structure.  Add in recommendations for tools (Rhino mocks vs. moq, nunit vs mbunit vs msunit, etc.) and where to toss them so every developer automatically has them to build from.

From there things like how to come up with good use cases to test on would be great.  Even starting out with a simple app that pretty much every dev has had to write at some point would greatly help.  Like a "simple" app that has to pull data from a data base, format it, send it off in an email as some sort of attachment.  And then they ask to have it in a report.  And then the user wants some sort of way to subscribe/unsubscribe from it without contacting you as the developer.  And then they want it in in a format they can query at any point (and of course they don't have direct access to the database).  And then...well, you get the idea.  General scope creep for the project (in a completely coincidental way that introduces one or two new topics with every new feature...).

If the lightbulb ever goes off for me I'm definitely going to blog the process to help others, but I'm still waiting for the bulb to go off...

# September 23, 2008 2:50 AM

David said:

To date the thing that has been most helpful in my understanding of TDD (including 100s of blog posts and a dozen books) is ye olde Test First Challenge Spreadsheet example (www.xp123.com/.../index.shtml).

Maybe it would help if there was a test list like this published for a semi-real app (sort of like a virtual pair that is writing the tests for you)? I know that would help me. I'll write one myself if I ever get to a sufficient level of proficiency with TDD :)

# September 23, 2008 4:14 AM

Doug said:

Sorry, but I'm still stuck on "why?". I totally agree, "show me the code" will be far more convincing than blogs, but I need to see code that can show how TDD, more specifically writing unit tests, is beyond human fallibility.

I get ORM, i see the benefits, I reap the rewards, likewise OOP. Show me the code to that explains why TDD is applicable for even the tiniest application.

# September 23, 2008 5:13 AM

Jacob said:

I think it'd help if the attitude weren't so absolute. I know it's grating to compromise "principles", but it's just as grating to be given a solution from on high that is complete and perfect in all its details. I've had conceptual issues with TDD for some time now, and have had the temerity to express them in public (theruntime.com/.../default.aspx). The backlash I get is consistent but ultimately unhelpful.

My biggest problem with TDD remains that it is only ever compared to not doing unit testing at all. What if someone on your team is willing to embrace strong unit testing but doesn't want to write his tests first? How are you going to react to that? How do you react to compromise in general? When faced with an objection, do you look for a way to refute it or a way to test it? Too often, I think, proponents of new ideas or techniques jump to refutation and it becomes a contest of testimony. I think that attitude is harmful to your cause, even if it turns out that you were right.

# September 23, 2008 11:57 AM

Dew Drop - September 23, 2008 | Alvin Ashcraft's Morning Dew said:

Pingback from  Dew Drop - September 23, 2008 | Alvin Ashcraft's Morning Dew

# September 23, 2008 3:23 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add
Check out Devlicio.us!

Our Sponsors

Proudly Partnered With