Images in this post missing? We recently lost them in a site migration. We're working to restore these as you read this. Should you need an image in an emergency, please contact us at imagehelp@codebetter.com
Reflector Magic - How Hard is it to Abstract a Legacy System?

As it sort of came up via a previous post, and on the altdotnet mailing list ... I thought I would share a little secret with you ... abstracting out legacy systems can be pretty darn simple with a bit of Reflector magic!

Step One: Get Reflector

You can download it here if you don't already have it (how could you be writing code without it???)

Step Two: Get some Addins

There are some really cool ones at CodePlex

Make sure you get the Doubler Addin

Step Three: Run the Wrapper / Interface Generator

Pick your favourite legacy code base (MOSS is my particular favourite), pick your favourite nasty classes (SPList is just so damn sucky) ... and let Doubler work it's magic.

Voila!!!  ... no hard to write or maintain decorators, no painful legacy system to mock, and frankly, the Doubler code is so light that you don't even need to test it - just use MOSS as though it was a really well written piece of software (OK maybe that last bit is pushing the trade descriptions act a bit far).

Now you can use your favourite mocking framework, no need for the magic that some provide ...

 


Posted 05-02-2008 12:55 PM by Jak Charlton
Filed under: , , ,

[Advertisement]

Comments

jdn wrote re: Reflector Magic - How Hard is it to Abstract a Legacy System?
on 05-02-2008 12:11 PM

Doubler looks awesome, but any idea why Reflector says it fails to load it as an add-in?  Does it require an older version or something?

jdn wrote re: Reflector Magic - How Hard is it to Abstract a Legacy System?
on 05-02-2008 12:19 PM

Disregard.  User error.

Weekly Links 2 « Davy Brion’s Blog wrote Weekly Links 2 « Davy Brion’s Blog
on 05-03-2008 7:17 AM

Pingback from  Weekly Links 2 « Davy Brion’s Blog

jdn wrote re: Reflector Magic - How Hard is it to Abstract a Legacy System?
on 05-05-2008 2:24 PM

Since someone emailed me to ask:

Go to view/addins/add and choose the ReflectorDoubler.DLL and that's it.

redgreenrefactor wrote re: Reflector Magic - How Hard is it to Abstract a Legacy System?
on 05-06-2008 1:52 PM

This came right on time for me. Thanks for sharing!

Peter Seale's weblog wrote SharePoint: Not Unit Testing
on 05-20-2008 2:02 AM
The Inquisitive Coder » Blog Archive » Weekly Links 2 wrote The Inquisitive Coder » Blog Archive » Weekly Links 2
on 05-24-2008 10:14 AM

Pingback from  The Inquisitive Coder  » Blog Archive   » Weekly Links 2

Mikael Svenson wrote re: Reflector Magic - How Hard is it to Abstract a Legacy System?
on 06-03-2009 12:46 AM

Would you care to write a small example on how you would actually test something with SPList using doubler? How do you interchange the wrapped interface with the real SPList, or do you use the Wrapped object in for example a webpart?

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Subscribe
Google Reader or Homepage

del.icio.us CodeBetter.com Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl CodeBetter.com Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of Devlicio.us
Red-Gate Tools For SQL and .NET

NDepend

SlickEdit
 
SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
LiteAccounting.Com
DevExpress
Fixx
NHibernate Profiler
Unfuddle
Balsamiq Mockups
Scrumy
JetBrains - ReSharper
Umbraco
NServiceBus
RavenDb
Web Sequence Diagrams
Ducksboard<-- NEW Friend!

 



Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers

 

Community Server (Commercial Edition)