Nothing Special   »   [go: up one dir, main page]

His123 Note 1

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 7

Introduction

Think about some of the different ways that people use computers. In school, students use
computers for tasks such as writing papers, searching for articles, sending email, and
participating in online classes. In hospital, we can see the use of computers for, assessment,
Patient monitoring, Documentation telemedicine and Electronic Medical record
Computers are also used for several types of medical examination and procedures. For instance,
heart rate monitor is used in hospitals where patients with heart ailments come. Blood glucose
monitor is another computer-based system where diabetics are monitor.
At work, people use computers to analyze data, make presentations, conduct business
transactions, communicate with customers and coworkers, control machines in manufacturing
facilities, and do many other things. At home, people use computers for tasks such as paying
bills, shopping online, communicating with friends and family, and playing computer games.
And don’t forget that cell phones, iPods, Blackberries, car navigation systems, and many other
devices are computers too. The uses of computers are almost limitless in our everyday lives.
Computers can do such a wide variety of things because they can be programmed. This means
that computers are not designed to do just one job, but to do any job that their programs tell them
to do. A program is a set of instructions that a computer follows to perform a task. For example,
let’s take two commonly used programs, Microsoft Word and Adobe Photoshop. Microsoft
Word is a word processing program that allows you to create, edit, and print documents with
your computer. Adobe Photoshop is an image editing program that allows you to work with
graphic images, such as photos taken with your digital camera.
Programs are commonly referred to as software. Software is essential to a computer because it
controls everything the computer does. All of the software that we use to make our computers
useful is created by individuals working as programmers or software developers. A programmer,
or software developer, is a person with the training and skills necessary to design, create, and test
computer programs. Computer programming is an exciting and rewarding career. Today, you
will find programmers’ work used in business, medicine, government, law enforcement,
agriculture, academics, entertainment, and many other fields.
CONCEPT OF PROGRAMMING
Computer: is a tool used for processing data into information. The processing is controlled by a
set of detailed step by step instructions.
Program: The list of instructions that the computer must follow to be able to process data into
information. These instructions consist of statements written in a specific programming
language. When a program is written, we are basically solving a problem. To solve a problem,
we need to use our mind power or logic to develop the detailed instructions. OR
A program is a set of instructions that tells the computer what to do. Computer programming
(often shortened to programming or coding), is the process of writing, testing,
debugging/troubleshooting and maintaining act of instructions (source code) for solving a
problem with the computer. A source code is written in an acceptable computer programming
language. The code may be a modification of an existing source or something completely new.
Programming: The procedure of developing the detailed instructions for the computer.
PURPOSE OF PRGAMMING
The purpose of programming is to create a program that exhibits a certain described behavior
(customization). The process of writing source code requires expertise in many different
subjects,
including knowledge of the application domain. Alternatively. Programming is the craft of
transforming requirements into something that a computer can execute. Problem solving on
computer is a task of expressing the solution to the problem in terms of simple concepts,
operations and computer code (program) to obtain the results. To achieve this aim, you may
proceed as follows.
1 First, understand the problem clearly: - Decide what you want to be calculated by the
computer. What will be the input data required? (If any). This is the problem formulation.
2 Write the steps of computation that are necessary to arrive at the solution. This is setting
up the algorithm.
3 Prepare a flowchart corresponding to the algorithm.
4 Develop the computer program. Test and run it on the computer.
There is an ongoing debate on the extent to which the writing of programs is an art, a craft or an
engineering discipline. Good programming is generally considered to be the measured
application art, craft and engineering, with the goal of producing an efficient and maintainable
software (program) solution.
The discipline differs from many other technical professions in that programmers generally do
not need to be licensed or pass any standardized (or governmentally regulated) certification tests
in order to call themselves “programmers” or even “software engineers”.
COMPUTER LANGUAGES
All computers whether small or big cannot do anything on their own. They all require a series of
instructions (i.e., programs) before they can do any processing. It is these programs that will
direct the computer to carry out the required task. The programs have to be written out
comprehensively: to cover all possibilities: and in the right order before the control unit of the
CPU can use them effectively.
Programs can be written in several languages. Just as there are many spoken languages, there are
many computer languages. In this lecture we shall study the different levels of computer
languages and their forms.
Currently all computer languages can be grouped into three, namely, machine languages,
assembly
languages and high-level languages. Machine languages and assembly languages are together
referred to
as low-level languages. The detail characteristics of each group of languages are discussed
below.
CLASSIFICATION OF PROGRAMMING LANGUAGES ACCORDING TO LEVEL
MACHINE LANGUAGE
Machine Code or machine language is a low-level programming language that can be understood
directly by a computer’s central processing unit (CPU). Machine code consists of sequences of
binary numbers, or bits, which are usually represented by 1s and 0s, and which form the basic
instructions that guide the operation of a computer. The specific set of instructions that
constitutes a machine code depends on the make and model of the computer’s CPU. For
instance, the machine code for the Motorola 68000 microprocessor differs from that used in the
Intel Pentium microprocessor.
Writing programs in machine code is tedious and time-consuming since the programmer must
keep track of each specific bit in an instruction. Another difficulty with programming directly in
machine code is that errors are very hard to detect because the program is represented by rows
and columns of 1s and 0s.
Advantages of Machine Language
a. Less code is produced
b. Storage is saved
c. User has direct control of machine instruction
d. Execution is faster as no translation is needed
e. The programmer knows all the registers and instruction that use them.
Disadvantages of Machine Language
a. Cumbersome ie, tedious and difficult to learn
b. Programmer’s fluency is affected, thereby making the programs developed inefficient.
c. The developed programs are error prone and difficult to debug (correct)
d. The performance of the system is unreliable.
ASSEMBLY LANGUAGE
Assembly language is type of low-level computer programming language in which each
statement corresponds directly to a single machine instruction. Assembly languages are thus
specific to a given processor. After writing an assembly language program, the programmer must
use the assembler specific to the microprocessor to translate the assembly language into machine
code.
Assembly language provides precise control of the computer, but assembly language programs
written for one type of computer must be rewritten to operate on another type. Assembly
language might be used instead of a high-level language for any of three major reasons: speed,
control, and preference. Programs written in assembly language usually run faster than those
generated by a compiler; use of assembly language lets a programmer interact directly with the
hardware (processor, memory, display, and input/output ports).
Assembly language uses easy-to-remember commands that are more understandable to
programmers than machine-language commands. Each machine language instruction has an
equivalent command in assembly language. Assembly language makes programming much
easier, but an assembly language program must be translated into machine code before it can be
understood and run by the computer. Special utility programs called assemblers perform the
function of translating assembly language code into machine code.
Like machine code, the specific set of instructions that make up an assembly language depend on
the make and model of the computer’s CPU. Other programming languages such as Fortran,
BASIC, and C++, make programming even easier than with assembly language and are used to
write the majority of programs. These languages, called high-level languages, are closer in form
to natural languages and allow very complicated operations to be written in compact notation.
Advantages of Low Level Language
a. Program translation is easier than high level language
b. It affords the programmer the opportunity to understand the internal structure of
the hardware and its registers.
Disadvantages of Low Level Language
a. It is machine dependent, that is, cannot be transferred to another computer.
b. Program development is slow as the programmer must have detailed knowledge
of the hardware structure.
c. Program maintenance is slow and error prone.
HIGH LEVEL LANGUAGE
High-Level Language is a computer language that provides a certain level of abstraction from the
underlying machine language through the use of declarations, control statements, and other
syntactical structures. In practice, the term comprises every computer language above assembly
language. The next generation of language is called the 3 rd generation. The computer
programmers enjoy using this language because it gives them the fluency, the flexibility and the
opportunity to express their thought to the best of their ability. The languages of this generation
are called High level language. The high level languages are referred to as machine language and
assembly language.
Advantages of High Level Language
a. 2) It makes programming easier for the human being.
b. 3) High level instructions are easier to understand and faster to code.
c. 4) Error correction and resting of program is easier
d. 5) They are machine independent. That is, program written for computer can be
transferred to
e. another computer with little or no modification.
Disadvantages of High Level Languages
a. High level language tends to be inefficient in the use of CPU and other facilities.
b. Machine code instructions are produced and than requires more storage spaces.
c. More time is required to run the program as it has to be translated.
COMPARISON BETWEEN HIGH-LEVEL LANGUAGE AND LOW-LEVEL LANGUAGE
S High-Level Language Low-Level Language
N
1 It is a programming language in the sense that It is a type of language, which is machine-
it's user-friendly. friendly.
2 These languages are considered less memory These languages are considered high
efficient. memory efficient.
3 It is simple to comprehend. It's difficult to comprehend.
4 It's straightforward to troubleshoot. Comparatively, it is complex to debug.
5 It's easy to keep up with. In comparison, it is difficult to maintain.
6 High-level language is portable. Low-level language is non-portable.
7 It is compatible with all operating systems. It is entirely dependent on the machine.
8 For translation, a compiler or interpreter is For translation, it will need an assembler.
required.
9 It is commonly used in programming. It is no longer widely used in
programming.

