Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How can I help junior members gain confidence in their ability to refactor code? [closed]

Tags:

c#

refactoring

I wanted to see what folks thought were the best way to help junior members gain confidence in their ability to refactor code. I find that often junior developers simply follow the existing patterns and sense an aversion to break anything due to the perceived risk. I am trying to get them to look at the requirements (new and existing) and have the code map onto the domain model versus "tweaking" or "bending" the existing code base to support new functionality. Just wanted to see if there were any folks who have success here. We are currently thinking about pushing more pair programming, TDD, code reviews etc., but wanted to check if there were other success stories...

like image 542
leora Avatar asked Dec 24 '08 05:12

leora


2 Answers

The only reliable answer will be unit tests IMHO. Not necessarily TDD -- just get them to write tests for the existing methods/classes they want to refactor, make sure they're doing what they're doing, then allow them to refactor like crazy while relying on the tests to make sure the methods are still valid.

The confidence level and flexibility unit tests allow are immensely valuable in these kinds of activities.

like image 69
Jon Limjap Avatar answered Oct 23 '22 15:10

Jon Limjap


It seems that pair programming with a senior developer in combination with writing tests would be the optimal situation. If the more experienced developer in the pair is leading, the testing will just be part of it.

Writing tests alone leaves room for improvement. Writing tests in a pair environment is the best of both worlds and therefore should build the confidence quicker.

like image 29
Scott Saad Avatar answered Oct 23 '22 15:10

Scott Saad