Professional Refactoring in Visual Basic (Programmer to Programmer)

Professional Refactoring in Visual Basic (Programmer to Programmer)
Authors
Danijel Arsenovski
ISBN
0470179791
Published
07 Apr 2008
Purchase online
amazon.com

In this one-of-a-kind book, Microsoft MVP Danijel Arsenovski shows you how to utilize the power of refactoring to improve the design of your existing code and become more efficient and productive. You?ll discover how to perform unit testing, refactoring to patterns, and refactoring to upgrade legacy Visual Basic code. As you progress through the chapters, you?ll build a prototype application from scratch as Arsenovski walks you step-by-step through each process while offering expert coding tips.

Page 2 of 2
  1. Editorial Reviews
  2. Customer Reviews

Customer Reviews

T. Anderson said
Both the VB.NET and C# & ASP.NET Refactoring books are great. Each has it's own unique sections, while at the same time they cover the same refactorings, smells, and Object-Oriented Design Principles in detail.

I bought the VB.NET version because I have been stuck on a VB.NET project for the past 3 years (actually 3 months, but it sure feels like years).

I have not seen the weak static typing to strong dynamic typing explained so well and in such detail anywhere else. The information in this chapter teaches the developer how to use VB.NET to program a quick prototype or industrial strength applications. He goes into tremendous detail on how to properly use the Option Strict, Option Explicit, and Option Infer statements.

I was so impressed with the VB.NET version of the book that I bought the C# and ASP.NET version of the book. The C# and ASP.NET version of the book contains two chapters on refactoring ASP.NET code.

Both books have chapters on LINQ and other language enhancements, Refactoring to Patterns, Advanced Object-Oriented Concepts, Code Organization on a Large Scale, and multiple chapters on refactoring and smells. Throughout each book the author touches on Object-Oriented Design Principles. Both books have a list of all the refactorings, smells, and Object-Oriented Design Principles page numbers so they are easy to find.

The author points out that one of the motivating factors in writing these books was to give us the refactoring techniques in the languages we work in. I agree with his motivation, all the other books I have read used Java as the language and although I learned a ton from them, each language has its own subtle differences.

The author's style of writing make reading these books a pleasure. They are very well organized.

Both come with well organized and very usable code downloads.

Both of these books are highly recommended. They definitely make learning refactoring and Object-Oriented Concepts and Design Principles very enjoyable.

Jason Down said
Arsenovski has done a great job with this book. It is clearly written, easy to follow and very practical. A great one to keep on the shelf and reference as needed. The free tools that he covers in the book are a bonus! They really help to get you applying what you've learned quickly.

I highly recommend this book for any .NET developer, not just those who use Visual Basic.

Z. Mijatovic said
Not a typical Wrox title, generally these tend deal with specific technology in "no-nonsense" fashion. This book has more theory in it and is not technology specific, you will find it valuable if you program in just any version of Visual Basic .Net and any type of application. Not likely to become obsolete very soon, since basic premises of refactoring will continue to be relevant even in upcoming versions of VB.

P. Reyes said
I am working with group of developers that came to VB .Net from VB6. Currently we are in process in improving the way things operate using some agile stuff. The overall disposition is pretty good, team has already been formed and things like daily stand-ups, client involvement or short iterations are generally welcomed by all. However, when more technical, code level stuff is discussed, there is more discussion (if not opposition). These folks pack years of experience and will not accept that you can teach them their job just like that. There is no way you can force things like unit testing or refactoring. You have to be able to hold your ground and answer all the questions with some good arguments.
This book gives you in-dept view of refactoring with a lot of practical, code examples. This means that you are well prepared to answer any uncomfortable question. It builds up gradually, so it is easy to follow.
Almost every chapter ends up applying the stuff that was just exposed on a sample application with a lot of code. Surely author spent a decent time on this title. You can download the code and see it progress from chapter to chapter. This gives a great insight since you can read and debug the code at the same time and not just some toy or isolated example.
Here is chapter to chapter break-down of the book.

Chapter 1
Intro chapter, defines refactorings end code smells and explains the kind of baggage VB carries because of its origins. Cool section on misinterpretations, this will prepare you for some tough questions that might come from uninitiated developers or managers.
Explains the importance of writing simple, comprehensible code. For example:
Dim oXMLDom as New DOMDocumet() vs Dim portfolio as new DOMDOcument.
The first statement gives you no idea of what first DOMDocument represents, in second it's the portfolio, and if you know the application context you will know what to expect.