Language Translators
These are the programs which are used for converting the programs in one language into
machine language instructions, so that they can be executed by the computer.
A program written in high-level language is called as source code. To convert the source code
into machine code, translators are needed.
A translator takes a program written in source language as input and converts it into a program in
target language as output.
It also detects and reports the error during translation.

ROLES OF TRANSLATOR ARE:


• Translating the high-level language program input into an equivalent machine language
program.
• Providing diagnostic messages wherever the programmer violates specification of the high-
level language program.
Different type of translators
The different types of translators are as follows:
Compiler
A compiler is a translator used to convert high-level programming language to low-level
programming language. It converts the whole program in one session and reports errors detected
after the conversion. The compiler takes time to do its work as it translates high-level code to
lower-level code all at once and then saves it to memory.
Advantages of the Compiler:
 The whole program is validated so there are no system errors.
 The executable file is enhanced by the compiler, so it runs faster.
 User do not have to run the program on the same machine it was created.
Disadvantages of the Compiler:
 It is slow to execute as you have to finish the whole program.
 It is not easy to debug as errors are shown at the end of the execution.
 Hardware specific, it works on specific machine language and architecture.
Interpreter
Interpreter is a translator which is used to convert programs in high-level language to machine
language. Interpreter translates the source code line by line and reports the error once it
encountered during the translation process.
It directly executes the operations specified in the source program when the input is given by the
user. It gives better error diagnostics than a compiler.
Advantages of the Interpreter:
 You discover errors before you complete the program, so you learn from your mistakes.
 Program can be run before it is completed so you get partial results immediately.
 You can work on small parts of the program and link them later into a whole program.
