Ontogeny of Unit Testsin Test Driven Development

Post on 24-May-2015

330 views 0 download

Tags:

Transcript of Ontogeny of Unit Testsin Test Driven Development

Ontogeny of Unit Testsin

Test Driven Development

June KimPresident, Agile Consultingjune@agileconsulting.co.kr

Good Software

Nature of Order

Christopher Alexander

Living Structure

Wholeness

Life

Which one of these two things

would I prefer to become by the day of my death?

Comparing A and B,

which one makes me feel the most wholeness in myself,

which one allows me to come closest to my own life,

which makes me experience life most deeply?

Mistake-free

Ontogeny

Morphogenesis

Differentiation

Structure Preserving Transformation

Henry Matisse

Center

Pattern

Sequence

Living Process

Unfolding

Generative

1. think about the activities in your kitchen and formulate them as generic centers2. decide the size and shape of the kitchen3. place windows in the kitchen, to bring beautiful light into the room4. place a big kitchen table as the main focus of the kitchen5. place a fireplace to form a secondary center in the room6. place an outdoor kitchen garden, according to sun and wind and view7. place a door leading to the outdoors8. place the kitchen counter and your workspace in a good relationship to the main centers9. put in thick walls around the room, to supplement the table, fire, and counter

unfolding sequence of kitchen design

Do one small good thing; then do another small good thing; then do another good thing

After a person has grasped that idea, I may then point out that sometimes, the good things that we do work even better if each small good thing also helps to achieve some slightly larger good thing.

How to improve a corner of a garden

15 Properties

15 Properties of Natural Morphology

1. Levels of scale 2. Strong centers 3. Boundaries

4. Alternating Repetition 5. Positive Space 6. Good shape

7. Local Symmetries 8. Deep Interlock and Ambiguity 9. Contrast

15. Not-separateness 13. The Void 14. Simplicity and inner calm

10. Gradients 11. Roughness 12. Echoes

15 Transformations

Levels of Scale

Strong Centers

Boundaries

Alternating Repetition

Positive Space

Good Shape

Local Symmetries

Deep Interlock and Ambiguity

Contrast

Gradients

Roughness

Echoes

The Void

Simplicity and Inner Calm

Not-Separateness

Media Art

Programming Demo

Luhn Algorithm

8763: 1+6(8*2) + 7 + 1+2(6*2) + 3 mod

10

return 60;

5 주

First center

6 주

return 5 + 4 + 9 + 4 + 1 + 7 + 3 + 5 + 7 + 3

Strong CentersLocal Symmetries

8 주

return (1+4) + 4 + (1+8) + 4 + (1+0) + 7 + (1+2) + 5 + (1+6) + 3

Local SymmetriesAlternating Repetition

8.5 주

result = reduce(14) + 4 + (1+8) + 4 + (1+0) + 7 + (1+2) + 5 + (1+6) + 3;

return result;

Strong Centers

9 주

result = reduce(14) + 4 + reduce(18) + 4 + reduce(10) + 7 + reduce(12) + 5 + reduce(16) + 3;

return result;

Local Symmetries

10 주

result = reduce(7 * 2) + 4 + reduce(9 * 2) + 4 + reduce(5 * 2) + 7 + reduce(6 * 2) + 5 + reduce(8 * 2) + 3;

return result;Local Symmetries

13 주char *s = “7494576583”;

result = reduce(dat(s, 0) * 2) + dat(s, 1) + reduce(dat(s, 2) * 2) +

dat(s, 3) + reduce(dat(s, 4) * 2) + dat(s, 5) + reduce(dat(s, 6) * 2) + dat(s, 7) + reduce(dat(s, 8) * 2) + dat(s, 9);

return result;Good Shape

15 주char *s = “7494576583”;

result = reduce(dat(s, 0) * 2) + reduce(dat(s, 1)) + reduce(dat(s, 2) * 2) +reduce(dat(s, 3)) + reduce(dat(s, 4) * 2) + reduce(dat(s, 5)) + reduce(dat(s, 6) * 2) + reduce(dat(s, 7)) + reduce(dat(s, 8) * 2) + reduce(dat(s, 9));

return result;Strong CentersEchoes

20 주char *s = “7494576583”;

pos = len = strlen(s);for (i = 0; i < len; i++) { if ((pos – 2) % 2) result = result + reduce(dat(s, i)); else result = result + reduce(dat(s, i) * 2); pos--;}

return result;Simplicity and Inner Calm

30 주char *s = “7494576583”;

len = strlen(s);for (i = 0; i < len; i++) { if (((len-i) – 2) % 2) result += reduce(dat(s, i)); else result += reduce(dat(s, i) * 2);}

return result;

40 주

len = strlen(s);for (i = 0; i < len; i++) { if (((len-i) – 2) % 2) result += reduce(dat(s, i) * 1); else result += reduce(dat(s, i) * 2);}

return result;

42 주

len = strlen(s);for (i = 0; i < len; i++) { result += reduce(dat(s, i) * (2-(len-i) % 2));} return result;

int dat(char *s, int i) {return s[i]-'0';}int reduce(int n) {return n>=10 ? n-9 : n;}

int coef(int l, int i) { int ri=l-i, even=!(ri%2); return even+1;}

int checksum(char *s) { int i, result=0, l = strlen(s); for (i = 0; i < l; i++) result += reduce(coef(l,i) * dat(s, i)); return result;}

Applicationsto larger scale

such as… Features

Wrap Up

?/!