Chapter 2
Teaser chapter but also good single-chapter sample of some typical refactoring work. Captures well typical process of development of VB applications. Starts out with few event-handling methods, ends up with number of domain classes and some inheritance thrown in.

Chapter 3
Chapter on refactoring tools, also gives you some insight of how different tools like refactoring add-ins and unit testing framework fit the big picture of agile development process.

Chapter 4
Intro chapter on application that is used to illustrate refactorings throughout the book. Explains the business case, requirements, lists some use cases. It is important to understand the context of the application to be able to follow-up on refactorings. Also some funny stuff here, like freshman developer that takes pride in copy-paste development.

Chapter 5
In-dept discussion on Static vs. Dynamic and Strong vs. Weak Typing that is rarely dealt with in such depth. This is basically controlled with Option Strict and Option Explicit options. If you program in VB, you must be aware how these work out.

Chapter 6
Chapter on error handling, especially legacy vs. structured error handling. Again, something everyone should know, but rarely explained in such depth. Cool stuff is step by step recipe for converting legacy to structured.

Chapter 7
Deals with some core refactorings like Dead Code Elimination, Scope Reduction etc. It's like cleaning up your code for some serious refactoring stuff.

Chapter 8
First step in structuring your code is getting serious about the problem (or business) domain. Also explains Rename and Safe Rename refactoring, talks about Interface vs. Abstract class, Open-Closed principle etc. some serious OO stuff.

Chapter 9
Some core refactoring stuff. Teaches you how to eliminate duplicated code and why it is the worst thing it can happen to your code. Explains Extract Method and Replace Magic Literal with Symbolic Constant variable. Nice and simple example based on circle geometric shape on how procedural design is transformed to Object Oriented design (Module and Shared method rings a bell?)

Chapter 10
If only method extraction would be as simple in real life... This chapter goes further with method extraction and deals with some common problems like temps.

Chapter 11
Where do objects come from? How you design classes? Some core OO stuff in this chapter, including Extract Class, Move Member (Method or Field) refactorings, smells like Database Driven Design or Data Class, Large Class, OO principles like Single Reasonability Principle etc. Lot of stuff and handful of pages in this chapter.

Chapter 12
Build upon previous chapter. Deals with inheritance, polymorphism, genericity. Explains the difference between class and interface (or implementation vs. interface inheritance), difference between delegation and inheritance and criteria to chose one or another, list some common misuses of inheritance etc. Again, a number of refactorings like Replace Inheritance With Delegation or Extract Interface, Extract Super etc. Some heavyweight OO concepts in this chapter, takes a time to digest.

Chapter 13
Explains what is important when taking a birds-view of software. This chapter is especially important for software architects. Talks a lot about dependencies in software and why you should minimize dependencies in your code.

Chapter 14
Single chapter for huge subject, still a lot of material covered. Design patterns are the most advanced subject in OO, so refactoring your code in order to make use of patterns is in no way child's play. Mostly deals with creational patterns. First mention of Dependency Injection in some VB book I come across. Now taking into account that Unity application block [...] has been released in April, this is really cutting edge stuff!

Chapter 15
Talks about latest VB improvements that come with VB 2008. Starts with XML enhancements like XML literals and then the rest is about LINQ. Explains a LINQ implementation called LINQ-to-SQL. This is first Microsoft Object-Relational Mapper (ORM). Again, cutting edge.

Chapter 16
If you still deal with VB6 code, than you know that migrating to .Net is no easy ride. This chapter explains some techniques that will help you migrate your code and make it .Net in sprit, not leaving it crippled by simple migration that will only make it execute in .Net. VB6 lacks inheritance, generics etc, so you need refactorings to make it VB .Net.

This book has no real competition as far as I know, no book on refactoring or agile for VB .Net developers. The one that come close is Agile Principles, Patterns, and Practices in C# (Robert C. Martin Series) but it is for C# developers and requires a lot higher starting point.
When other books come up, I am sure Professional Refactoring in VB will continue to hold its ground. Highly recommended!

Slavko Glisic said
Really great book on refactoring. Although it is based on Visual Basic examples, same advices can be applied to C#, Java or any other OO language.
Martin Fowler finally has a fair partner on my shelf ;).

You might also like...

Comments

Contribute

Why not write for us? Or you could submit an event or a user group in your area. Alternatively just tell us what you think!

Our tools

We've got automatic conversion tools to convert C# to VB.NET, VB.NET to C#. Also you can compress javascript and compress css and generate sql connection strings.

“We better hurry up and start coding, there are going to be a lot of bugs to fix.”