Quantcast
Channel: Lohn Solutions
Viewing all articles
Browse latest Browse all 10

Code Reviews – What good are they for?

$
0
0
  1. All database changes go through me. 
  2. Do or Review, do or review.

These have been my catch phrases since taking on the lead SQL developer role at my company, on my team.  There have many changes that I’ve had to review – many, many changes, most of them are fine, but occasionally I get a real head scratcher.

Things that I’ve caught reviewing code in the last three weeks (note these are also justifications I’m taking to my boss for more help):

  • VARCHAR(MAX) column – we avoid these for online reindexing
  • A cursor – we avoid these for performance sake – it also didn’t need it
  • Missing comments and Headers in stored procedures – we’ve got a standard header we use
  • An infinite loop – a testing procedure that uses service broker that would have been looping forever.
  • A date that should be UTC Date, but Getdate() was used

Is this good for the company?  This is the question I’m asking myself…all the time actually.  Running the numbers, how much time and money has my reviews saved the company?

For the next six months a guess would be:

varchar(MAX) column 

  • 10 hours of operational DBA/contractor time to write exception statements and meet on how to handle the online re-indexing
  • 10 hours development DBA time to migrate the data on the next release
  • 5 hours testing time

The cursor

  • 10 hours development DBA time to rewrite and test the change
  • 5 hours testing time

Missing Comments and Headers in stored procedures

  • 5 hours developer time

An infinite loop

  • 1 hour to troubleshoot and fix on release night with 30 people waiting around – 30 work hours total

A Date that should be UCT instead of Server time

  • 2 hours development DBA time to locate and fix

48 work hours total for about that the same amount of time reviewing code. 

Note these are just estimates, so I may be way off, but the old saying, “Pay me now or pay me later” really comes into play here.

There are a quite a few intangible benefits as well:

  • I know what’s going on with the changes and I’ve tried to communicate to the other DBAs the changes coming.  That should save lots of time for others
  • I have got to know a lot of developers who I normally wouldn’t talk to.
  • I’ve taught a few developers a few things about SQL.  Hopefully this will save tons of time down the road.
  • I’ve showed this site off to a fairly new SQL guy and he’s used the generate random data script a lot and it’s saved him some testing time.

 

Milt


Viewing all articles
Browse latest Browse all 10

Latest Images

Trending Articles





Latest Images