* **
* ( ** )
2
(BUG
; demo ) (
: www.AgileMethod.csie.ncu.edu.tw k
!
4
vs.
( ( ) )
:
5
p.288 p.323
(information) (object) (relationship) (abstraction) ( : 0,1) 0,1) (computer software) (information) : (software) NO!
8
( ** (
*) *)
(
(Test(Test-driven development,TDD)
* ** ( ( cognitive informatics) modal logic)
Bossavit *
(Cont.)
Bossavit (passion) (daring) (glamour) , :
(courage)
11
--
? ! ( , , )
? e
12
(Cont.)
: A :IKEA , B : C : C ( A ) , , , , , ,
13
*
( , , , , : ) ,
, 2009.11.29.
14
( ,
) ,
, , ,
15
Agile
(agile) :
1)
:
2)
:
16
1)
:
17
Communication Channels
A. Cockburn, Agile Software Development, p.95,Addison-Wesley, 2002. p.95,Addison-
18
(
(
)
)
20
Document Communication
21
Document Communication
( , , command file : 1) 2)
22
)-
. ? ) ) . . , ,
?
face to face communication document communication ( CMMI*)
demo bugs
* Capability maturity model integrated (CMMI) Mellon University (CMU) Carnegie
24
(communication channel)
(communication purpose)
25
A. Cockburn,
: ) ) )
26
(Cont.)
2) Cockburn , ( ,
28
pair programming) , ,
(Cont.)
( , ,
, ,
,video ,
, video
30
CMMI and
CMMI Level 2 (project management) CMMI Levels 3,4,5 (engineering and process management) * m
* Sison and Yang, Use of Agile Methods and Practices in the Philippines, Asian Pacific Software Eng. Conf. (APSEC), Nagoya, Japan, 2007.
31
CMMI and
CMMI level 5 *:
(Cont.)
: validate .
32
* Jacobsen et. al., Mature Agile with a Twist of CMMI, Agile 2008.
XP 2010 Report*) ,
(Best Experience Norway : (work item) (work flow) ; timetimeboxed iteration ( ) . CMMI : CMMI , : myAgile ,
CMMI and
(Cont.)
CMMI
( (
34
(Cont.)
(Extreme
) XP
( CMMI
35
(Cont.)
36
: 1. ( 2. 3. 4. 5. ( ( ( ( ( ) ) ) ) )
38
(Osmotic Communication)
(ear contact) (eye contact)
)
39
caves
40
(Cont.)
common Common : cave ( Cave : : pair programming)
30
( ) ( ) : BUG
BUG ( : ?
! )
42
1. 2. 3. (
test code
4. 5. ( 6. 7. 8.
hypertext (
hyperlink) )
!!
43
!
[ 2006]
: cost down
44
(Cont.)
Slow, but Firm (slow) , , ! , Bugs, , (firm) ,
45
Cost Down
Cost Down , : , , ,
* Paul Hawken, : ,
, , ,
cost down, , ,
, 2005.
46
*
, , 4.5 , ; ( , )
47
; (1.36 )
(Cont.)
, 1) 2) 3) , 4) ( 5) U-Pod , , ! ! , , , build ) Central Desk eye contact ear contact
48
: ,
(Cont.)
information radiator ( ) , ! kanban ( ), (just in time) , ,
49
(Cont.)
50
51
developers
bugs
52
100%
53
Kanban
transparency
cooperation
* Olav Maassen & Jasper Sonnevelt, Kanban at an Insurance Company Are You Sure?, XP 2010.
54
waterfall
scrum transparency
Kanban
unit
agile method
kanban
Not Started
In Development
Done
Internal acceptance
Not Started
In Development
Done
Customer acceptance
* Susan Hunter ,Google Culture Ideal For Agile & Kanban,XP2010 video.
Kanban ( queue
* ** (evolve) m
, , 1972, The Discipline of Design, by Roe,Soulis,and Handa. ** , , 2008, Cradle to Cradle, by McDonough and Braungart. *** 2009 , ,2010 , !
60
(Cont.)
( , , ,
* , ( ), ,2010,pp.163-164. ,2010,pp.163-164.
61
, .
62
, * : 1) 2) , (concentration) (determination), ,
* , , , 2006.
63
, , . , . , , *
* , ,
, , ,
, 2010.12.24.
64
?
( : : , , : 90 30 65
?(Cont.)
, ( . , ! , , . ( , , )
66
, ) 2) : ( ),
:1)
?(Cont.)
: , , ? , : , ,
67
?(Cont.)
Microsoft 1) 2) 3) ,
* , 2010.11.8, p. 30.
68
*: ,
(
A. Cockburn 1. 2. 3. 4. 5. :
Getting to meeting on time Answering questions from other people Bothering to mention things they notice Following group coding conventions Using code libraries
[ 2009.9.20]
,
69
Cockburn
70
1.
: ? *
2.
: ( embedded systems)?
*
71
? : ( * ** * ** m ) ( ( ) )
72
(Cont.)
2008 t , , ; , : ,
, ( , , , ? )
73
(Cont.)
: ! : :
74
(Cont.)
: coding , API (application program interface) , ! : : scenarios, acceptance test cases; CRC ; unit test cases ; , , . , !
75
(Cont.)
(O(O-O) discussion ? , : ; , m * panel (reuse) , o O-O
76
(Cont.)
, O-O, , classes (reusable) classes scenarios scenarios ,
77
(Cont.)
, , device,
, ,
78
(Cont.)
(data structure) . , class interface , class ,class method , Big O method Worst time, Average time, : array, , !
79
(Cont.)
, , : ,
(Compiler)
. , : scanner, parser, intermediate code generator, assembly code generator. scanner, parser , ! ,Operating System, Data Base System Compiler , , !
80
(Cont.)
( ) , ( ,
81
, )
(Cont.)
MIT CSAI Lab ! ), security, compiler 2010
* ** , 2010.7. , 2010.11.1.
Victor (
* )
: : ( operating system,
, **
82
(Cont.)
( ; 2.8% * , Store , (htc) . , 2011
* ** *** , 2010.9.20. , 2011.4.11. , 2011.2.22.
), 15%, App
, ; ; ** ,
, iPhone
83
( : *
)?
? *
C C , ( ) ,
84
(Cont.)
: O-O O! : O-O O; ; Java (O-O) (O85
O-O
C++
(Cont.)
: O-O : (extend) ( X Y), polymorphic reference (x X subclass Y object) dynamic binding (whatIAm() bind method), . ,
86
An Example of Extension
/* */public class X { int a; */public public String whatIAm() {return Im an X.;} } //end of class X /* */public */public class Y extends X { int b; public String whatIAm() { return Im a Y.;} } //end of class Y
87
public static void main (String[ ] args) throws IOException { X x; // reference x is declared to be of class X BufferedReader reader = new BufferedReader (new InputStreamReader (System.in); if (reader.readLine().equals ( X)) x = new X(); // x points to an object of class X else (reader.readLine().equals ( Y)) x = new Y(); // x points to an object of class Y System.out.println (x.whatIAm());//dynamic binding } // end of main
88
(Cont.)
, class class relationships (aggregation, use, and inheritance) ,
,
89
(Cont.)
: , : ), , , , !
90
, , (
(Cont.)
: , : Notebook , (PC ) , , ! Java , :
91
, 1) 2) 3) , ,
, run ,m , , (
, )
, ,
: ? ?
92
(Cont.)
2009 396 , *** 2010 800 , , (
* ** *** , 2009.11.6. , 2009.11.30. , 2010.9.5 ****
, ; **
* , 12 , ****
, ), ,
2010.9.30.
93
, , , , , , , , , ; , , , , ! . , ,
94
(Cont.)
, , ( , , Bella Vita, , , , , !
95
! )
, , , , , !
(Cont.)
, , ( , * 2011
* , 2010.8.10.
, , ) !
96
(Cont.)
7500 : , ,
, ! (Jason Wu) !
97
(Cont.)
* ( , , ) , . **, ! GDP , , :
***
* John & Doris Naisbitt, The 8 Pillars of a New Society: Chinas Chinas Megatrends, , , 2009.10.26. ** *** , , , , 2009.5.1, pp.186-191. pp.186, , 2011.2.1, pp. 112-113. 11298
(Cont.)
2010 , ,120 , , 600 ! ), , (
99
(Cont.)
2010 : , , , , , , , , ,
100
(Cont.)
2010 , , , , , , .
,
101
(Cont.)
Economic Cooperation Framework Agreement (ECFA) ; , , , !
102
( ) , ? , ?
(Cont.)
: ; ,
4.6 , )
, m , ,
,
103
(Cont.)
104
(Cont.)
Regent
* , 2010.4.17.
105
(Cont.)
, , (Regent), * : ,
* ** , 2010.8, pp. 356-357. 356, 2010.9.20.
106
, , **
(Cont.)
, , 85
*
, ,
C
, 2010.9, pp. 266-267. 266-
107
(Cont.)
, , (Herb Garden), , , ,
108
, ,
, 750 ,
(Cont.)
(Chris)]
109
(Cont.)
(Chris)]
110
(Cont.)
(Cont.)
: , ; * : , t , ,
, 2010.12.18.
112
(Cont.)
2010 , : , , , , , , , , ,
113
Evian, , , , , . , , , ,
IBM,
.
114
(Cont.)
, ) CMMI), , , process ! ( ( , !
115
* , , ,
: ,
O-O ,
* , 2010.6.28.
116
2007 ( ) .. :
117
LUXGEN (for
) ,
118
(Cont.)
[web site
, Sep. 2009] ,
119
(Cont.)
(Runes of Magic) , . (35 ) (31) , , ,2005 . , , ! 13 , , 4000 , 800
, 2010.8, pp. 366-367. 366120
(Cont.)
, android , , 1100 , , ,
* , 2010.7.19, p.44.
121
122
*
) ( ( Unified Modeling Language, UML : )
?
*( 200 ?
* * ***
50
125
: 1)system analyst (SA), 2)system designer (SD), 3)programmer (PR) project manager (PM) designerdesigner-programmer developer (1 2 programmers 2 developers in pair-programming; 3 4 pair2 pairs) ( ) SA PM developer test cases test code
126
(Cont.)
: Coach ( ) Coach :
127
(Cont.)
Diversity and Software Development Scott E. Page** : m *
*IEEE Software, May/June 2009. ** XP 2010, Norway, keynote speaker. *** , , ,2009.8.31. ,2009.8.31.
128
: :
!)
129
) ( )
130
data) ) )
(Cont.)
( ( : : ,
) Microsoft WORD)
132
(Cont.)
,
133
(Cont.)
:
134
(extreme)
1) 1) 3)
2) 2) JUnit
135
Cockburn
) 2.5%
(Cont.)
k *: (The Curse of Knowledge)
myAgile
,
* Made to Stick: Why Some Ideas Survive and Others Die), 139 ( ), , 2007, pp. 29-30. 29-
(Cont.)
: ! : ? :
140
(Cont.)
: (knowledge) user : user : 2F , , (sign) , knowledge?
141
, ,
(Cont.)
: debugger debugger
142
(story) (scenario)
CRC(
(Cont.)
O-O
144
145
1961 v
: !
146
(Cont.)
Nordstrom
1) 2) ) ?
Macy (
Ans: 2)
147
XP 2010 Best Research Paper* , , Fagei action research agile method. : redundant knowledge, . action Scrum meeting team estimate of tasks action ,
* T.E. Fagei, Adoption of Team Estimation in a Specialist Organizational Environment, XP 2010, Norway.
148
149
XP Core Practice
1. Fine scale feedback . TestDrivenDevelopment via ProgrammerTests and ProgrammerTests CustomerTests CustomerTests (were UnitTests & AcceptanceTests) UnitTests AcceptanceTests) PlanningGame WholeTeam (was OnsiteCustomer) OnsiteCustomer) PairProgramming 2. Continuous process rather than batch ContinuousIntegration DesignImprovement (was RefactorMercilessly) RefactorMercilessly) SmallReleases
150
151
XP values
[wikipedia]
Extreme Programming initially recognized four values in 1999. A new value was added in the second edition of Extreme Programming Explained. Explained. The five values are: Communication Simplicity Feedback Courage Respect
Respect
The respect value manifests in several ways. Team members respect each other because programmers should never commit changes that break compilation, that make existing unit-tests fail, or that otherwise delay the work of unittheir peers. Members respect their work by always striving for high quality and seeking for the best design for the solution at hand through refactoring. Adopting four earlier values led to respect gained from others in team. Nobody on the team should feel unappreciated or ignored. This ensures high level of motivation and encourages loyalty toward the team, and the goal of the project. This value is very dependent upon the other values, and is very much oriented toward people in a team.
153
Agile
In 2001 in Utah, agile was coined by agile the Agile Alliance to stress importance of: being able to respond to changing requirements within the project time frame. Lightweight was not adopted because it Lightweight was regarded as too much of a reaction against something (heavyweight), and not enough of a belief in something.
154
Agile revisited
2001 Utah , (Agile Manifesto), ,Agile 2011 conference Utah, keynote speaker ,
155
Agile Method
values Individual and interactions over processes and tools. 2) values Working software over comprehensive documentation. 3) values Customer collaboration collaboration over contract negotiation. 4) values Responding to change over following a plan.
156
1)
myAgile
157
1.Pair Programming
v j
(drive) (review)
2) 4)
:[
]
159
161
1. 2. 3. 4. 5. 6. (
pair programs.( (
) )
Pair Programming
(Silver)]
163
after adjusting, pairs produced code 15% more slowly than individuals...
reference: http://qconsf.com/sf2008/file?path=/qcon-sanfran2008/slides//NealFord_10_Ways_to_Improve_Your_Code.pdf
Rotation (
)
167
,
168
:interface ( interface
169
Reuse
vs. Refactor
, Reuse( , )
( open source) : )
Refactor( , ,
, df
170
3. Continuous Integration .
public method code ( ) ( method methods : method
171
unit test )
integration phase
Method
173
4. Simple Design
* CRC 1) class 2) classes ( (
* [IKEA >
) : (interface) : ) )
] > >
class
174
5. Release (
( ( ) (user stories) ( )
175
6. Iteration (
( ) j * (
* release ** (
)
( ) **
)
:Ruby/PHP Java ) 5 2-3
176
6.
method
(Cont.)
: class
(user story)
177
(
* , : , ,
178
Communication Cycle
Pair Programming with On-site Customer 1..N Bugs CYCLE TIME 5 seconds CYCLE TIME 1 day 1..N Methods CYCLE TIME 0.5day 1..N Iterations CYCLE TIME 3 weeks 1..N Questions 1..N Increments CYCLE TIME CYCLE TIME 5 seconds (Not in XP) 2 months
179
(on-site
(Cont.)
TestTest-driven development (TDD) test case, test code, test tool TDD (check) (review) Test :
181
(Cont.)
O-O class class ?
182
Csikszentmihalyi
[t
:k's ntmiha: i] *
: (good work)
(extreme)
* Csikszentmihalyi, Creativity: From Flow Experience to Good Work, , Nov. 29, 2006.
184
1.
Clear goals in
every step of the way. 2. Immediate feedback to ones action. (1)(2) 3. ( ) Balance between challenges and skills. (3)
( A,B,C,D E) E (flow, extreme) extreme)
185
C A
186
(Good work)
(productive activity): 1. ( craftmanship) (meet the requirements of the craft) 2. (socially useful and valued) 3. (personally rewarding)
187
Attention is focused on a limited stimulus field. Full concentration and complete involvement.
189
m :
* XP sustainablePace
!
191
192
*
** : 1) : 2) :
* ** ,
(
,
,2006. scenario
193
: 1) 2) 3)
194
(Cont.)
195
(Cont.)
:
[ 2009 ]
196
1) 2) 3)
4)
198
199
* myAgile
1. 2. 3.
200
myAgile
myAgile (Extreme Programming, XP) ( ) -
)
201
myAgile
* 0. 1. 2. 3. 4. 5. * 6. * 7. 8. 9. * 10. (*
(11
(Exploring requirements) (Scenario) (Acceptance test case) (CRC session) (Dispatching and Scheduling) (Unit test code) (Data Structure Design) (Algorithm Design) (Coding) (Unit & Acceptance testing) (Reverse Engineering Tool) 4 , 7 Extreme Programming)
myAgile
203
myAgile
Java,C++,C# (mark(mark-up language) agent :C/C++ O-O , semanticWeb) ontology,
0. * (Exploring requirements)
: 1. : ( 2. 3. 4. ) (2) ( ) ( ) ( ) ( )
0.
5. : feature ( attribute ( constraint( preference( ) 6. : : : :
(Cont.)
) ) 1.75 ) 1 0.05
206
1.
(Scenario)
(on(on-site usage expert)( ( feature) A4 )
editor : password
1. 2. *
welcomeScreen ( mainScreen (
)* )*
207
1.
(Cont.)
) (
208
3.
(
(CRC Session)
CRC(Class,Responsibility, Collaborator)
) (partition) , (object) (object interaction method) (hidden objects), (CRC card, A4 ) 1.Class name (C), 2. Responsibility (R),( method) 3. ( responsibility) Collaborator (C) CRC cards class encapsulation, (3) (class interfaces) (1)(2) class use relationship
210
3.
1. accep. test case object object A4
(Cont.)
: method method
2.
class methods class ( CRC) 3. A4 ( classes ) class interfaces ( ) 4. method header (method description, parameters, return value, exceptions) 1.parameters 5 (magic 7 minus 2) 2.return value object, class 3. global variables
211
3.
CRC , user (hidden objects,
(Cont.)
(partition) )
**
:
*
parameter
212
3.
:
(Cont.)
; ;
)};
( .
); ( );
213
3.
: User Story ( Scenario : Use Case : ( ) :
(Cont.)
214
, , * ** ( ), *** * The method gets two input arguments. ** then, it executes the method, *** finally, it sends return value.
215
: O-O !
Class Interface
1. class names, method names (O(O-O) names O-O ! class
2.
Class interface
Class Interface
Selection Sort class interface : public class mySort { /* data structure ( )*/ public mySort (int inputArray[]){ } public int [] sort () {} } // end of mySort method interface
218
: 1. 2. 3. 4. class names, public method names ( ) names class names 100 names
80 O-O 80%
219
?
(domain knowledge)
(domain experts)
class Names BalanceSheets, Accounts ; Object Name sep09Account; method Names debit , credit
220
Header (
221
(header)
open source (reuse code) (developed code) 1) ( ) 2) (Big O time estimate) (small project size, team size) (big problem size)
222
(Cont.)
( )
223
Interface
, , : , : , , debug source code, : API (application program interface) header
224
Header(
Header
, ,2006] [
)
,R. Williams
: (
1. 2. 3. 4. 5.
( (
) )
225
Header(
/* method subString ---------------------------------------------* A String object method indexes * * @param beginIndex index ( index) * @param endIndex index ( index) * @return beginIndex endIndex * * @throws IndexOutOfBoundsException * if beginIndex or * beginIndex endIndex or * endIndex length() * * Time estimate : O (n) * Example: helloworld.subString(3,6) ; low -------------------------------------------------------------------------*/ public String subString (int beginIndex, int endIndex)
226
/* class EventDetectionThread ----------------------------------* * thread detector, start , 0.5 (500 ms) ./buffer (fetch) event information(.xml) path * observer ( event parser) path. * , null. * * Example: * ./buffer event information: * * 091123153040000.xml ( ) year09 mon11 day 23 * 091123153040500.xml * 091123153041000.xml ( ) * * detector 091123153040000.xml
*------------------------------------*/
: detector=new EventDetectionThred(); abstract
1)scenario, 2)acceptance test case, 3) ( ) 4) (maintenance guide): acceptance test case method source code file method header pseudopseudo-code source code
228
accep. test cases case : method 1 (source code file) method 2 (source code file) case : method 1 (source code file) method 11 (source code file) method (source code file) method 12 (source code file) method 2 (source code file)
229
230
(Cont.)
:
class class { { } =new ();
:
(inherite)
class diagram
;1 (use)1
232
(Cont.)
{ public class {} class {private boolean ; public void ( ) {/* */ = . =new (); =new (); 1 = new ( ); 2 = new . ( 1) ; . ( 2) class diagram classes:
233
class class
extends
( ); } ( );
(Cont.)
; ;
e e
234
(Cont.)
: : : ? O-O !
( ( )
235
4.
*
* l k
236
237
4.
Release (
(Cont.)
vs.Iteration j *) (pace) (strong heart-beat) heart(methodology tune-up) tune ) **
(
* Ruby/PHP( ** (
Java) evolve)
238
Release Iteration
Increment
1 1
2 1+ 2= 2
239
5.
class
public method ( unit) (test cases) ( null input) ( exceptions handle ) (input) (expected output) (unit test case) (test code)
240
*/
242
input parameters (p1,p2), output object (o2) , , test case o1 (object 1) , setter object data value *
, arguments, method parameters
243
method interface:
*/public int add (int a,b) {}
1.a,b
, ,
, ) , )
Case 1: a is 1, b is 2 ( Case 2: a is 1, b is 0 (
2. 3. 4.
9 test cases test code source code { return a+b;} Junit test code source code
244
class data
tree array
245
6.
(Cont.)
Java Collections Framework (JCF) * classes 1.List <1,2,3>: ArrayList, LinkedList 2.Set {3,1,2}: TreeSet, HashSet 3.Map {1->a,2->b,3{1->a,2->b,3->a}: TreeMap, HashMap Heap, PriorityQueue ( Network) JCF method Big O method Big O for each i 1 N call TreeSet method with O(logN) end for
* Collins,Data Structures and the Java Collections Framework, Collins,Data McGrawMcGraw-Hill, 2005.
246
An Example
:
10.0 7.4
8.3
adjacencyMap
0 null 0 hash 17 68899 key value null next null to 20.0 29
-303674281
null
57
2599292 10.0
null
85
72266597
null
95
2390765
null
100
8.3
null
249
6.
(Cont.)
(array)
250
7.
sketch) (pseudo code)
(Algorithm Design)
(design
(abstraction levels) trace test case debug (time estimate) O(n3) private method ( (group review) )
251
Why
XP : 1. ( 2. (design sketch)
252
Design Sketch
design sketch
0 3 0 1 1 1 .. .. 2 4 nn-1 2 n-1 2
select
min 0
1 .. n( i ) ..2 3 4
0 1
1 .. n( i ) .. 2 3 4
n-1 2
select 1
min i ~ n-1
0 1
1 2
..
.. n-2 ( i ) 4
n-1 3
n-2
0 1 1 2 .. .. 2 3 nn-1 4
sort
253
254
255
Pseudo code
Pseudo code x (English Term) ( class name method name
variable name
( x )
min
256
(English Term)
review
257
Method
boolean buy (Desks myDesk) boolean buy (Tables hisTable) methods
258
(Cont.)
(sticky )
: WT0820 : TW2008
(Cont.)
WT0820 TW2008
2008
260
Pseudo code
1. Sequence
1. 2.
:
select min
array[i..Narray[i..N-1]
1.
2.
sequence
1.
2. Selection
if
:
then min else null end if
3. Iteration
:
then min end if
for j from i+1 upto N-1 if j min end for while .. end while
261
Pseudo Code
1. 2. . . if then else case while for each end if end case end while end for from upto downto by
call null <= ( a<=1 means set a to 1) //?? //TODO ( ? coding) coding)
TODO
data (
method) names
262
(abstraction
263
Trace to Debug (
Trace pseudo code trace pseudo code coding, , source code work ,
source code
BUG!
264
( ) (Flow)
266
267
7.
(Cont.)
trace to
268
7.
(Cont.)
: Java code
269
: public Entry findMin (root) : binary search tree : input 5; expected output 2 : 5
3 2 4 entry element
270
):
1. root 2.return
(Cont.)
array findMin min array for each array if min then min end for min heap min array findMin :
min
, , : a,b,c 100 data a if b min then min b if c min then min c (100(100-1) !
findMin:
271
7.
open source
(Cont.)
open source
7.
(Cont.)
: waterfall
273
adjacencyMap; theHouse)
(HouseList houseList)
274
/*------------------------------------------------------------------------------/*------------------------------------------------------------------------------* showAllAdjacencies theHouse ( ) * * @param theHouse house * Time estimate: O(n2) * : theHouse , ( ) ( ) --------------------------------------------------------------------------------*/ --------------------------------------------------------------------------------*/
public void showAllAdjacencies (Houses theHouse) 1. toHousesList <= getToHouses(theHouse) 2. toHousesList showNames(toHousesList) 3. fromHousesList <= getfromHouses(theHouse) 4. fromHousesList showNames(fromHousesList)
O(n)
O(n2)
275
(Cont.)
/*-------------------------------------------------------/*-------------------------------------------------------* showNames houseList * * @param houseList * Time estimate: O(n) --------------------------------------------------------*/ --------------------------------------------------------*/
private void showNames (HouseList houseList) for i from 0 upto houseList -1 houseList i end for
276
8.
(Coding)
( /* */)
277
/*-------------------------------------------------------/*-------------------------------------------------------* showNames houseList * * @param houseList * Time estimate: O(n) --------------------------------------------------------*/ --------------------------------------------------------*/ private void showNames (HouseList houseList) /*for i from 0 upto houseList -1 */
for(i=0, i<=length(houseList-1), i++); i<=length(houseList-
*/println
houseList(i).name);
:
278
9.
(Unit testing)
(unit, Java public method source code) ( JUnit) test code (unit)
279
280
10.
AgileJ (source file reused code) class diagram, sequence diagram class classes main program : ) CMMI process areas goals
281
10.
(Cont.)
283
284
myAgile
myAgile CRC, test code, pseudo code coding 1) CRC test code 2) pseudo code (refactor) CMMI 3)
285
myAgile
(Cont.)
myAgile
: , , ? , : , , , , , , , ,
(Cont)
, , , ,
, ,
287
myAgile
ATM , : scenarios cases ,
(Cont)
, myAgile
acceptance test !
288
289
Selection Sort
:
Test Case
291
test cases
1.
Input {3,1,4,2} Expected Output {1,2,3,4} Input {1,1,1,1} Expected Output {1,1,1,1} Input {2,2,3,1} Expected Output {1,2,2,3}
292
2.
3.
Test Code
(header) (header)
/* test code: testMySort.java source code: mySort.java 2011.4.1 test case 1: {3,1,4,2} ->{1,2,3,4} test case 2: {1,1,1,1} ->{1,1,1,1} test case 3: {2,2,3,1}-> {1,2,2,3} {2,2,3,1}*/ test code test code, source code
293
Test Code
// Java Test Code (C# test code import junit.framework.*; public class TestmySort extends TestCase { public TestmySort (String s) {super(s);} /* /* /* test cases test cases test case public void */ protected void setUp (){} */protected void tearDown (){} test method */ public void testSort () {} } )
294
Test Cases
Test Code
296
test cases 5 unit (method) (cases) 43=64 cases test code case
10
test code
source code
297
Pseudo Code
1.
1. 2. 3. select min
2.
repeat 1. 2. until ( 0 ~ n-1) n( ( select min 0) 1 ~ n-1) n( n-2)
298
(i)
end for
299
3.
array[i..Narray[i..N-1]
300
Coding
constructor
public mySort (int inputArray[]) input array*/this.array = inputArray;} array*/this.array inputArray;} public int[ ] sort ( ){ }
Coding (Cont.)
/* sort: sort array */ sort ( ) { /* for i from 0 upto N-2 */ for (int i = 0; i <= array.length-2; i++) { array.length/*1.min( ) array[i..Narray[i..N-1] ( array[i])*/ int min=i; array[i])*/
/*2. array[i..N-1] select min */ array[i..Narray.length/*for j from i+1 upto N-1*/ for (int j = i + 1; j <= array.length-1; j++) N/*if /*if j min then min end if*/ if (array[j] < array[min]) min = j; //end for //end /*3. /*3.
//end for
min
array[i..Narray[i..N-1]
302
Coding (Cont.)
Coding pseudo code source code source code PseudoCoder )
303
Coding (Cont.)
:
? 1. 2. 3. ( )
304
Coding (Cont.)
swap method coding coding private method pseudopseudoprivate method test code
/*swap: i1, i2 */ private void swap (int i1, int i2) {int temp = this.array[i1]; this.array[i1] = this.array[i2]; this.array[i2] = temp; }
305
306
307
308
1, 2, 3, 4
310
311
Maintain
Selection Sort 1. 2. 3. 4. maintenance request :
test case code ( input 3142, expected output 4321) pseudo code pseudo code source code unit testing tool testing
312
*/
sort ( ) {
//1.max(
array[i..Narray[i..N-1]
( array[i] ) array[i])
int max=i;
max
max
then
max
end if
array[i..Narray[i..N-1]
( array[i] ) array[i])
swap (i,max);}
//end for
313
314
sort sort
sort
6 1(i)
3 2
1 n-2
2 n-1
sort 9
Insert
sort 6 0
sort 6 sort
sort
n-1
sort 1 0 2 1 3 2 4 6 n-2 9 n-1
sort
315
sort array
316
sort
sort array
317
sort
0 3 2 0 3 2 0 3 2
1 4 1 4 1 4
1 2 n-1 1 2 n-1
increment( 2) increment
(
1 6 n-1
0 ( 1, 3, 9)
insertion sort
increment
increment = 1 0 0 1 2 0 1
increment/2 increment 1
0 3 2
0 4
0 6 n-2
0 9 n-1
sort
318
1. increment 2 array : k=1: {9 3 1} k=2: {6 4 2} insertion sort 2. shell sort increment 1 ( insertion sort)
319
3. return array
array
/*if array[j]<
then swap
*/
//end for //end for // end for /*2. shell sort increment 1*/
322
323
324
C# Unit Testing
// C# test code using NUnit.Framework; /* TestmySort Class [TestFixture] public class TestmySort { /* TestCase [Test] public void testCase1(){} }
325
Class* Class*/
public method
[Test]*/
[Test] public void testCase2(){ int[] input={1,1,1,1}; int[] excepted={1,1,1,1}; int[] result=new int[4]; mySort obj= new mySort(input); result=obj.Sort(); Assert.AreEqual(result,excepted);} Test Cases Test Code
327
328
329
330
(mySort.cs) mySort.dll
331
(c)
NUnit
File>open
mySort.dll
332
(d)
TestmySort
Run
Testing
333
TestCase
334
Much more than documents.
Discover everything Scribd has to offer, including books and audiobooks from major publishers.
Cancel anytime.