Friday, February 3, 2012

Testing to ensure code gets cleaned up.

The other day I was working on a change on www.checkthesock.com that involved getting rid of some pages. It is generally a good idea to redirect those URL's to a relevant location so that search engines and people can get to a useful location. Eventually no one uses the old URL anymore and whatever code is redirecting it is just sitting around gathering dust.

I wanted to make sure I eventually cleaned up the code I had doing the redirection. In the past I have tried several different ways of remembering to do this; try to remember, put a note somewhere, or put a reminder in my calendar. None of those have ever ended up working out. None of those methods involve anything that is part of my normal working process.

The solution I came up with was to write a test that checks to see if the code is still around at some future date. I run my tests all the time as part of my normal workflow and I never release code without fixing a broken test. Now at some future point in time the test will break and I will not forget to clean up my unused code. Seems like a potentially useful pattern. In a few months, when my tests start breaking to remind me to clean stuff up, I will discover if it is useful or just really annoying.

15 comments:

Unknown said...

Exciting post and thank you for sharing. There are things here that I didn't think some time as of late. Because of cool such a position, to the point that is to a great degree carefully taken, we will talk a huge amount of colleagues about it.Outdoor Advertising Agencies in Nagpur

Oracle Fusion said...

Excellent blog after reading this I am impressed a lot. Thank you so much We provide online classes for oracle courses. We have reference site. Please go through it.
Oracle Fusion HCM Technical Training

Rajesh said...

Thanks for sharing great information, Hope you will share many more articles so that it will be helpful for many of us.



Oracle Fusion Financials Online Training

oraclefusionapplications said...

I would like to thank you for the efforts you have made in writing this article. I am hoping the same best work from you in the future as well.
oracle fusion financials online training

Rainbow Training Institute said...

Awesome post……. your article is really informative and helpful for me and other bloggers too

Oracle Fusion HCM Online Training

sportstototopcom said...

Nice blog! I enjoy reading through your article post. I like to write a little comment to support you. 토토

Laura Bush said...

A very delightful article that you have shared here.programmable led signs for business Your blog is a valuable and engaging article for us, and also I will share it with my companions who need this info. Thankful to you for sharing an article like this.

Sharly said...

Pretty helpful information! Fantastic what precisely I actually appeared to be searching to get! https://www.allmaxbet.com

Ban Yen said...

But want to remark on some general things, The site style is ideal, the articles is really nice : D. Good job, cheers https://www.5g999.co/slot

faiselkaden said...

Casino in Las Vegas | Slots - Wooricasinos
Casino in k9win Las 저녁 메뉴 추천 룰렛 Vegas. Welcome to the 바카라 사이트 주소 casino 잭팟 at Wynn Las Vegas and the best Las Vegas slots machine games, slot machines and 슬롯머신 more.

Naman Singh said...

What Is an Arched Window Called: Arched windows are of great importance in the field of architecture.

카지노 뉴스 정보 사이트 said...

We were talking about the hurricane today and hope that you are doing well.토토사이트

Anonymous said...

On each play table you need to} see a chart that reveals what 클레오카지노 number of} cash you'll obtain when successful a sure hand of poker. If you play five cash on a Jacks or Better table you can get get} 45 cash for a full house as an alternative of nine cash. You also will obtain a bonus for Royal Flush with a max guess. Video poker gamers really have the best of both worlds. Poker is the preferred card recreation on the planet, and slot machines are the most important thing at the on line casino. For over forty years, poker fans have enjoyed the convenience and comfort of enjoying in} the machines, whereas slots fans have enjoyed the added skill factor behind video poker.

Kevin Jacob said...

I appreciate the valuable insights you've shared in this article. It's exactly what I needed. Your efforts in providing such information are commendable. Thanks a bunch! Outdoor LED Signage

Kevin Jacob said...

Thank you for taking the time to share this valuable piece of information. It's incredibly helpful, and I'm grateful for your efforts. Keep it up! Outdoor LED Signage