Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An...
-
Upload
jeff-quincey -
Category
Documents
-
view
220 -
download
0
Transcript of Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An...
![Page 1: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/1.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Structured Problem SolvingAn Introduction
Stewart Blakeway
0151 291 3113
![Page 2: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/2.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Aims of the presentation
• to quickly list the skills to be developed on the SPS strand of the course
• to officially start the course
![Page 3: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/3.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
3
Skills to be developed in the SPS strand of the course
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
The most important bit
![Page 4: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/4.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
4
Skills to be developed in the SPS strand of the module
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
![Page 5: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/5.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
5
Problem Solving Skills
• Analysis of Problems– Crossing a busy road– Eating a Pie– Cooking a Pie– Climbing Mount Everest ??????– Getting PieEater to do something complicated– Writing other software to do something
complicated
![Page 6: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/6.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
6
Problem Solving Skills
• Analysis of the Structure of Solutions– Sequence– Selection– Repetition
![Page 7: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/7.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
7
Problem Solving Skills
• Structured English– Sequence– Selection– Repetition
![Page 8: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/8.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
8
Skills to be developed in the SPS strand of the module
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
![Page 9: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/9.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
9
Programming Skills
• Introduction to Java – Java Programming Constructs– Java Trainer– The PieEater
• Java revisited– Object Oriented Concepts– BlueJ Integrated Development Environment
• (http://www.bluej.org/about/what.html)
– The PieEater again plus Close Friends– Graphics and Animation
![Page 10: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/10.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
10
Programming Skills
• Data Structures– Selection of Appropriate Data Structures– Sorting– Searching
![Page 11: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/11.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
11
Skills to be developed in the SPS strand of the module
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
![Page 12: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/12.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
12
Team Interaction Skills
• Animation Problems– Solved in Groups– Coded in Groups– Tested in Groups
![Page 13: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/13.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
13
Skills to be developed in the SPS strand of the module
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
![Page 14: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/14.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
14
Presentation Skills
• Presentation of Working Animations– Demonstration of the Running Animation– Explanation of the Choice of Variables– Explanation of the Algorithmic Design– Explanation of the Data Structures Selected– Discussion of Possible Enhancements
![Page 15: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/15.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
15
Skills to be developed in the SPS strand of the module
• Problem Solving Skills • Programming Skills• Team Interaction Skills• Presentation Skills• Reflective Skills
![Page 16: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/16.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
16
Reflective Skills
• Reflect on Team Work Activities• Reflect on the Scope of the Task• Highlight Possible Failings in the Mechanics
of the Team Work Activity• Suggest Possible Improvements to Team
Work Interaction
![Page 17: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/17.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
17
Let the course begin …..
![Page 18: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/18.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
18
Your First Seminar
createpieeater();pendown();walk();penup();walk();pendown();turnright();walk();walk();
![Page 19: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/19.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
19
Let’s Loop-the-Loop
createpieeater();
while (test)
{
actions;
}
other actions;
Sequences of Actions each Ending with a Semi Colon
No Semi Colons
![Page 20: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/20.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
20
Semi-colons: a working rule
• Do not put them at the end ofwhile()if (){}
• Do put them at the end of other linesint a;a = 7;turnleft();
![Page 21: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/21.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
21
while (test) { }
test– clearahead– direction != “SW”– pieinsight
clearahead and pieinsight are either true or falsedirection != “SE” can be evaluated to either true
or false
![Page 22: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/22.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
22
Loop Operation
while (test) { actions; }
other actions;
Evaluate testtrue false
![Page 23: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/23.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
23
Test is True
while (test) {» actions;
}
other actions;
Enter Body of Loop
Execute [actions;]
Evaluate test Again
Body of Loop
![Page 24: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/24.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
24
Test is True
while (test) {» actions;
}
other actions;
Enter Body of Loop
Execute [actions;]
Evaluate test Again
![Page 25: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/25.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
25
Test is True
while (test) {» actions;
}
other actions;
Enter Body of Loop
Execute [actions;]
Evaluate test Again
![Page 26: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/26.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
26
You Get the Idea
![Page 27: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/27.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
27
Test is False
while (test) {» actions;
}
other actions;
Jump to other actions; and Continue with the Rest of the Program
![Page 28: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/28.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
28
{actions;}
walk();
pendown();
penup();
turnleft();
turnright();• You add the rest
![Page 29: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/29.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
29
Selection
• The if statement allows us to specify alternative actions depending upon a test
![Page 30: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/30.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
30
if (test) { }else { }
if (pieinsight)
{
eatpie();
}
else
{
walk();
}
Selection
![Page 31: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/31.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
31
if inside a loop createpieeater();
randompies(20);while (clearahead) { if (pieinsight) { eatpie(); } else { walk(); } }
![Page 32: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/32.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
32
Counting loops - for
int i;
createpieeater();
for (i=0; i<5; i++)
{
walk();
}
![Page 33: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/33.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
33
In Conclusion
• Problem Solving is a Skill– Riding a Bicycle– Swimming– Keeping Awake in Lectures
• It Cannot be Learned Quickly• It Cannot be Learned without Practice• Every Failure is Part of the Learning Process
![Page 34: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/34.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Lecture Exercise 1
• Draw the following grid
![Page 35: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/35.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Trace out the following program
createpieeater();
turnright();
pendown();
while (clearahead)
{
walk();
}
![Page 36: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/36.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Lecture Exercise 1 Answer
![Page 37: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/37.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Lecture Exercise 2
• Write the program for
![Page 38: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/38.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Lecture Exercise 2 Answercreatepieeater();
int i;
for (i=1 ; i<=4 ; i++)
{
while (clearahead)
{
walk();
}
turnright();
turnright();
}
![Page 39: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/39.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
Lecture Exercise 3 – spot the syntax error
createpieeater();
int i;
for (i=1 , i<=4 , i++)
{
while (clearahead)
{
walk()
}
turnright();
turnright();
![Page 40: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/40.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
40
In Conclusion
• Programming Languages are Merciless– Syntax Matters– Semi Colons can be Dangerous
– In Conclusion: }
![Page 41: Www.hope.ac.uk Faculty of Sciences and Social Sciences HOPE Structured Problem Solving An Introduction Stewart Blakeway blakews@hope.ac.uk 0151 291 3113.](https://reader036.fdocuments.in/reader036/viewer/2022062312/551ae7d055034606048b5c81/html5/thumbnails/41.jpg)
www.hope.ac.uk Faculty of Sciences and Social Sciences
HO
PE
41
Questions?
• Next…– Problem Solving in your seminars
• More loops• If statements
– Next lecture on Algorithms– Setting of assessment next week