.Net Development & General Tech Related News

BOOK REVIEW: Professional Refactoring in C# and ASP.NET (Wrox)

August 7th, 2009 Posted in .Net, ASP.Net, Book Reviews, C#

refact

Title: Professional Refactoring in C# and ASP.Net

Publisher: Wrox

Author: Danijel Arsenovski

Even the most experienced developers can sometimes be found sat staring at their monitor trying to decide which way to implement a solution. Asking a fellow developer for input will probably result in more avenues to consider as opposed to narrowing down the initial choice. But all things considered if the end result meets the user’s requirements does it really matter which design choice we make?

Well……yes. The code will still need to be maintained and updated; this can be time consuming if the code is unstructured or messy. However with some refactoring techniques to follow it’s possible to make the right decisions during design and implementation and this book contains the techniques to help you make those decisions.


Why did I read this book?

I’ve read a couple of books on the subject of refactoring, these where mainly concerned with the business logic layer side of applications so I was interested in what this book had to say about refactoring ASP.Net.


First Impressions

The book starts with a good introduction of refactoring including its benefits and also spends some time “Debunking Common Misconceptions” (one or two I’ve firsthand experience of trying to dismiss) and “Smells”. This isn’t a scratch and sniff section but a way of identifying code that is a candidate for refactoring. Throughout the book Smells will be introduced along with ways to detect them, which refactoring technique to use to eliminate them and the rational for removing them.

The Introduction chapter includes an index of the Smells as well as Refactorings and Object-Orientated Design Principles so they can be quickly found and referenced. I found this to be really useful as I was working my way through the book. 


What’s Covered

In the words of the book;

“This book covers the refactoring techniques that will enable you to become more efficient and productive. You will be able to use this information to respond to change and improve the design of existing code”.

In my opinion this book does indeed go a long way to achieving the above statement.

The book covers the following areas;

  • Assembling a refactoring toolkit
  • Techniques for performing unit testing 
  • Tips on refactoring to patterns
  • Using refactoring to upgrade legacy C# and ASP.Net code
  • Using method extraction to eliminate duplicated code
  • Making code more simple and easier to understand
  • OO theory and design patterns
  • Methods for using LINQ and C# 3.0 enhancements


What I Liked?

I enjoyed the chapters on “LINQ and Other C# 3.0 Enhancements” and “Refactoring ASP.NET Applications” which I found very insightful and will be using some of these techniques in the future.

Most of this book is, obviously, based around Refactoring Techniques and these chapters are very well presented with good code examples. I like the way that the Smells and Refactorings are emphasised throughout the chapters as this reinforces the point being made as well as making the sections easier to locate when you want to reference them.

Although I have read about refactoring before I did enjoy reading through these chapters which reinforced what I had previously read and having the examples in C# was a real advantage as this is the language that I currently develop with.


What Could Be Better?

I’m a big advocate of Test Driven Development (TDD) and I think that this methodology is key when refactoring. Always having a number of tests for the code that you are refactoring allows you the confidence to alter the code knowing that if your change was to impact an area you weren’t expecting this would be highlighted to you with a failed test. Although this is mentioned in this book I think that this should have been given more emphasis.


The Final Verdict

All in all this was a good and worthwhile read and although I would not recommend relying on simply this book for all areas of knowledge of this subject (i.e. TDD), I would certainly recommend the book to my peers.


Kick It on DotNetKicks.com
Share this Post:
  • Digg
  • Sphinn
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • DotNetKicks
  • Reddit
  • StumbleUpon
  • TwitThis
No TweetBacks yet. (Be the first to Tweet this post)

Technorati Tags: , , , ,

Tags: , , , ,

  1. 1 Trackback(s)

  2. Aug 10, 2009: Louisebreinholt (Louise Breinholt)

Post a Comment