Java Reference
In-Depth Information
Chapter 1
Programming Concepts
In this chapter, you will learn
The general concept of programming
Different components of programming
Major programming paradigms
The object-oriented paradigm and how it is used in Java
What Is Programming?
The term “programming” is used in many contexts. We will discuss its meaning in the context of human-to-computer
interaction. In the simplest terms, programming is the way of writing a sequence of instructions to tell a computer
to perform a specific task. The sequence of instructions for a computer is known as a program. A set of well-defined
notations is used to write a program. The set of notations used to write a program is called a programming language. The
person who writes a program is called a programmer. A programmer uses a programming language to write a program.
How does a person tell a computer to perform a task? Can a person tell a computer to perform any task or does a
computer have a predefined set of tasks that it can perform? Before we look at human-to-computer communication,
let's look at human-to-human communication. How does a human communicate with another human? You
would say that human-to-human communication is accomplished using a spoken language, for example, English,
German, Hindi, etc. However, spoken language is not the only means of communication between humans. We
also communicate using written languages or using gestures without uttering any words. Some people can even
communicate sitting miles away from each other without using any words or gestures; they can communicate at
thought level.
To have a successful communication, it is not enough just to use a medium of communication like a spoken or
written language. The main requirement for a successful communication between two parties is the ability of both
parties to understand what is communicated from the other party. For example, suppose there are two people. One
person knows how to speak English and the other one knows how to speak German. Can they communicate with
each other? The answer is no, because they cannot understand each other's language. What happens if we add an
English-German translator between them? We would agree that they would be able to communicate with the help of a
translator even though they do not understand each other directly.
Computers understand instructions only in binary format, which is a sequence of 0s and 1s. The sequence of
0s and 1s, which all computers understand, is called machine language or machine code. A computer has a fixed
set of basic instructions that it understands. Each computer has its own set of instructions. For example, 0010 may
be an instruction to add two numbers on one computer and 0101 is an instruction to add two numbers on another
computer. Therefore, programs written in machine language are machine-dependent. Sometimes machine code is
referred to as native code as it is native to the machine for which it is written. Programs written in machine language
are very difficult, if not impossible, to write, read, understand, and modify. Suppose you want to write a program that
 
Search WWH ::




Custom Search