Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara -...
-
Upload
alexandrina-marsh -
Category
Documents
-
view
225 -
download
0
Transcript of Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara -...
Robo – Software Engineering
David Davenport
Computer Eng. Dept.,Bilkent UniversityAnkara - Turkey.
email: [email protected]
...…software engineering example exercise
House Problem
Who has attempted it?
Robo – House Problem (1) Specify pieces & order
250x250x250
50x50
100x50
250
Pre-cond.
Post-cond.
main
roof
2
1
Robo – House Problem (2) Then solve pieces…
main
d wallsd movetoleftwind windowd movetorightwind windowd movetodoord doord movetoendpoint
main
Pre-cond.
Post-cond.
walls
windowdoor
150x25
movetoleftwin
150
movetorightwin
150x75
movetodoor
71 3
2 4 6
5
Pretty – design!
a – rect widthb – rect heightc – num. of rectsd – angle btw rects
(b)
(a)
(d) degrees
(c) times
rectturn
(b)
(a)
(c) degrees
rect
21
pretty( a, b, c, d)
x c rectturn( a, b, d)
rectturn( a, b, c)
d rect( b, a)r( c)
Software Engineering
Exercise
Form teams, implement, then reflect!
Basic Pieces…Pre-cond.
Post-cond.
(a)
side
(2a + 2b)
base
(a)
moveup
(a)
movedown
(a)
topleft
(2a + b)
topright
(2a + 2b)
movetoleft
(a)
lefttop
(b)
(a)
toprightbottom
(b)
(2b)
(a) (a)
diamond
45
Composite Pieces…
d base( b, c)d moveup( a)d slicetop( b, c)d movedown( a)
slice ( a, b, c)
d movetoleft( a, b)d topleft( b)d holder( 100, a, a)d topright( a, b)
slicetop ( a, b)d lefttop( a, b)d diamond( c)d toprightbottom( a, b)
holder ( a, b, c)
d side( b)x a slice( b, 12, 10)d side( b)
bc ( a, b)
Software Engineering
Exercise
The overall design!
Birthday Cake Design
3 21
a timesb
SUMMARY
•Advantages of TDSD•The TDSD methodology
Relating Design & Code Big problems -> lots of pieces! Difficult to understand & track
relation of pieces to each other & between pieces of design & code
Pieces of design numbered 1, 2, 3… Number sub-pieces 1.1, 1.2… & 2.1, 2.2… Methods require naming pieces in design Include piece numbers in code too.
The TDSD Methodology Understand the problem requirements Break into natural pieces, making sure to fully
specify them and the order in which they are to be done
Check whether these pieces done in this sequence solve the problem
If no, revise & recheck until you have a set & order that do correctly solve it!
If/when yes… repeat process with any non-trivial sub-pieces and so on until you only have trivial pieces!
Finally, implement & test each of them separately, then integrate & test whole!
Tips… Have you FULLY specified ALL the sub-pieces?
and exactly how they fit together?
Sub-contractingHave you described the sub-problem in sufficient detail that someone would be
able to solve it without any additional knowledge of the original problem?
Don’t be afraid to revise solutions or even scrap them entirely. It is not always possible to find best solution first time!
Don’t start to solve sub-problems until you are absolutely sure that the your proposed solution is correct. Doing so may waste time & effort.
Must go from BIG to small -not small to big!! Your solutions must demonstrate you understand top-down design
–require at least 2 or 3 levels
Robo limited to 20 line methodsThis must include comments!So ~10 comments + 10 commands (max, remember 7 +- 2)
Advantages of TDSD Small pieces easier to solve correctly! Projects easier to manage
divides work naturally Projects can be completed quicker
easıer to reuse pieces pieces can be done simultaneously
Projects done in secrecy workers don’t see big picture
Testing & integration is simplified
Summary You should have learnt about
& understand the rationale for… Comments White space Meaningfully named methods Method parameters Pre & post conditions Repetition Top down structured design!
Happy programmin
g ...BYE
base100x100
3
2
1
(a)
Library pieces!