763494a
|
Encapsulation is important, but the reason why it is important is more important. Encapsulation helps us reason about our code.
|
|
|
Michael C. Feathers |
9ad72f0
|
Remember, code is your house, and you have to live in it.
|
|
|
Michael C. Feathers |
332ac3b
|
To me, legacy code is simply code without tests.
|
|
|
Michael C. Feathers |
bf8e432
|
In a well-maintained system, it might take a while to figure out how to make a change, but once you do, the change is usually easy and you feel much more comfortable with the system. In a legacy system, it can take a long time to figure out what to do, and the change is difficult also.
|
|
|
Michael C. Feathers |
afb3f01
|
Encapsulation is a good thing, right? Well, don't ask testers about that; they are liable to bite your head off. Classes that are too big often hide too much. Encapsulation is great when it helps us reason about our code and when we know that certain things can be changed only under certain circumstances. However, when we encapsulate too much, the stuff inside rots and festers. There isn't any easy way to sense the effects of change, so peo..
|
|
|
Michael C. Feathers |
38926a4
|
How do I test private methods?" Many people spend a lot of time trying to figure out how to get around this problem, but, as I mentioned in an earlier chapter, the real answer is that if you have the urge to test a private method, the method shouldn't be private; if making the method public bothers you, chances are, it is because it is part of a separate responsibility. It should be on another class."
|
|
|
Michael C. Feathers |
f7dd37f
|
Big classes can hide too much. This question comes up over and over again from people new to unit testing: "How do I test private methods?" Many people spend a lot of time trying to figure out how to get around this problem, but, as I mentioned in an earlier chapter, the real answer is that if you have the urge to test a private method, the method shouldn't be private; if making the method public bothers you, chances are, it is because it i..
|
|
|
Michael C. Feathers |
a988def
|
The most subtle bugs that we can inject are bugs related to inheritance.
|
|
|
Michael C. Feathers |
d914123
|
Over time, the system will get better as long as people aren't introducing duplication behind your back. If they are, you can take steps with them short of physical violence, but that is another issue.
|
|
|
Michael C. Feathers |
31d33cf
|
Effective software change, like effective surgery, really involves deeper skills. Working with care doesn't do much for you if you don't use the right tools and techniques. Cover
|
|
|
Michael C. Feathers |
88a1b8b
|
Superficially, Edit and Pray seems like "working with care," a very professional thing to do. The "care" that you take is right there at the forefront, and you expend extra care when the changes are very invasive because much more can go wrong. But safety isn't solely a function of care."
|
|
|
Michael C. Feathers |
961f3b4
|
The fact remains: Good design is testable, and design that isn't testable is bad.
|
|
|
Michael C. Feathers |
1ceab63
|
we can't let "best" be the enemy of "better."
|
|
|
Michael C. Feathers |
0dc0ba6
|
Teams take serious chances when they try to make large changes without tests. It is like doing aerial gymnastics without a net.
|
|
|
Michael C. Feathers |
c8e440b
|
system will get better as long as people aren't introducing duplication behind your back. If they are, you can take steps with them short of physical violence,
|
|
|
Michael C. Feathers |
9b5b227
|
brush, Pattern *backdrop) {
|
|
|
Michael C. Feathers |