diff --git a/README.md b/README.md index e43316c..88e244b 100644 --- a/README.md +++ b/README.md @@ -1,10 +1,20 @@ jrefactor ========= -refactoring improving the design of existent code. - This is the first example of the book: +Refactoring improving the design of existent code. + +I usually want to start with the first example of the book but happens that +I have to +create the project, copy and paste the sample code and write a solid set of +test, this delays me in the refactoring activities. + +So if you want to start right away with the first sample of the book, +you can download this project. You will have already the project and the tests. + + +------------------------------------------------------------------------------ "Refactoring improving the design of existent code" What are your impressions about the design of this program? @@ -46,7 +56,7 @@ don't expect to change, then cut and paste is fine. -- epa !! If the program is long lived and likely to change, then cut and paste is a menace. -This brings me to a second change. +This brings me (the author) to a second change. The users want to make changes to the way they classify movies, but they haven't yet decided on the change they are going to make. They have a number of changes in mind. These changes will affect both the way renters are charged for movies and the way @@ -55,10 +65,12 @@ that whatever scheme users come up with, the only guarantee you're going to have is that they will change it again within six months. -The statement method is where the changes have to be made to deal with changes in classification and charging rules. +The statement method is where the changes have to be made to deal with changes in +classification and charging rules. If, however, we copy the statement to an HTML statement, we need to ensure that any changes are completely consistent. Furthermore, as the rules grow in complexity -it's going to be harder to figure out where to make the changes and harder to make them without making a mistake. +it's going to be harder to figure out where to make the changes and harder to make +them without making a mistake. You may be tempted to make the fewest possible changes to the program; after all, @@ -69,3 +81,34 @@ It is making your life more difficult because you find it hard to make the chang your users want. This is where refactoring comes in. +--------------------------------------- +Some important things to remember +--------------------------------------- + +Tip +When you find you have to add a feature to a program, and the program's code is +not structured in a convenient way to add the feature, first refactor the program +to make it easy to add the feature, then add the feature. + + +Before you start refactoring, check that you have a solid suite of tests. +These tests must be self-checking. It is essential for refactoring that you have +good tests, the test give you the security you need to change the program. + + +Tip +Before you start refactoring, check that you have a solid suite of tests. +These tests must be self-checking. + +Tip +Refactoring changes the programs in small steps. If you make a mistake, + it is easy to find the bug. + +Tip +Any fool can write code that a computer can understand. Good programmers write +code that humans can understand. + + + + +It is a bad idea to do a switch based on an attribute of another object.