Chapter 1 - Introduction To Programming Concepts-1

Download as pdf or txt
Download as pdf or txt
You are on page 1of 6

INTRODUCTION TO PROGRAMMING & ALGORITHM

Chapter 1 Introduction to Computer Programming Concepts


1.1 Introduction
Definitions
1) Computer program
A computer program is a sequence of instructions written using a Computer Programming
Language to perform a specified task by the computer.
The two important terms that have been used in the above definition are −
a) Sequence of instructions
b) Computer Programming Language

2) Computer Programming
Computer programming is the act of writing computer programs, which are a sequence of
instructions written using a Computer Programming Language to perform a specified task by the
computer.
Programming involves the following activities; writing a program, compiling the program, running
the program, debugging the programs. The whole process is repeated until the program is finished.

3) Computer
 A computer is an electronic device capable of executing instructions, developed based on
algorithms stored in its memory, to process data fed to it and produce the required results faster
than human beings.
 It is an electronic device which processes given data to derive the required and useful
information. During the processing the computer has to perform various functions like,
Accepting Instructions & data from the user, performing various arithmetic and Logical
operations as per Instructions given and presenting the Information or Output to the user.

4) Computer Programmer
Someone who can write computer programs or in other words, someone who can do computer
programming
Programmers translate the solutions or tasks into a language the computer can understand.

5) Programing Language
 A programming language is a formal constructed language designed to communicate
instructions to a machine, particularly a computer.
 A computer programming language is a language used to write computer programs, which
involves a computer performing some kind of computation

1.2. Program/ Programming Concepts


1) A computer program is also called a computer software, which can range from two lines to millions of
lines of instructions.
2) Computer program instructions are also called program source code and computer programming is
also called program coding.
3) A computer without a computer program is just a dump box; it is programs that make computers active.
4) Computer Programming is the process of developing and implementing various sets of instructions to
enable a computer to do a certain task.
5) Programs are written to solve problems or perform tasks on a computer.
6) The programs characterize what a computer actually does.
7) A program (independently of the language in which it is written) is constituted by two fundamental
parts:
Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 1
a) a representation of the information (data) relative to the domain of interest: objects
b) a description of how to manipulate the representation in such a way as to realize the desired
functionality: operations
To write a program both aspects have to be addressed.

1.3. Computer Basic Concepts


Computer is an electronic device that accepts data, processes it, and generates the relevant output.

 A computer is an electronic device capable of executing instructions, developed based on algorithms


stored in its memory, to process data fed to it and produce the required results faster than human
beings.

 It is an electronic device which processes given data to derive the required and useful information.
During the processing the computer has to perform various functions like, Accepting Instructions &
data from the user, performing various arithmetic and Logical operations as per Instructions given and
presenting the Information or Output to the user.

It can perform both simple and complex tasks with very high speed and accuracy. However, a computer
cannot perform any task—simple or complex, of its own. Computers need to be instructed about “how” the
task is to be performed. The set of instructions that instruct the computer about the way the task is to be
performed is called a program. A program is required for processing all kind of tasks—simple tasks like
addition of two numbers, and complex tasks like gaming etc.

1.3.1. Characteristics of Computers


Computers are so versatile that they have become indispensable to engineers, scientists, business executives,
managers, administrators, accountants, teachers and students. Modern computers posses certain
characteristics and abilities peculiar to them.
1) Perform complex and repetitive calculations rapidly and accurately.
2) Store large amounts of data and information for subsequent manipulation.
3) Compare items and make decisions.
4) Provide information to the users in many different forms
5) Automatically correct or modify the parameters of a system under control
6) Converse with the users interactively
7) Receive and display audio and video signals
8) Speed – a computer is a very fast machine. It can perform in a very few seconds the amount of work that
a human being can do in a year if he/she worked day and night doing nothing else.
9) Accuracy – the computer accuracy is consistently high.
10) Diligence – computers are free from monotony, tiredness and lack of concentration etc. It can therefore
work for hours without creating an error.
11) Versatility – a computer performs various tasks with ease. The computer perform three basic operations
a) It is capable to access and accept information through various input-output devices from the user.
b) It performs basic Arithmetic and Logic operations on data as desired.
c) It is capable to generate the desired output in the desired form.
12) Power of remembering – a computer can store and recall any information due to its secondary storage
capability.
13) No intelligence Quotient (IQ) – a computer cannot make its own decisions and has to be instructed on
what to do.
14) No feelings – computers are devoid of emotions. They have no feelings or instincts and none possesses
the equivalent of a human heart and soul.

Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 2


1.3.2. Limitation of Computer
1) Computer does not work on itself, it requires set of instructions to be provided, else computer
(Hardware) is waste.
2) Computer are not intelligent, they have to be instructed about each and every step which they have to
perform
3) Computers cannot take decisions on its own, one has to program the computer to take an action if some
conditional prevail.
4) Computers, unlike humans cannot learn by experience.

1.3.3. Advantages and Disadvantages of Computers


