Derik Whittaker



Refactoring Project Structure is just as important as Refactoring Code

We talk about how important it is to keep your code in working order, but no one ever really talks about keeping the container for your code in working order --- Your Project Solutions.

Per Wikipedia Refactoring code can be defined as:

Means improving it without changing its overall results, and is sometimes informally referred to as "cleaning it up". Refactoring neither fixes bug nor adds new functionality, though it might precede either activity

Lets take a look at some of the reasons why we refactor our code base (this list is NOT the be-all-end-all list)

  • Keep our code soft and flexible
  • We encounter new needs for our code and we refactor to allow for these changes
  • Improve the design of the code
  • Make the code design easier to understand

If you look at the above list you can see that you can apply many of these to the structure of your application.  Let me provide a few examples

  • Keep our code soft and flexible Keep your source tree/project tree flexible
    We all have been on projects that just kept growing and growing.  If you continue to let this happen eventually you will find yourself in a world of hurt.  Take the time, prune your project solutions.  Maybe it make sense to create multiple solutions… Either way keep it under control.

  • We encounter new needs for our code Structure and we refactor to allow for these changes
    When our code starts to smell we refactor it. We may refactor the layout, the structure or how the pieces work.  We should do the same for our code structure.  If a given assembly is doing too much then break it down.  If a given namespace has too much responsibility, create a new one.
  • Improve the design of the code source tree
    See above :)

  • Make the code design source layout easier to understand
    Making your project easier to navigate and find stuff is very, very important.  We refactor code so the next guy can determine which way is up.  We should refactor our project structure so the next guy knows how to find/add what is needed.

So the next time you think that refactoring only applies to your source code, stop and think again.  The principles of refactoring (making changes to the content without changing the intent) can apply to many other aspects of our jobs.

Till next time,

Posted 04-15-2009 2:27 PM by Derik Whittaker
Filed under: ,



Code Zest wrote Piggyback on Derik Whittaker
on 04-16-2009 12:23 AM

Piggyback on Derik Whittaker

Parag Mehta wrote re: Refactoring Project Structure is just as important as Refactoring Code
on 04-16-2009 1:10 AM

Nice article. Yes structuring Project structure is very important even though we use tools like Resharper, it's still is very important to organize the things.

Bruce Boughton wrote re: Refactoring Project Structure is just as important as Refactoring Code
on 04-16-2009 1:43 PM

Absolutely agree. The only caveat I would add is be aware of your source control tool. Layout refactorings can be a nightmare to merge for example. It's often a good idea to check them in separately from any functional code changes. (Of course, it's good practice to check in changes in logical units anyway)

About The CodeBetter.Com Blog Network
CodeBetter.Com FAQ

Our Mission

Advertisers should contact Brendan

Google Reader or Homepage Latest Items
Add to My Yahoo!
Subscribe with Bloglines
Subscribe in NewsGator Online
Subscribe with myFeedster
Add to My AOL
Furl Latest Items
Subscribe in Rojo

Member Projects
DimeCasts.Net - Derik Whittaker

Friends of
Red-Gate Tools For SQL and .NET


SmartInspect .NET Logging
NGEDIT: ViEmu and Codekana
NHibernate Profiler
Balsamiq Mockups
JetBrains - ReSharper
Web Sequence Diagrams
Ducksboard<-- NEW Friend!


Site Copyright © 2007 CodeBetter.Com
Content Copyright Individual Bloggers


Community Server (Commercial Edition)