Reaching the Refactoring Redoubt with #SQLPrompt

I enjoy themes, and when I ran across the SQL Prompt Treasure Island, I had to take a few minutes and go through it. I wrote about Code Snippet Cove first, and this post finishes my movement around the map. The other items I’ve read about are:

Refactoring is Hard

One of the things that I struggle with, and I think many others do as well, is refactoring. Not that refactoring or changing code is hard, but remembering to get all the various places changed can be a challenge. It seems that any refactoring might change an item in three or four places, but then forget one more, which leads to bugs and embarrassment.

Fortunately, SQL Prompt has a few things to help. Smart Rename is one of these, which will let you know about all of the dependencies and places where code will change. This makes quick work of renames, which is something I’ve appreciate in other languages, but not T-SQL before this.

Note that renaming objects is still disruptive and can break connected applications, so this still should be undertaken with care, and in synchronization with renaming the objects in application code.

There are also the renaming of variables, which can be helpful when you realize that your short or obscure names aren’t helpful to others on your team.

Perhaps my favorite refactoring feature is the Encapsulate as New Stored Procedure. I think more people should be using stored procedures, and while we might experiment and develop code as a batch or query, we want to move this to a stored procedure. This feature makes this simple for developers, and it’s one you should ensure they know how to use.

There are other items in the treasure map, many of which are useful, but you’ll want to practice with them and decide which ones are most useful and helpful in your daily work.

If you haven’t tried SQL Prompt, download an eval today and give it a go. I bet you will love it and ask for your own copy.

About way0utwest

Editor, SQLServerCentral
This entry was posted in Blog and tagged , , . Bookmark the permalink.