Vous êtes sur la page 1sur 5

CHAPTER I

OVERVIEW OF PROGRAMMING

Problem solving is a natural part of life. In any business or industry, the ability
of an employee to solve problems can mean the difference between success and
failure. Lacking the ability to solve problems effectively can be a source of
anxiety and stress for any individual. Problem solving is not an exact science,
although there are guidelines that a person can follow to become a successful
problem-solver.
Flexibility and open-mindedness is an essential part of being able to solve
problems, whether it is in your personal life or on-the-job.

LESSON 1
PROBLEM SOLVING CONCEPTS

What is a problem
A problem is a state of difficulty that needs to be resolved. Problems exist where
goals need to be attained and there is uncertainty about solution.
Problem solving is the ability to determine the best solution for a problem in a
quick and efficient manner.
People make decisions every day. Everything needs a decision as a solution to
the problem.

Approaches to problem solving


Types of Solutions:

Algorithmic Solutions solutions that can be solved with a series of known


actions
Examples:
How to make a cup of coffee
How to find the largest of three numbers
Heuristic Solutions Employing a self-learning approach to the solution of a
problem
Examples:
How to but the best stock
How to play chess

Steps in Problem Solving:


1.
2.
3.
4.
5.

Identify/understand the problem


Identify alternative ways to solve the problem
Select the best way to solve the problem from the list of alternative solutions
List instructions that enable you to solve the problem using selected solution
Evaluate the solution

LESSON 2
Programming Concepts

Problem Solving with Computers


Computers use algorithmic solutions in problem solving.

It involves several

steps:

Analyse the problem and formulate a method to solve it.


Describe the solution in the form of an algorithm.
Draw a flowchart of the algorithm.
Write the computer program.
Compile and run the program.
Test the program.
Evaluate the result if it conforms with the problem specifications.

Tools used in Problem Solving

Algorithm shows the sequence of instructions comprising a solution

Pseudocode - a high-level abstraction of code, usually used to outline the


general steps in an algorithm without having to write actual code

Communicating with a Computer


Program is a set of step-by-step instructions that directs the computer to perform
tasks and produce results.
Programming Language - is a set of rules that instructs a computer what operations to
perform.
Programming - is the process of designing, writing, testing, debugging /
troubleshooting, and maintaining the source code of computer programs.
Programming Paradigms is the fundamental style of computer programming.

Imperative describes the details of HOW the results are to be


obtained, in terms of the underlying machine model.
program as a collection of statements and procedures
affecting data (variables)
Functional - specifies WHAT is to be computed abstractly, leaving
the details of data organization and instruction sequencing to the
interpreter.
Object-Oriented - program as a collection of classes for interacting
objects

Compiler vs. Interpreter


An interpreter translates some form of source code into a target representation
that it can immediately execute and evaluate. The structure of the interpreter is similar
to that of a compiler, but the amount of time it takes to produce the executable
representation will vary as will the amount of optimization. The following diagram shows
one representation of the differences.

Compiler characteristics:

spends a lot of time analyzing and processing the program

the resulting executable is some form of machine- specific binary code

the computer hardware interprets (executes) the resulting code

program execution is fast


Interpreter characteristics:

relatively little time is spent analyzing and processing the program

the resulting code is some sort of intermediate code

the resulting code is interpreted by another program

program execution is relatively slow

Vous aimerez peut-être aussi