Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara -...

18
Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: [email protected] ... …software engineering example exercise

Transcript of Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara -...

Page 1: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

Robo – Software Engineering

David Davenport

Computer Eng. Dept.,Bilkent UniversityAnkara - Turkey.

email: [email protected]

...…software engineering example exercise

Page 2: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

House Problem

Who has attempted it?

Page 3: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

Robo – House Problem (1) Specify pieces & order

250x250x250

50x50

100x50

250

Pre-cond.

Post-cond.

main

roof

2

1

Page 4: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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

Page 5: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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)

Page 6: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

Software Engineering

Exercise

Form teams, implement, then reflect!

Page 7: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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

Page 8: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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)

Page 9: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

Software Engineering

Exercise

The overall design!

Page 10: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

Birthday Cake Design

3 21

a timesb

Page 11: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

SUMMARY

•Advantages of TDSD•The TDSD methodology

Page 12: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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.

Page 13: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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!

Page 14: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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)

Page 15: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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

Page 16: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

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

Page 17: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.
Page 18: Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. email: david@bilkent.edu.tr...…software engineering.

base100x100

3

2

1

(a)

Library pieces!