13. Distinguish Good Design
To the point Readable Simple
Predictable/ Modifiable Testable
Uncoupled
14. Where to refactor first?
Point Readable Simple Predictable Modify
/uncoupled
Dup code Renaming Switch Refused Parallel
Large class Long method bequest hierarchy
Lazy class Large class Feature
Speculative Envy
generality Intimacy
33. class ShapePainter {
public void Paint(int scale); }
class AreaRenderer {
public void Render(int multiplier); }
class DrawController {
void DrawObject(object o) {
if (o is ShapePainter)
((ShapePainter)(o)).Paint(1); } }
34. Extract interface
interface IShapePainter {
void Paint(int scale); }
class ShapePainter : IShapePainter {
public void Paint(int scale); }
class AreaRenderer : IShapePainter{
Use iface
public void Paint(int multiplier); }
ren
Use iface
void DrawObject(IShapePainter o) {
o.Paint(1); }
35. class ShapePainter {
public void Paint(int scale); }
class AreaRenderer {
Extract interface
public void Render(int multiplier); }
class DrawController {
void DrawObject(object o) {
if (o is ShapePainter)
((ShapePainter)(o)).Paint(1); } }