Unit-1 Lecture - 1
Unit-1 Lecture - 1
Malode
Department Computer
CO 1
What is a programming language
What is a programming language
• A programming language is a set of rules that provides a
way of telling a computer what operations to perform.
• A programming language is a set of rules for
communicating an algorithm.
• A programming language is a notational system for
describing computation in a machine-readable and
human-readable form.
• A programming language is a tool for developing
executable models for a class of problem domains
Contd.
• English is a natural language. It has words, symbols and
grammatical rules.
• A programming language also has words, symbols and rules of
grammar.
• The grammatical rules are called syntax.
• Each programming language has a different set of syntax rules.
Why there are so Much Languages?
Why there are so Much Languages?
• Programming languages have evolved over time as better ways
have been developed to design them.
• First programming languages were developed in the 1950s.
• Since then thousands of languages have been developed
Machine language
• Machine language is a low-level language made up of
binary numbers or bits that a computer can understand.
• Machine language is machine dependent as it is the
only language the computer can understand.
• Very efficient code but very difficult to write.
Second Generations Languages
Assembly languages
• A low-level language that helps to communicate directly
with computer hardware.
• It uses mnemonics to represent the operations that a
processor has to do.
• Very efficient code and easier to write.
Working of Assembly Code
1. Assembly languages contain mnemonic codes that
specify what the processor should do.
2. The mnemonic code that was written by the programmer
was converted into machine language (binary language)
for execution.
3. An assembler is used to convert assembly code into
machine language.
4. That machine code is stored in an executable file for the
sake of execution.
Third Generations Languages
•Closer to English but included simple mathematical notation.
•Programs written in source code which must be translated
into machine language programs called object code.
•The translation of source code to object code is
accomplished by a machine language system program
called a compiler.
•Common third generation languages
◦ FORTRAN
◦ COBOL
◦ C and C++
◦ Visual Basic
Fourth Generations Languages
• A high level language (4GL) that requires fewer instructions to
accomplish a task than a third generation language.
• Fourth generation languages are commonly used in database
programming and scripts examples
include Perl, PHP, Python, Ruby, and SQL.
• Used with databases
◦ Query languages
◦ Report generators
◦ Forms designers
◦ Application generators
Fifth Generations Languages
5. Control Flow
Control flow mechanisms (e.g., loops, conditionals, function calls) are core to defining how a
program executes. The structure of control flow allows a program to make decisions, repeat tasks,
and manage the execution path.
8. Memory Management
Memory management is an essential aspect of programming language design. Some languages require
manual memory management (e.g., C), while others provide automatic memory management (e.g., garbage
collection in Java, Python).
❖ Writability refers to the ease with which code can be written in a particular
language. A language with good writability has a concise syntax,
easy-to-remember keywords and constructs, and powerful abstractions that
make it easy to express complex ideas.
Readability
• The ease with which code can be modified and updated over
time. A language that is easy to maintain allows developers to
make changes and fix issues more quickly and efficiently.
Security
Portability
Cross-Platform Support: The language should ideally be able to
run on multiple platforms without requiring significant changes to
the code.
Environment Independence: A good language should not be tied
to a particular operating system or hardware platform.
Programming Languages qualities
3. Accumulator (AC)
● Function: The Accumulator (AC) is a special-purpose register that temporarily holds the results of computations
performed by the Arithmetic Logic Unit (ALU).
There are five basic types of computer operations: Inputting, processing, outputting, storing, and
controlling.
Input
Input is whatever goes into the computer. Input can take a variety of forms,
from commands you enter by keyboard to data from another computer (via a
network connection) or device (via direct or network connection). A device that
feeds data into a computer, such as a keyboard or mouse, is called an input
device.
Output
Advantage:
Very simple to implement
It contains loops, variables etc.
Imperative programming is divided into three broad categories: Procedural, OOP and
parallel processing.
Procedural programming paradigm
This paradigm emphasizes on procedure in terms of under lying machine model.
There is no difference in between procedural and imperative approach. It has the
ability to reuse the code and it was boon at that time when it was in use because of
its reusability.
Examples of Procedural programming paradigm:
C : developed by Dennis Ritchie and Ken Thompson
C++ : developed by Bjarne Stroustrup
Java : developed by James Gosling at Sun Microsystems
ColdFusion : developed by J J Allaire
Pascal : developed by Niklaus Wirth
#include <iostream>
#include <stdio.h> using namespace std;
int main() {
int number1, number2, sum; int main()
printf("Enter two integers: "); {
scanf("%d %d", &number1, int firstNumber, secondNumber,
sumOfTwoNumbers;
&number2);
cout << "Enter two integers: ";
// calculating sum cin >> firstNumber >> secondNumber;
sum = number1 + number2; sumOfTwoNumbers
printf("%d + %d = %d", sumOfTwoNumbers = firstNumber +
number1, number2, sum); secondNumber;
return 0; cout << firstNumber << " + " << secondNumber
} << " = " << sumOfTwoNumbers;
return 0;
}
The program is written as a collection of classes and object which are meant for
communication. The smallest and basic entity is object and all kind of computation is
performed on the objects only. More emphasis is on data rather procedure. It can handle
almost all kind of real life problems which are today in scenario.
Advantages:
• Data security
• Inheritance
• Code reusability
• Flexible and abstraction is also present
Examples of Object Oriented programming
paradigm
Simula : first OOP language
Java : developed by James Gosling at Sun Microsystems
C++ : developed by Bjarne Stroustrup
Objective-C : designed by Brad Cox
Visual Basic .NET : developed by Microsoft
Python : developed by Guido van Rossum
Ruby : developed by Yukihiro Matsumoto
Smalltalk : developed by Alan Kay, Dan Ingalls, Adele Goldberg
#import <Foundation/Foundation.h>
Objective- C Program
Parallel processing approach
Parallel processing is the processing of program instructions by dividing them among multiple
processors. A parallel processing system posses many numbers of processor with the objective
of running a program in less time by dividing them. This approach seems to be like divide and
conquer. Examples are NESL (one of the oldest one) and C/C++ also supports because of some
library function(multithreading).
NESL is a parallel language developed at Carnegie Mellon by the SCandAL project. It integrates various
ideas from the theory community (parallel algorithms), the languages community (functional languages)
and the system's community (many of the implementation techniques).
2. Declarative programming paradigm
It can be termed as abstract model of computation. It would solve logical problems like
puzzles, series etc.
In logic programming we have a knowledge base which we know before and along with
the question and knowledge base which is given to machine, it produces result.
Languages that emphasize this paradigm: Prolog, GHC, Parlog, Vulcan, Polka, Mercury,
Fnil.
In logical programming the main emphasize
is on knowledge base and the problem. The
execution of the program is very much like
proof of mathematical statement, e.g.,
Prolog
go:- write('Enter first number : '),read(X),nl,
write('Enter second number : '),read(Y),nl,
add(X,Y).
mul(X,Y):-
S is X+Y,
M is X*Y,
write('Addition is : '),write(S),nl,
write('Multiplication is : '),write(M).
% End of code
Functional programming paradigms
Function returns:
15.0
Examples of Functional programming
paradigm:
JavaScript : developed by Brendan Eich
Haskwell : developed by Lennart Augustsson, Dave Barton
Scala : developed by Martin Odersky
Erlang : developed by Joe Armstrong, Robert Virding
Lisp : developed by John Mccarthy
ML(Meta language) : developed by Robin Milner
Clojure : developed by Rich Hickey
const num1 = parseInt(prompt('Enter the first number '));
main = do const num2 = parseInt(prompt('Enter the second number '));
Javascript
Haskell
Database/Data driven programming
approach
This programming methodology is based on data and its movement. Program
statements are defined by data rather than hard-coding a series of steps. A database
program is the heart of a business information system and provides file creation, data
entry, update, query and reporting functions.
CREATE DATABASE databaseAddress;
CREATE TABLE Addr (
PersonID int,
LastName varchar(200),
FirstName varchar(200),
Address varchar(200),
City varchar(200),
State varchar(200)
);
Select * from Addr where City=“Nashik”;
THANK YOU
Maratha Vidya Prasarak Samaj’s Phone Number: 0253-2571439/ 0253-2582891 Email id: [email protected]
KBT College of Engineering Nashik Fax number: 0253-2317016 College website: http://kbtcoe.org
Udoji Maratha Boarding Campus, Gangapur Road,
Nashik-422013. Maharashtra India