How Do You Refactor Untested Code?
Published February 9th, 2010 Under Quotes | 3 Comments
I am currently reading the excellent “Debug It!” book written by Paul Butcher and I wanted to share with you some of the little gems that I have found in it.
“Bug fixing often uncovers opportunities for refactoring. The very fact that you’re working with code that contains a bug indicates that there is a chance that it could be clearer or better structured.”
“As a rule of thumb, for every user who tells you about a problem, there will be between 10 and 100 other users who experienced the same problem and didn’t think to get in touch.”
“Once you start to get on top of your quality issues, you’re going to want to start refactoring the old, crufty, untested code. And you should – the point of exercise is to clean up problems, and refactoring is a key element of that process. Remember, however, that refactoring crucially depends upon the support of an extensive suite of automated tests. Without tests, you’re not refactoring. You’re hacking. So, how do you refactor untested code? You don’t. The first thing you do is to write the tests.”
Source: “Debug It!”, Paul Butcher, Pragmatic Bookshelf, 214 pages
Linkopedia November 2008
Published November 12th, 2008 Under Links, Software Development | Leave a Comment
38 Software design tips from the creator of C++ gives useful software design tips from Bjarne Stroustrup
Agile Chronicles #1: Stressful The Agile Chronicles is a set of articles documenting my experiences using an Agile process (Scrum) in software development.
Refactoring Service Dependencies to Separated Interface This post presents a common scenario wherein business logic is tightly coupled to a service and provides instruction for refactoring the concrete dependency to a more testable and loosely coupled configuration.
Understanding Models, Views, and Controllers. This tutorial provides you with a high-level overview of ASP.NET MVC models, views, and controllers. In other words, it explains the ‘M’, ‘V’, and ‘C’ in ASP.NET MVC.
Build seven good object-oriented habits in PHP. With PHP’s object-oriented (OO) language features, if you aren’t already creating your applications with OO principles in mind, these seven habits will help you get started in the transition between procedural programming and OO programming.
Writing Testable Code. Misko Hevery made a presentation at Google Tech Talks about unit testing. He tells us that “There is no secret to writing tests… … there are only secrets to writing testable code!”.
Concordion. Concordion is an open source framework for Java that lets you turn a plain English description of a requirement into an automated test – an active specification.
Roma Framework. Roma allows you to develop enterprise level Java applications with low effort following a real Domain Driven Design approach.
Testability-explorer. Testability-explorer is a tool which analyzes java byte-codes and computes how difficult it will be to write unit-test.
More interesting links on the software development links directory, the software development articles directory or the software development videos directory