Part of my job at work is to teach and mentor other developers on our team. Right now I am in the process of teaching two of our developers how to create unit tests (notice I did NOT say integration tests because most anyone can do those). We are also learning how to create our tests by utilizing an Isolation Framework (aka mocking framework).
I am really excited for this opportunity because I firmly believe that you create better software when you do it by creating tests to prove your code works. I am also excited because both of the developer buy into the idea of testing and are extremely eager to learn how to to better test their code.
Because we had a few days of downtime because of the Christmas holiday before our 1st sprint on our project we thought it would be a good time to do some pairing (guess it would be better called tri-pairing). Our plan of attack was to start to flush out some of the features in our system but do it in a total TDD manor. We were also going to be utilizing the Rhino Mock Isolation framework in our tests.
So over the next 2 days we spent about 12 hours or so working building out our code. Over this time we actually were able to create an complete end to end 'version' (I say version because we did not fill in all the functionality of the code but were able to get all the major pieces stubbed out) which allowed us to flush out many, many more business requirement and build a simple, yet flexible code base.
I hope both of my co-workers learned a ton from this exercise, I know I did. This was the first time where I had actually spent any significant amount of time teaching someone who was new to testing how to do so. Sure I had spent an hour here or an hour there, but nothing like this.
What I really wanted to share with everyone is what I learned form this experience.
Slowdown, slowdown, slowdown
The first thing you should do when teaching something how to do anything is SLOWDOWN. You have to remember that if you are talking/teaching to someone who is new to this they have to not only try to process the information so they can understand it, they also have to try to remember it.
Make NO assumptions, teach as if they know nothing
This one was the most important thing I learned. You cannot make assumptions on anything. Anytime you say anything make sure you fully explain it. If you use an acronym EXPLAIN IT. Any time you mention a buzz word EXPLAIN IT. Plan and simple EXPLAIN EVERYTHING
Have them drive
During the teaching part it is critical that you have then code, have them tell you what to do. It is ok for you to 'lead' them in the right direction, but you must not always drive. This will really help to drive home the concepts.
Provide examples both with and without the Isolation framework
In our case because I was trying to teach them testing using an Isolation framework it really helped when I would create a test (aka integration) with no mocks and then re-create it with mocks. Doing this really helped to explain to them how using the Isolation framework removed dependencies.
Don't let them skate by
Don't let them simply nod their head as if they understand. Make sure you keep asking them if there is anything you can clear up or explain better. At first they are going to simply say no, they are good. But as you keep asking and start having them drive they WILL start to ask more questions, I promise.
Turn off any coding tools such as ReSharper (or the likes) and do NOT use shortcuts
This may have been the biggest issue for us at first. I am pretty good with ReSharper (if I can toot my own horn here) and I was coding with it as I would do if I were by myself. On more than one occasion the would look at me cross-eyed and ask 'what the hell just happened'. Finally I simply stopped using it for the first day. On the second day I went back to using R#, but I turned on Keyboard Jedi so they could see what was going on. Even though I turned on Keyboard Jedi, I tried my best to make sure to explain what just happened when used R#.
Anyway, I have rambled on long enough and I think I have pretty much gotten my thoughts out there. I really enjoyed working with these guys and I am looking forward to doing so again when we get back from break.
Hope this helps,
Till next time,
Posted
12-30-2008 11:21 AM
by
Derik Whittaker