SQL Clone
SQLServerCentral is supported by Redgate
Log in  ::  Register  ::  Not logged in

Rewrite Your Code Tomorrow

By Steve Jones,

One of the things that many developers learn over time is that they write better code with practice. In fact, some of the time a developer will find that if they write a bit of code to solve a problem, they'll come up with a better solution a day or two later, as they've had a chance to think about the problem. Even while moving on to other code, their brain will continue to examine the previous solution, inherently knowing the approach wasn't the best.

Many of us see this with our code over time. If we look back at something we wrote a year or two ago, many of us cringe. At least, most of us cringe, especially if we constantly look to improve our skills. We see that old code as poorly written, in a way that we might never want to repeat in our career. I think that's a good sign that we are moving forward and learning better patterns over time. If you don't view any of your old code as poorly written, I'd stop and get a second opinion. You certainly might have written some great routines that stand the test of time, but more often than not, I find places where I'd improve code. Having someone else review my work might help me build better skills.

One of the things I heard recommended recently was that developers solve some problem, commit the code in their VCS, and then tomorrow, redo the work. Start the day by deleting that section of code (that proc, method, class, etc.). Then move forward and rewrite the solution, not trying to remember what was there, but by resolving the issue. Plenty of application developers find they'll write similar logic, but better structured code. Even if you don't believe this, conduct an experiment on a small section of your code.

I don't know if we'd come up with the same results with T-SQL as many of us tend to solve the problems the same way across a short period of time. However, maybe you'd like to post a mock up of your challenge and solution, and ask for some opinions. We have great forums at SQLServerCentral and some really sharp SQL developers. You might get the validation that you built a great solution, or maybe you'd get some ideas on how to improve both your code and your skills.

Total article views: 58 | Views in the last 30 days: 58
Related Articles

Bring Solutions

In today's world, technology workers need to point out solutions, not problems.


Rulebreaking Developers

How much of a problem is it when developers can blamed for issues?


Collation issue between tempdb and the database xxx - Better Solution?

Collation issue between tempdb and the database xxx - Better Solution?


Bronze Age Development

The slow pace of Visual Studio development had a number of problems over the years, but Microsoft ha...


DR solution..Pls respond

DR solution