Introduction
to Program and Programming Language
If you want to get something done
by a person, you will tell him what to do in a language that he understands.
Similarly, if you want to make the computer to do some task for you, you have
to tell the computer what to do in a language the computer understands. Hence,
the programming language is a set of
rules that provides a way of instructing the computer to perform certain
operations.
A
program is a set of instructions
written in a specific programming language that a computer can interpret and
execute. A computer requires programs to function.
Programming
languages are said to be lower to higher, depending on whether they are closer
to the language the computer itself uses (lower, which means 0s and 1s) or to
the language that people use (higher, which means more English like). Here, we
will consider following groups of languages:
1.
Machine Language / First-generation Language
2.
Assembly Language / Second-generation Language
3.
High-level Language
a.
Procedural and
Object-oriented Language / Third-generation Language
b.
Problem-oriented Language / Fourth-generation Language
c.
Natural
language /Fifth-generation Language
Machine
Language
It is the lowest level of
programming language. In this language, information is represented as 0s and
1s. This programming is very tedious and time consuming. A programmer must keep
track of a tremendous amount of detail. Programming in machine code has one
advantage over programming at other language level – its execution is very fast
and efficient because the computer can accept the machine code as it is. Since
there is no standard machine language, a program written in machine language
for one computer model may not on different model computer.
Assembly
Language
In the 1950s, to reduce
programming complexity and provide some standardization, assembly languages
were developed. Assembly languages, also known as symbolic languages use
abbreviations or mnemonic code – codes more easily memorized – to replace the
0s and 1s machine language. For example, ADD and SUB for addition and
subtraction operations.
For
an assemble language program to be executed, it must be translated to machine
code. This translation is done by translators called assemblers. The program before translation, the assembly language
program, is called a source program and the program after translation, the
machine language program, is an object program. Assembly language offers
several advantages:
·
Standard and easier to use than machine
language.
·
Operate very efficiently, although not as
efficient as the machine languages.
·
Easier to debug because programs locate and
identify syntax errors
However, there are still some
disadvantages:
·
Programs are usually very long.
·
Programs are still complex.
·
Assembly languages are still machine-dependent.
High-level
Language
High level languages are simple
and easy to understand. These languages assist programmers by reducing further
the number of computer operation details they had to specify, so that they
could concentrate more on the logic needed to solve the problem. There are
three different types of high-level languages:
- Procedural and Object-oriented
language: These languages are
general purpose programming languages. Procedural programming is a type of programming where a
structured method of creating programs is used. With procedure-oriented
programming, a problem is broken up into parts and each part is then
broken up into further parts. All these parts are known as procedures.
They are separate but work together when needed. A main program centrally
controls them all. Some procedure-oriented languages are COBOL, FORTRAN,
and C.
Object-oriented programming is the
newest and most powerful paradigms. Object-oriented programming requires the
designer to specify the data as well as the operations to be applied on those
data as a single unit. The pairing of data and the operations that can be done
on it is called an object. A program made using this language is therefore made
up of a set of cooperating objects instead of an instructions list. Some examples are C++, Java, and Smalltalk.
These
languages have many advantages over machine and assembly languages. These are
listed below:
- Program
statements resemble English and hence are easier to work with.
- Less
time is required to program a problem.
- Programs
are easier to understand and modify.
- Programming
languages are machine-independent.
However, these
languages still have some disadvantages compared to machine and assembly
languages:
- Programs
execute more slowly.
- These
languages use computer resources less efficiently.
- Problem-oriented language: These
languages are designed to solve specific problems or develop specific
applications by enabling you to describe what you want rather than
step-by-step procedures. These languages are categorized into several
kinds of application development tools as given below:
- Personal
computer applications software like word processors, spreadsheets,
database managers etc.
- Query
languages and report generators like SQL (Structured Query Language, QBE
(Query by Example) etc. to search a database using certain selection
commands.
- Decision
support systems that help managers to make decisions and financial
planning languages.
- Application
generators to develop a particular application without writing detail
logic.
- Natural language: Natural
languages are used in the areas of artificial intelligence and expert
systems. These languages are used to make computers more humanlike and
allow the computer to become smarter. That is, simulate the learning
process by remembering and improving upon earlier information. Two popular
natural languages are LISP and PROLOG.
Compilers and Interpreters
For a high level language to work
on the computer it must be translated into machine language. There are two
kinds of translators – compilers and interpreters. So, high level languages are
called compiled and/or interpreted languages.
In a compiled
language, a translation program is run to convert the programmer’s entire
high-level program, which is called the source code, into a machine language
code. This translation process is called compilation. The machine language code
is called the object code and can be saved and either run (executed)
immediately or later. Some of the most widely used compiled languages are
COBOL, C, C++, FORTAN etc.
In an interpreted language, a
translation program converts each program statement into machine code just
before the program statement is to be executed. Translation and execution occur
immediately, one after another, one statement at a time. Unlike compiled
languages, no object code is stored and there is no compilation. The most
frequently used interpreted language is BASIC.
Some languages
are both compiled and interpreted. One popular such language is JAVA.
Program Design
Before writing computer programs
we can use different tools to design it. This design helps the programmer to
write computer programs more easily, correctly, and quickly. Some most useful
program design tools are: algorithm,
flowchart, and pseudocode.
Algorithm
An algorithm is a finite sequence
of instructions for solving a stated problem. A stated problem is a
well-defined task that has to be performed and must be solvable by an
algorithm. The algorithm must eventually
terminate, producing the required result. For example, the following algorithm
can be used to compute interest given the values of p, n, and r.
- Enter the values of p, n, and r.
- Calculate interest i using the formula p × n × r / 100.
- Display interest i
as a result.
Properties of a good algorithm:
- Input: A
number of quantities are provided to an algorithm initially before the
algorithm begins. These quantities are inputs which are processed by the
algorithm.
- Definiteness:
The processing rules specified in the algorithm must be unambiguous and
lead to a specific action.
- Effectiveness:
Each instruction must be sufficiently basic such that it can, in
principle, be carried out in a finite time by a person with paper and
pencil.
- Finiteness:
The total time to carry out all the steps in the algorithm must be finite.
- Output: An
algorithm must have output.
- Correctness:
Correct set of output must be produced from the set of inputs. For the
same input, it must always produce the same output.
Flowchart
A flowchart is a common
type of chart that represents an algorithm or a computer program showing the
steps as boxes of various kinds, and their order by connecting these with
arrows. Flowcharts are used in analyzing, designing, documenting or managing a
process or program in various fields. A typical flowchart may have the
following kinds of symbols.
- Circles, ovals, or rounded rectangles:
Usually containing the word "Start" or "End", or
another phrase signaling the start or end of a process.
- Arrows: Shows flow control. An
arrow coming from one symbol and ending at another symbol represents that
control passes to the symbol the arrow points to.
- Rectangle: Represents processing
steps.
- Parallelogram: Represents input
and output.
- Diamond: Represents condition or
decision. These typically contain a Yes/No question or True/False test.
This symbol is unique in that it has two arrows coming out of it, usually
from the bottom point and right point, one corresponding to Yes or True,
and one corresponding to No or False. The arrows should always be labeled.
For example, the flowchart to calculate simple interest (if balance is greater than or equal to 100000, interest is 5%, otherwise, interest is 3%) is given below:
Pseudocode
It is also
called program design language (PDL)
or structured English. It is a
language and syntax for designing a computer program based on the relative
strengths of structured programming and Natural English. At first glance, PDL
looks like a modern programming language. The difference between PDL and a real
programming language lies in the use of narrative text embedded directly within
PDL statements. In pseudocode, we can use language constructs like IF, SWITCH,
FOR, WHILE, and DO-WHILE along with Natural English. For example,
GET student’s grade
IF student’s grade is greater than or equal to 50
PRINT “passed”
ELSE
PRINT “failed”
ASCII
It is the acronym for the American
Standard Code for Information Interchange.
ASCII is a code for representing English characters as numbers, with each
letter assigned a number from 0 to 127. For example, the ASCII code for uppercase M is 77.
Most computers
use ASCII codes to represent text,
which makes it possible to transfer data from one computer to
another.
Text files stored in ASCII format are sometimes
called ASCII files.
Text editors and word
processors are usually capable of storing data in ASCII format,
although ASCII format is not always the default storage format.
The standard ASCII character
set uses just 7 bits
for each character, meaning it can have 128 identifiers, two to the seventh
power (27). There are several larger character
sets that use 8 bits, which gives them 128 additional characters.
The extra characters are used to represent non-English characters, graphics symbols, and
mathematical symbols.
Text Editor
A text editor, such as Notepad, is an application program that
can be used to create, view, edit, save, and print text files. Text files only
contain plain text. These programs provide fewer formatting options than word
processors. Text editors can be used to write computer programs or create other
documents. Text editors are often provided with operating systems or software
development packages.
Software
(Information System) Development
Most organizations use a standard
set of steps, called a systems
development methodology to develop and support their information systems.
It is a standard process followed in an organization to conduct all the steps
necessary to analyze, design, implement, and maintain information systems. And systems development life cycle (SDLC)
is the traditional methodology used to develop, maintain, and replace
information systems. It includes different phases as shown in the figure below.
This representation of SDLC is sometimes referred to as the waterfall model or classic life cycle.
Fig: The systems development life cycle
The first phase is called planning. In this phase, someone identifies
the need for a new or enhanced system. These needs are then analyzed,
prioritized and arranged into a plan for the information systems department.
Here, a potential information systems project is explained and an argument for
continuing or not continuing with the project is presented; a detailed plan is
also developed for conducting the remaining phases of the SDLC for the proposed
system.
The next phase
is called analysis. During this
phase, the analyst studies the current system and proposes alternative
replacement systems. Here, the analyst thoroughly studies the organization’s
current procedures and the information systems used to perform organizational
tasks. The analyst work with users to determine what the users want from a
proposed system. The analyst carefully studies any current systems, manual and
computerized, that might be replaced or enhanced as part of this project. The
analyst studies the requirements and structures them according to their
interrelationships and eliminates any redundancies; generates alternative
initial designs to match the requirements; compare these alternatives to
determine which best meets the requirements within the cost, labor, and
technical levels the organization is willing to commit to the development process.
The output of this phase is a description of the recommended alternative
solution. Once the recommendation is accepted by owners, you can begin to make
plans to acquire any hardware and system software necessary to build or operate
the system as proposed.
The
next phase is called design. During
this phase, you convert the description of the recommended alternative solution
into logical and then physical system specification. Here, you must design all
aspects of the system form input and output screens to reports, databases, and
computer processes. Logical design
is the part of the design process that is independent of any specific hardware
or software platform. Theoretically, the system could be implemented on any
hardware and systems software. Physical design
is the part of the design phase in which the logical specifications of the
system form logical design are transformed into technology-specific details
from which all programming and system construction can be accomplished.
The next phase is called implementation. In this phase, the
information system is coded, tested, installed, and supported in the
organization. During coding, programmers write the programs that make up the
information system. During testing, programmers and analysts test individual
programs and the entire system in order to find and correct errors. During
installation, the new system becomes a part of the daily activities of the
organization. Implementation activities also include initial user support such
as the finalization of documentation, training programs, and ongoing user
assistance.
The
final phase of SDLC is called maintenance.
In this phase, information system is systematically repaired and improved. When
a system is operating in an organization, users sometimes find problems with
how it works and often think of better ways to perform its functions. Also the
organization’s needs with respect to the system change over time. In
maintenance, you make the changes that users ask for and modify the system to
reflect changing business conditions.
3:48 PM
0 Responses to "Introduction to Program and Programming Language"
Post a Comment