Watch the video online: http://vimeo.com/79181633
Even in an agile world, specifications often go too far and describe solutions with too much details; all these premature decisions constraint the implementation and remove opportunities. There is a remedy: refactoring the specs, even before refactoring the code.
In the TDD cycle, refactoring is the art of restructuring the code to make it simpler, without changing its behavior at runtime. A key part of refactoring is to recognize and extract duplications.
Refactoring is very useful at the code level, and it is even more powerful when applied during business analysis or functional architecture. We will show how the practice of refactoring directly "at the business domain level" can simplify the problem, and therefore the resulting implementation code, by orders of magnitude. This means much less code to write, to test and to maintain, and much less defects as a result.
We will introduce 5 patterns on how to refactor at the business-domain level, such as "Make It Systematic" and "Degenerate Case". We will also explain some limits and the required mindset.
This approach of refactoring has been used on several real-world projects and is derived in particular from DDD and from Specification by Example.
18. (with BDD)
3M
ond on EURIBOR
ate b
en a floating r 5M EUR
Giv
f 1
And a nominal o
15
ate of 2011/06/
And an issue d of 2012/06/14
And an end date UAL calculation period
And an SEMI_ANN
es:
URIBOR 3M evolv
When the E
5% |
2011/09/15 | 3.
|
0% |
2012/03/15 | 4.
|
re:
e cash-flows a0 |
Then th
2300
| 2011/12/13 |
0 |
12/06/14 | 2550
| 20
19. DONE
double sum = 0;
for (CashFlow cf : cashflows){
double df = 1 + rate * t;
sum += cf.getAmount() / df;
}
return sum;
71. Beware!
t o o Do n’t b e
n’t g o
Do
t h an
e r i c sm a r t e r
ge n
make
Mus t
e nse
e ss s
b us i n
i ne s s
b us
p e o p l e ...)
us t a l i t t le bi t
(o r j
f or f un
o t jus t
N
99. e nds
"De p
duc t "
e pro
on th
EUR
product
qty * price
non-EUR
product
qty * price * fx rate
ccy/EUR
MUR, IQD...
qty * price * fx rate
ccy/USD
* fx rate
except MUR, IQD...
product
USD/EUR
100. duc t "
e p ro n cy
o n t h u r re
e nds
"De p
c
EUR
product
qty * price
non-EUR
product
qty * price * fx rate
ccy/EUR
MUR, IQD...
qty * price * fx rate
ccy/USD
* fx rate
except MUR, IQD...
product
product
USD/EUR
101. pe nds
"De
e n cy"
e cur r
on th
EUR
product
non-EUR
product
except HKD, ZAR...
HKD, ZAR...
product
qty * price * currency
conversion
102. Systematic
qty * price * currency
conversion
r re n cy
Se e C u
(
s i ne s s
io ns b u
o n ve rs
C
h e re )
e s e lse w
r ul