0% found this document useful (0 votes)
2 views

Introduction to Problem-solving II.pptx

This document outlines the process of problem-solving in programming, emphasizing the importance of creating a solution plan, coding, debugging, and documentation. It discusses breaking down complex problems into smaller parts and the need for evaluating and refactoring solutions for efficiency. Additionally, it provides insights into different programming languages and the significance of user and programmer documentation.

Uploaded by

klopienclaudia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
2 views

Introduction to Problem-solving II.pptx

This document outlines the process of problem-solving in programming, emphasizing the importance of creating a solution plan, coding, debugging, and documentation. It discusses breaking down complex problems into smaller parts and the need for evaluating and refactoring solutions for efficiency. Additionally, it provides insights into different programming languages and the significance of user and programmer documentation.

Uploaded by

klopienclaudia
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 28

Introduction to

problem solving ii

DR JEREMIAH O. BANDELE
PhD Electrical/Electronic Engineering
University of Noingham
Learning objectives

At the end of this lesson, you should be able to:


● Describe how to carry out a solution plan to solve problems
● Apply concepts such as coding, debugging and program documentation
● Explain why we need to evaluate and refactor a solution
Recap: Four steps to problem-solving

Understand the
problem

Create a solution
step-by-step
plan

Carry out the


solution plan

Evaluate and
refactor the
solution
Carrying out a solution plan

After understanding the problem and creating a solution plan, the next step is to solve the
problem. We need to tell the computer to solve the problem in a language it understands
using computer programs.
Carrying out a solution plan

Computer programs are also known as codes.


A very useful approach to adopt is to use the pseudocode as a guide to write out the
program codes.
Carrying out a solution plan

What if the entire problem can not be solved at once?


● An approach is to break down the entire problem
into smaller simpler pieces and solve each part
separately.
● It is better to focus on a simple solution as it is more
likely to program a simpler solution correctly.
Carrying out a solution plan

What if some parts of the problem can not be solved?

● In this case, we can ignore the difficult parts and focus on


the easier aspects first.

● When all the easier parts are solved, it might then be


possible to solve the harder parts.
What does carrying out the solution plan entail?

Carrying out the solution plan involves;

● Coding
● Compilation and Execution
● Debugging and Testing
● Program Documentation
Coding

This refers to the process of writing the actual program that solves the problem.
Coding
A coded program is most popularly referred to as a source code.
The coding process can be done in any high level or low level programming language.
Coding

High level languages are written in forms that humans can easily understand. Examples are
C, C# and Java.
Coding

Low level languages are written in forms that the computer can easily understand.
Examples are assembly language and machine code.
Coding
The computer only understands machine codes, but they are very difficult to write and
troubleshoot because even small programs can have thousands of 0s and 1s.
Coding: an example

The example below shows how pseudocodes can be converted into codes;

Pseudocode Programming Code


Compilation and execution

Computer program are mostly written in either a high level language or with an assembly
language.Interpreters are used to convert high level languages into machine code directly.
Compilation and execution

Compilers are used to convert high level languages into assembly languages.
Compilation and execution

Assemblers are used to convert assembly languages into machine codes.


Compilation and execution process
Debugging and testing
When writing a computer program, errors such as syntax, logical and run time error can
occur.
Debugging and testing
Debugging is a process that finds errors so that they can be removed to avoid program
failure. Testing is a process that verifies if the computer program works as expected.
Program documentation

Program documentation is the process of collecting information about the program.


The process starts from the problem analysis stage and continues to the testing stage.
Program documentation
There are two types of documentation;

● User Documentation: This contains the information the end user needs for the
installation and use of the program.

● Programmer Documentation: This contains all the technical details so that the program
can be upgraded and maintained effectively.
Evaluating and refactoring the solution

Once a solution is working, the solution can be


evaluated to see if it can be refactored.

Refactoring does not change the function of the


solution, it is intended to make the solution more
efficient while improving its structure and design.

Refactoring the solution will most likely result into a


more concise and efficient solution.
Evaluating and refactoring the solution

Questions to ask while trying to improve the solution include;

● Can we derive the result differently?

● Can we improve the performance of the solution?

● Can we think of other ways to refactor?

● How have other people solved the problem?


Evaluating and refactoring the solution: an example

The example below shows how a solution can be refactored for efficiency

Old Solution New Solution


FURTHER READING RESOURCES

● Bransford, J. D., & Stein, B. S. (1993). The IDEAL problem solver.


● Treffinger, D. J., Isaksen, S. G., & Stead-Dorval, K. B. (2006). Creative problem
solving: An introduction. Prufrock Press Inc.
● Goodrich, M. T., & Tamassia, R. (2015). Algorithm design and applications (Vol. 363).
Hoboken: Wiley.
● Khannur, A. (2014). Structured software testing: the discipline of discovering.
Partridge Publishing India.
● Kernighan, B. W., & Ritchie, D. M. (2002). The C programming language.
● Bailey, T. (2005). An introduction to the c programming language and software design.
July-2005

REFERENCES

● "Flying Magazine". Flying: 36–June 1963. ISSN 0015-4806.


● "Human Powered Flight Group Webpage". Royal Aeronautical Society. 2011. Retrieved 18 January
2021.
● Bransford, J. D., & Stein, B. S. (1993). The IDEAL problem solver.
● Treffinger, D. J., Isaksen, S. G., & Stead-Dorval, K. B. (2006). Creative problem solving: An
introduction. Prufrock Press Inc..
Thank
You

You might also like