Advantages - Application Areas. Computers can be used in the following application areas
1) Data processing (Commercial use).
2) Numerical computing (Scientific use).
3) Text (word) processing (Office and Education)
4) Message communication (E-mails)
5) Image processing (Animation and industrial use).
6) Voice recognition (Multimedia)

Disadvantages
1) Unemployment
2) Computer Crime
3) Data Security
4) Violation of Privacy
5) Waste of Time and Energy
6) Health Risks
7) Impact on Environment

1.3.4. Components of a Computer


A computer has to main components;
a) Hardware
b) Software

Computer hardware refers to the physical components of a computer.


1) Input: devices used to capture and send data and instructions to the processing component / unit of
the computer
2) Storage: used to store the data and instructions until needed to be worked on. Also used to hold the
processed information until required for output. There are two types of storage; main
memory(storage) and secondary storage
3) Control: used to fetch instructions from the main storage, interprets them, and issues the necessary
signals to the components making the computer system. It directs all hardware operations necessary
in obeying instructions.
4) Processing: processing is done by the Arithmetic Logical Unit (ALU) which obeys the instructions
and performs the required arithmetic operations, and logical operations
5) Output: devices used to output the processed data (information). This includes, screen, printer etc.

Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 3


Main Memory

Input Devices Output Devices

Processor

Secondary/Backing
Storage

Computer software: A set of programs associated with the operation of a computer


1) System Software
2) Application Software

Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 4


1.4. Program Development Life Cycle/Problem Solving Process
Problem solving is an innovative process for finding solutions to problems. Problem formulation is the
methodology of describing the problem and the results by stating the requirements and objectives that are
required to solve the problem using a computer program. The objectives are defined in terms of:
1) Input and its characteristics
2) Expected Output and its characteristics
3) Relationship between the input & the desired output

There are a number of concepts of relevance to problem solving using computers. Two particular concepts
includes
1) Computability: A problem is said to be co+
2) mputable if it can in principle be performed by a machine. Some mathematical functions are not
computable.
3) Complexity: The complexity of a problem is measured in terms of resources required, time and
storage

As stated earlier, a program is needed to instruct the computer about the way a task is to be performed. The
instructions in a program have three essential parts:
1) Instructions to accept the input data that needs to be processed,
2) Instructions that will act upon the input data and process it, and
3) Instructions to provide the output to user

The instructions in a program are defined in a specific sequence. Writing a computer program is not a
straightforward task. A person who writes the program (computer programmer) has to follow the Program
Development Life Cycle.

1.4.1. Life cycle steps / phases


1) Problem Analysis - The programmer first understands the problem to be solved. Define the Problem -
State in the clearest possible terms the problem you wish to solve. It is impossible to write a computer
program to solve a problem that has been ambiguously or imprecisely stated.
The programmer determines the various ways in which the problem can be solved, and decides upon
a single solution which will be followed to solve the problem.
2) Program Design / Algorithm creation- The selected solution is represented in a form, so that it can
be coded. This requires three steps:
1) An algorithm is written, which is an English-like explanation of the solution.
2) A flowchart is drawn, which is a diagrammatic representation of the solution. The solution is
represented diagrammatically, for easy understanding and clarity.
3) A pseudo code is written for the selected solution. Pseudo code uses the structured
programming constructs. The pseudo code becomes an input to the next phase.
3) Program Development / Coding
The steps in an algorithm, translated into a series of instructions to the computer, comprise the computer
program. There are many languages in which computer programs can be coded, each with its own
syntax, vocabulary, and special features.
a) Choose the programming language
b) Write the program by converting the Pseudo-Code using the programming language
c) Compile the Program to remove Syntax errors: Syntax errors arise due to the incorrect use of
programming language or due to the grammatical errors with respect to the programming
language used

Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 5


4) Debug the Program: Most programs of any length don't work properly the first time they are run
and must therefore be debugged. The coded pseudo code or program is compiled for any syntax
errors. Removal of the errors and any ambiguities in the code is called debugging
5) Run the Program (Execute): After the program has been fully debugged you run it, possibly using
many sets of input data. This step may take anywhere from a few seconds to many hours depending on
the complexity of the problem and the speed of the computer.
6) Analyze the Results: Often the output from a computer program requires considerable further analysis.
In some cases, even though the program worked perfectly, you may find that you solved the “wrong"
problem. There is an acronym well known to computer users: GIGO, which stands for “garbage in,
garbage out."
a. If incorrect results are displayed, then the program has semantic error (logical error). The
semantic errors are removed from the program to get the correct results.
b. The successfully compiled program is now ready for execution.
c. The successfully tested program is ready for use and is installed on the user’s machine.
7) Program Documentation and Maintenance—The program is properly documented, so that later on,
anyone can use it and understand its working. Any changes made to the program, after installation,
forms part of the maintenance of program. The program may require updating, fixing of errors etc.
during the maintenance phase.

Intro to Programming. Chapter1: Introduction to Computer Programming Concepts Page 6

You might also like