This piece was originally published in Database Weekly on Oct 12, 2009. It is being re-run as Steve is away on sabbatical.
I've heard that it takes 2-3 weeks to develop a habit. Do something every day for that length of time and it will start to be a routine for you. I'm not sure it happens that quickly, but I know that after a couple of months, running became a habit for me, and became more enjoyable. It's something that I now look forward to daily.
When something becomes a habit, or becomes part of our routine, we develop some skill with that. In our jobs, building those skills usually makes us more efficient. When you know the schema of your database or you can remember the syntax for a SQL command, you don't have to look things up in Books Online, and you can code quicker. I know I've strived to develop habits over the years, ingraining certain tendencies that would allow me to get more work done in shorter periods of time, at a higher level of quality.
However technology changes. And sometimes sticking with those habits, those tried and true methods of solving problems, isn't the best way to build your software. As new features come about, or products behave differently in new versions, sticking with the same methods for solving problems might not be the best way to continue to do well at your job.
I noticed a new blog series this week from Aaron Bertrand and Adam Machanic that looked at kicking some bad habits in the SQL Server world. There are some good posts in there, and I remember having some of these habits, and having to unlearn them and work on new habits. Moving from the old style joins to ANSI ones was a hard habit for me to break, but now I can't go back. I even have trouble reading forum posts where someone has stuck to this style of join. Not all of these habits are bad in terms of performance, but I think it's a good series on habits you can break that will make you a better coder on a team. Some of the items mentioned make it harder to share code with other people if you are still using them.
While it's good to break habits, I don't think that it's worth jumping in and experimenting with every new change that comes along. It's good to have some habits and familiar techniques lying around that make you efficient. Use them as long as they work. But pay attention, educate yourself, and read about changes. Talk to friends and learn what new things they're trying. If something becomes a standard and makes sense, add it to your toolbox, and pull it out as often as you can.
That way you'll build a new habit.