Introduction to Programming Language
Introduction to Programming Language
Problem solving is a process of identifying a problem and finding the best solution for it. Problem solving is a skill that can be developed by following a well organized approach. We solve different problems every day. Every problem is different in its nature. Some problems are very difficult and require more attention to identify the solution. A problem may be solved in different ways. One solution may be faster, less expensive and more reliable than others. It is important to select the best suitable solution.
Different strategies, techniques and tools are used to solve a problem. Computers are used as a tool to solve complex problems by developing computer programs. Computer programs contain different instruction for computer. A programmer writes instructions and computer executes these instructions to solve a problem. A person can be good programmer if he has the skill of solving problems. Different problem-solving techniques are as follows
A set of instructions that tells a computer what to do is called program. A computer works according to the given instructions in the program. Computer programs are written in programming languages. A person who develops a program is called programmer. The programmer develops programs to instruct the computer how to process data to convert into information. Programmer uses programming languages or tools to write programs.
Advantages of Computer Program
Different advantages of computer program are as follows: A computer program can solve many problems by giving instructions to computer.
A computer program can be used to perform a task repeatedly and quickly. A program can process a large amount of data easily.
It can display the results in different styles.
The processing of a program is more efficient and less time consuming
Different types of programs are used in different fields to perform certain tasks.
Algorithms & Pseudo Code
An algorithm is a step-by-step procedure to solve a problem. The process of solving a problem becomes simpler and easier with help of algorithm. It is better to write algorithm before writing the actual computer program.
Properties of Algorithm
Following are some properties of an algorithm:
The given problem should be broken down into simple and meaningful steps. The steps should be numbered sequentially.
The steps should be descriptive and written in simple English.
Algorithms are written in a language that is similar to simple English called pseudo code. There is no standard to write pseudo code. It is used to specify program logic in an English like manner that is independent of any particular programming language.
- A programming Language is a notational system intended primarily to facilitate human-machine interaction.
- The notational is understood both by human and machine.
- The programming language has Syntax, and language elements have Semantics.
What is a program?
- A program is something that is produced using a programming Language.
- A program is a structured entity with Semantics.
What is programming?
What is programming?
- Programming is a Science:
Because it implement the algorithms describe by mathematics and science.
- Programming is a Skill:
Because it requires design efforts.
- Programming is an Engineering:
Because it requires a tradeoffs between program size, speed, time (required for development and debugging) and maintainability among many solutions.
- Programming is an Art
It requires creativity and employ imagination.
Types of programming Languages
Levels/Generations of Programming Languages
- 1st Generation Programming language (1GL)
- Machine Language: 0s or 1s
- 2nd Generation Programming language (2GL)
- Assembly Language : Mnemonics
- 3rd Generation Programming language (3GL)
- High-Level Languages ; (procedure oriented or Object Oriented)
- 4th Generation Programming language (4GL)
- Very-High-Level Languages
- 5th Generation Programming Language
- Natural Languages
Machine language (1GL)
- The lowest level of language.
- The language used to program the first-generation computers.
- The instructions in 1GL are made of binary numbers, represented by 1s and 0s.
- 1s and 0s correspond to the on and off states of electrical switches.
- Suitable for the understanding of the machine but very much difficult to interpret and learn by the human programmer.
Assembly language (2GL)
- Low-level language that allows a programmer to use abbreviations or easily remembered words instead of numbers.
- These Observations are called Mnemonics. These Mnemonic are Opcode and Operands
For Example: ADD AX, BX
MOV CX, AX
Op-code; ADD, MOV, INC
Operands AX, BX,CX
Assembly language (2GL)
- Programmer can write instructions faster but it is still not an easy language to learn.
- Drawback: The language is specific to a particular processor family and environment. (Machine Dependent Language)
- Assembler – A program that translates the assembly language program into machine language.
High Level languages (3GL)
- A High-Level Language is an English-like language.
- It is a refinement of a second-generation programming language.
- It allowed users to write in familiar notation, rather than numbers or abbreviations.
- Most High-level languages are not Machine Dependent.
- Translator for High-level languages is either a Compiler or an Interpreter.
- Examples of High-level languages:
―C and C++
Very-High-Level Languages (4GL)
- 4GLs are much more user-oriented and allow programmers to develop programs with fewer commands compared with 3GLs.
- Non-Procedural Language; Programmers don’t have to specify all the programming logic, only tell the computer what they want done.
- Saves a lot of time.
- 4GLs consist of report generators, query languages, application generators, and interactive database management system
- For example:
- RPG III (Report Generator)
- SQL (Structured Query Language)
- NOMAD and FOCUS (DBMS)
Natural Languages (5GL)
- Two types
- Ordinary Human Languages; like English.
- Programming language that use human language to give people a more natural connection with computers.
- 5GLs are designed to make the computer solve a given problem without the programmer.
- Natural languages are part of the field of study known as Artificial Intelligence.
- Develop machines to emulate human-like qualities such as learning, reasoning, communicating, seeing and hearing.
Evolution of Programming
A number of programming paradigms are:
- Procedural/Imperative Programming
- Functional Programming
- Declarative Programming
- Object Oriented Programming
- Event driven Programming
- Parallel Programming
Procedural or Imperative
- Imperative programs emphasize “tell what to do”
- When we say “ Do this, then do this, then do this, and if xx, do this, otherwise do this” This is imperative programming:
- They focus on evaluating expressions and storing results in a variable.
- The most common imperative language consists of statements such as:
a = 10;
b = 5;
c = a + b;
Example of imperative languages are:
- Assembly language
- C and C++
Is there any Best Programming Language?
- Programming Language is probably used most efficient if it is well suited For a specific task.
- For example
- Business applications are often written in COBOL.
- Beginners to programming use BASIC.
- Scientific programming is often undertaken with either FORTON, PASCAL or C.
Language Evaluation Criteria
- Readability: measure programmer ease in reading source code
- Orthogonality: include context sensitive restrictions.
- Applicability: this is best suited as “use the right tool for the job”
- Writ ability: includes simplicity and orthogonality and support for the abstraction
- Reliability: include type checking and inspection handling
- Cost: includes learning and writing cost, productivity, compilation cost, execution cost, debugging cost etc.
- Other: flexibility of control statements and availability of data structures
History of C Language
- A general-purpose computer programming language.
- Developed between 1969 and 1973 by Dennis Ritchie at the Bell Telephone Laboratories for use with the UNIX operating system.
- Descendant of Ken Thompson’s language “B”
- The first C programming language standard was published in 1978 as “The C Programming Language” by Kernighan and Ritchie (K&R).
- “ANSI C” was the second C programming language standard published in 1989.
- ISO approved “ANSI C” in 1990.
- The latest stable release is C11.