6
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

Overview of Programming

Embed Size (px)

DESCRIPTION

Computer Programming overview

Citation preview

Page 1: Overview of Programming

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 1PROBLEM 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

Page 2: Overview of Programming

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. Identify/understand the problem 2. Identify alternative ways to solve the problem 3. Select the best way to solve the problem from the list of alternative solutions4. List instructions that enable you to solve the problem using selected solution5. 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.

Page 3: Overview of Programming

• 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

Page 4: Overview of Programming

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

Page 5: Overview of Programming

• 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