Disadvantages of the Interpreter:
 There’s a possibility of syntax errors on unverified scripts.
 Program is not enhanced and may encounter data errors.
 It may be slow because of the interpretation in every execution.
Assembler
An assembler is a translator used to translate assembly language to machine language. It is like a
compiler for the assembly language but interactive like an interpreter. Assembly language is
difficult to understand as it is a low-level programming language. An assembler translates a low-
level language, an assembly language to an even lower-level language, which is the machine
code. The machine code can be directly understood by the CPU.
Advantages of the Assembler:
 The symbolic programming is easier to understand thus time-saving for the programmer.
 It is easier to fix errors and alter program instructions.
 Efficiency in execution just like machine level language.
Disadvantages of the Assembler:
 It is machine dependent, cannot be used in other architecture.
 A small change in design can invalidate the whole program.
 It is difficult to maintain.
Comparison between Compiler and interpreter
SN Compiler Interpreter
1 Performs the translation of a program as a whole. Performs statement by statement translation.
2 The compiled programs run faster The Interpreted programs run slower
3 Debugging is hard as the error messages are It stops translation when the first error is met. Hence,
generated after scanning the entire program only. debugging is easy.
4 Most of the Languages use compiler A very few languages use interpreters.
5 The executable program is stored in a disk for The executable program is generated in RAM
future use or to run it in another computer and the interpreter is required for each run of
the program
FEATURES OF A GOOD COMPUTER PROGRAM
1. Reliability: Any developed program for a particular application can be depended upon to do
what it is supposed to accomplish. How often the results of a program are correct. This depends
on prevention of resulting from data conversion and prevention of errors resulting from buffer
overflows, underflows and zero division.
2. Meeting User’s Needs: Any developed system has a purpose for which it is developed. A
developed program is a failure if it cannot meet the objectives for which it is proposed and
designed, that is, if the potential users cannot use it either because it is too complex or too
difficult. The usability of an application analysis involving the user.
3. Development on time within Budgets: Estimates of time and cost for writing computer
programs have frequently been under or over estimated. The components of a structured
disciplined approach to programming are:
i) Proper control and management of time and cost required.
ii) Increased programmer productivity
iii) More accurate estimates.
4. Error-Free Set of Instruction: Almost all large set of programs contain errors. If a program
is designed and developed in a disciplined structured approach, it minimizes the likelihood of
errors and facilitates detection/correction of such errors during program testing.
5. Error-Resistant Operations: A good program should be designed in such a way that it can
perform validation run on each input data to determine whether or not they meet the criteria set
for them. E.g. Reasonableness check, Existence check, Dependency check, etc.
6. Maintainable Code: A good program design will always be easy to change or modify when
the need arises. Programs should be written with the maintenance activity in mind. The structure,
coding and documentation of the program should allow another programmer to understand the
logic of the program and to make a change in one part of a program without unknowingly
introducing an error in another part of the same program.
7. Portable Code: A good program design will be transferable to a different computer having a
language translator for that language without substantial changes or modification.
8. Readability: The program codes will be easy for a programmer to read and understand the
logic involved in the programming.
9. Storage Saving: A good program design is not to be verbose, that is, it will not be allowed to
be unnecessary long, thereby consuming much storage that will be required for processing data
and storage of information produced from processing.
10. Efficiency: The amount of system resources a program consumes (processor time, memory
space, slow devices, network bandwidth and to some extent even user interaction), the less the
better.
11. Robustness: How well a program anticipates situations of data type conflict and other
incompatibilities that result in run time errors and program halts. The focus is mainly on user
interaction and handling of exception.
12. Usability: The clarity and intuitiveness of a programs output can make or break it’s success.
This involves a wide range of textual and graphical elements that makes a program easy and
comfortable to use.

You might also like