Loading content…
Loading…
Transcript

problemsolving 1

Dr Scott Turner

Why do you needed to develop problem solving skills?

One definition of programming is it is applied problem solving

You have a problem

(E.g Need a program to calculate the area of the circle).

- What needs to be done?

- What inputs and outputs are needed?

- How does what is entered produce the right output?

“…many students have almost no mathematical background and some even arrive with a built-in phobia against anything involving formulae or syntax.” Carter (2004)

“Programming is a complex activity…. Problem Solving is not trivial and requires component skills including relativity; decision making; identification of the central issues; recognition of relationships, familiar situations and patterns; development of an algorithm and the translation of the algorithm into executable code. ” Beaumont and Fox (2003)

Stepwise Refinement

Take the problem and break it down in to smaller and smaller chunks

- that are now manageable.

Mistakes

An expert is a man who has made all the mistakes which can be made in a very narrow field.

Niels Bohr

Anyone who has never made a mistake has never tried anything new. Albert Einstein

Simplicity

Any intelligent fool can make things bigger and more complex... It takes a touch of genius - and a lot of courage to move in the opposite direction. Albert Einstein

Everything should be made as simple as possible, but not simpler. Albert Einstein

All quotes taken from:http://www.brainyquote.com/ Accessed on 18/9/2006

Basics

Problem statement

Analysis

Design

Implementation

Testing

Analysis-Sample Thoughts

What does it have to do?

What does it need?

What rules/algorithms are needed?

When testing what does it take to prove it works?

Can I break this down further?

Things to remember

There is often more than one solution to a problem

Two heads are better than one

Write a routine to calculate the area of the circle.

First pass

Input

Calculation

Display

Second pass

Input

Input radius of the circle

Calculation

Area=Pi x radius x radius

Display

Display area on the screen

Third pass

Put a message of the screen telling the user to enter the radius of the circle.

Read in from the keyboard what the radius of the circle is

Calculation Area=Pi x radius x radius

Display the following message on the screen “The area of the circle is “ and display the result of the calculation on the screen

In groups of 2-3 write a routine for calculating the area of a rectangular room.

First pass

Input

Calculation

Display

1. Understand and isolate the problem

2. Brainstorm for ideas to solve the problem

3. Design a solution that might work

4. Test your solution to see if it will work

5. Assess whether the solution is good enough to do it

See http://cda.mrs.umn.edu/~fauxr/computing/problemsolve.html

Brainstorming

Note down all the solutions

Have solutions been used in similar way before?

Keep solutions that have common features .

Two heads are better than one.

When all the solutions have been found weed-out less reasonable ones.

Can be solo or group activity.

Design a solution that might

work

The design of a solution can be created using diagrams, algorithms and other models. The main purposes of creating a design that can be viewed by others is to communicate the solution. Providing a diagram or algorithm of what you THINK is going on and is needed will provide others a chance to see what your thinking is.

Take the time to trace through your design with some test information.

Try more than one scenario.

Try to find information that tests the borders.

Choose some information that isn't supposed to work and be certain that the design handles it.

Give your algorithm or diagram to another person.

Is it good enough

Write a routine that lets the user convert pounds Stirling into the Northampton dollar and display the results

What information do you need?

What does the routine need to do?

Test a solution to see if it will

work

Take the time to trace through your design with some test information.

Try more than one scenario.

Try to find information that tests the borders.

Choose some information that isn't supposed to work and be certain that the design handles it.

Give your algorithm or diagram to another person.

Is this solution really worth doing?

Would another solution be better for this situation?

University of Minnesota – Five steps in problem solving

1. Understand and isolate the problem

2.Brainstorm for ideas to solve the problem

3. Design a solution that might work

4. Test your solution to see if it will work

5. Assess whether the solution is good enough to do it

See http://cda.mrs.umn.edu/~fauxr/computing/problemsolve.html

What Assumptions did you make

Did you assume that the measurements of the room were already taken?

What units of measurement did you use?

What does area of the room mean?

Area of the floor?

Area of the floor and area of all the walls?

What does it take to succeed with a particular problem?

What is the vital information?

Identify the parts of the problems – analysis.

What are the inputs and outputs?

Identify the parts of the problems – analysis.

What are the inputs and outputs?

What are the limitations?

What are the rules?