Robo – Software Engineering

Slides:



Advertisements
Similar presentations
Everyday Algorithms David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. lightning introduction to.
Advertisements

Lecture Roger Sutton 21: Revision 1.
CSC1016 Coursework Clarification Derek Mortimer March 2010.
Structured Programming structured programming: A technique for organizing and coding computer programs in which a hierarchy of modules is used, each having.
Zero to Java in Internet Time David Davenport Computer Engineering Dept., Bilkent University, Ankara Turkey
Robo David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. lightning introduction to the engineering.
1 Chapter 8 Designing Small Programs. 2 A ‘Procedure’ v A set of instructions which describe the steps to be followed in order to carry out an activity.
Robo – Software Engineering David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. engineering.
Computational Algorithms David Davenport Computer Eng. Dept., Bilkent University Ankara - Turkey. lightning introduction.
Making Decisions uCode: October Review What are the differences between: o BlueJ o Java Computer objects represent some thing or idea in the real.
CMSC 104, Version 8/061L17Top-DownDesign.ppt Top-Down Design Topics Top-Down Design Top-Down Design Examples The Function Concept Reading Sections 3.1.
L061 Algorithms, Part 3 of 3 Topics Top down-design Structure charts Reading Sections , 3.3.
CMSC 104, Section 301, Fall Lecture 18, 11/11/02 Functions, Part 1 of 3 Topics Using Predefined Functions Programmer-Defined Functions Using Input.
Strategies & Knowledge for Independent Learning individual Work SKIL SKIL cards are sets of cards that explain how to use different learning strategies.
 Programming methodology: ◦ is a process of developing programs that involves strategically dividing important tasks into functions to be utilized by.
Advanced Higher Computing Science
AP CSP: Creating Functions & Top-Down Design
Game Design For Development
How to develop a program
ALGORITHMS AND FLOWCHARTS
Algorithms and Problem Solving
Algorithms IV Top-Down Design.
Java Coding 3 – part2 David Davenport Computer Eng. Dept.,
Basic Troubleshooting Techniques
Understand Problem Solving Tools to Design Programming Solutions
The Need for Programming Languages
CMSC201 Computer Science I for Majors Lecture 11 – Program Design
The life cycle.
Understand the Programming Process
Notes for helpers Supporting everyone to tell their story
Computer Programming.
Strategies for Multiplication
Some Basics for Problem Analysis and Solutions
Chapter 4 Functions Objectives
The Five Stages of Writing
“Backwards Revision”: Using Revision to Introduce Important Concepts
UNIT 3 CHAPTER 1 LESSON 4 Using Simple Commands.
COMP 208/214/215/216 Lecture 3 Planning.
An Introduction to VEX IQ Programming with Modkit
PROGRAMMING Sub Procedures I.
Topic 1: Problem Solving
Computer Science Testing.
Essay #1: Your Goals as a Writer
Open on the student drive
Trial & Improvement Activity
UMBC CMSC 104 – Section 01, Fall 2016
Understand the Programming Process
Algorithm and Ambiguity
How to develop a program
Maze Challenge Maze Challenge activity > TeachEngineering.org
GCSE Revision In response to a large number of Y11 students asking for advice on how to revise….. Introduction & revision planning Revision techniques.
CMSC 345 Programming.
U3L1 The Need For Programming
Unit 1: Principles of Computer Science
Informatics 122 Software Design II
Java Coding 4 (part2) David Davenport Computer Eng. Dept.,
Computational Thinking
Presentation and project
Algorithms, Part 3 of 3 Topics Top down-design Structure charts
Sorting Algorithms 2.1 – Algorithms.
Top-Down Design & JSP Skill Area Part D
Chapter 13 Recursion Copyright © 2010 Pearson Addison-Wesley. All rights reserved.
Presentation and project
Software Development Techniques
Algorithms, Part 3 of 3 Topics Top down-design Reading
Prime Factorization, Prime Numbers & Composite Numbers
Java Coding 6 David Davenport Computer Eng. Dept.,
Presentation transcript:

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

House Problem Who has attempted it?

Robo – House Problem (1) Specify pieces & order roof main Pre-cond. Post-cond. main roof 2 1 250x250x250 50x50 100x50 250 Break problem into few natural pieces, specify sequence, specify sizes, specify pre & post-conditions. Ask: do these pieces done in this order produce the required solution? Yes, proceed. No, try again! Ask: Could you “subcontract” each piece? Is there sufficient information to produce that piece (without knowledge of any other piece or the problem), such that if done correctly (i.e. to your specifications) then it must (is guaranteed) to fit into your solution. Note: missing dimensions means that if the roof is sub-contracted it may be too big or too small to fit our house! Can use equtri for roof, so just need to think about main only.

Robo – House Problem (2) Then solve pieces… window door main walls Pre-cond. Post-cond. walls window door 150x25 movetoleftwin 150 movetorightwin 150x75 movetodoor 7 1 3 2 4 6 5 main NOTE: This is not correct. It does not solve the given problem! WHY? Post condition is not met. FIX. Can reuse rect method for walls, door & windows. ? Can we generate a general move method to handle all these cases ? Notice… so far no Robo code, only design on paper. IMPORTANT: Design then implementation, not the reverse! When implementing… do each piece separately & test the unit (unit testing) before integrating. Hint: make special markstart & markend methods to indicate pre/post-conditions during testing/debugging. d walls d movetoleftwin d window d movetorightwin d movetodoor d door d movetoendpoint main

Software Engineering Exercise Form teams, implement, then reflect!

Basic Pieces… topright movetoleft base toprightbottom diamond topleft Pre-cond. Post-cond. Basic Pieces… (2a + b) topright (2a + 2b) movetoleft (2a + 2b) base (a) toprightbottom (b) (2b) (a) diamond 45 (a) topleft Note: names are deliberately vague in order not to give the game away! (b) (a) moveup (a) movedown (a) side (a) lefttop

Composite Pieces… bc ( a, b) slice ( a, b, c) slicetop ( a, b) d side( b) x a slice( b, 12, 10) d side( b) bc ( a, b) d base( b, c) d moveup( a) d slicetop( b, c) d movedown( a) slice ( a, b, c) Note: names are deliberately vague in order not to give the game away! 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)

Software Engineering Exercise The overall design!

Birthday Cake Design Game’s up! Of course, now we need sizes (in terms of parameters) plus pre & post conditions, etc. Maybe describe in english… beginnings of algorithms?

Birthday Cake Design 1 2 3 tofirstcandle // birthdaycake d Rect(200,450) //cake body d tofirstcandle d candles

To First Candle tofirstcandle // tofirstcandle p f(200) r(90) f(50)

Candles // candles x 4 candle

Candle 1 2 3 4 // candle // candlebodytoflame // flametonextcandle d Rect(200,50) // candle body d candlebodytoflame d Rect(40,40) // candle flame d flametonextcandle Candle 1 2 3 4 // candlebodytoflame p f(200) r(90) f(25) l(135) // flametonextcandle p r(135) f(25) r(90) f(200) l(90) f(50)

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-contracting Have 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 methods This 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 programming ...BYE

(a) 100x100 base Library pieces! 3 2 1