Programming Language
A programming language is a set of instructions and
syntax used to create software program.
KEY FEATURES:
1.Syntax – Specific rules to write and code in a
programming language.
2.Datatypes – The type of values that can be stored in a
program.
3.Variable – Named memory locations that can store
values.
4.Operator - Operators are symbols used to perform
mathematical and logical operations.
5.Control Structure – Statements used to control the
flow of a program.
6.Libraries and Framework – Libraries are the
collection of pre-written code that can be used to perform
common tasks and speed-up development.
7.Paradigm – The programming style used in the
program.
Ex- 1. Procedural-Oriented Programming
2. Object-Oriented Programming
3. Functional Oriented Programming
TYPES OF PROGRAMMING LANGUAGES:
LOW LEVEL LANGUAGE:
Any language that operates close to the hardware, offering
direct memory and hard ware control. Includes both
machine and Assembly Languages.
Characteristics :
▪ More control, faster execution, but less user-friendly
and portable.
▪ Used for system programming, device drivers,
embedded system.
Example : Machine language & Assembly language.
MACHINE LANGUAGE:
The fundamental language of computers, consisting
purely of binary digits (0’s and 1’s) directly executed by the
C.P.U
Characteristics :
▪ No abstraction; extremely hardware-specific.
▪ Difficult for humans to read and write, fastest
execution, minimal resources required.
Example : 10001100, 10001001, etc.
ASSEMBLY LANGUAGE:
A low-level language that uses mnemonic codes (like
MOV, ADD, SUB) in place of binary, making it easier for
humans than pure language.
Characteristics :
▪ Direct correspondence with machine language
instructions.
▪ Processor-specific and requires an assembler to
translate to machine code.
▪ Offers more readability than machine language, but
still less portable and more complex than high-level
languages
Example : X86 Assembly, ARM Assembly
Type: Low level language (but a step up from machine
language).
HIGH LEVEL LANGUAGE:
Programming Languages written using syntax similar to
human languages (English words and familiar symbol)
abstracting away hardware detail.
Characteristics :
▪ Easier to write, read, and maintain.
▪ Machine independent (potable across platforms).
▪ Requires a compiler or interpreter to translate to
machine /assembly code for execution.
Examples : Python, Java, Ct+, JavaScript, Ruby
Type: High level Language (maximum abstraction from
hardware).
Characteristics of a good programming language: -
# A good programming language exhibits several key
characteristics that facilitate efficient development,
reliability and maintainability of software.
These characteristics include: -
1. Simplicity & Reliability: The language should be
easy to learn & understand with a clear and
consistent syntax.
# This promotes readability making code easier to
comprehend and maintained by multiple developers.
2. Portability: A program written in the language
should be able to run on different platforms and O.S.
with minimal or no modifications.
# This ensures wider applicability and reduces
development efforts for multi-platform deployment.
3. Efficiency: The language should allow for creation
of programs that execute quickly and efficiently
utilising the system resources including memory and
processing power.
4. Abstraction and Expressiveness: The language
should provide mechanism for abstraction enabling
developers to manage complexity by defining and
reusing modular components.
The language should also be expressive i.e. allowing
clear and concise representations of algorithms and
data structure.
5. Robustness & Error Handling: A good language
must include robust error handling & debugging,
helping developers identify and resolve issues
efficiently.
6. Consistency : The long syntax and semantics
should be consistent throughout code minimizing
exceptions & special cases that can lead to confusion
&error.
7. Naturalness for Application Domain : The
language should be well suited for its intended
application area offering appropriate data-structures,
operators & control flow constructs that align with the
problem domain.
8. Maintainability : The language should facilitate
easy modifications, updates and extension of existing
code, promoting long term software viability.
Programming Paradigm: -
Programming paradigm is a fundamental style and
approach to the programming.
It’s a set of rules and concepts that guide the
development process while there are many
programming languages each of them is typically
adhere to one or more paradigm that guide how the
language is implemented.
Programming Paradigm Provides: -
1. Structure & Organization : Paradigm defines how
the programs are designed, organised and executed.
2. Improve Problem Solving Approach : Different
problems can be solved by different paradigm.
3. Support Collaboration : A shared paradigm
means the team follows same programming style and
thinking model. Thus, reducing the confusion.
4. Match with Specific application or domains :
Some paradigms are better for AI, Some for web -
development etc.
5. Improve Program efficiency and reliability :
Choosing right paradigm often leads to more efficient
& error free code.
Programming Paradigm have two types: -
1. Imperative Programming Paradigm –
a. Procedural Programming Paradigm
b. Object-Oriented Programming Paradigm
c. Parallel Processing Approach
It is a programming approach that focuses on specifying
how a computer should execute the task by providing step
by step sequence of commands telling it exactly to what to
do and in what order achieve the desired outcome.
KEY CHARACTERISTICS: -
• Step by Step execution: Instructions are executed
in a pre-defined order i.e. top to bottom.
• State Manipulation : Variables are used to modify
data. And the program state changes as these
variables are updated.
• Control Flow : Control structure like loops &
conditional statements dictate the order in the
statement in which the statements are executed.
• Focuses on how : Programmer explicitly defines
the sequence of operations needed to achieve the
result.
Example: C, C++, JAVA, etc.
2. Declarative Programming Paradigm –
a. Logic Programming Paradigm
b. Fundamental Programming Paradigm
c. Database Programming Approach
It is a programming paradigm that focuses on describing
what the program should achieve rather than explicitly
specifying how to achieve it. It emphasises expressing
logic and relationship leaving the detail of execution to the
underlying system.
KEY CHARACTERISTICS:
• Focus on what, not how : It emphasises
describing the desired outcome or result, it doesn’t
dictate the exact steps or control flow to reach that
result.
• Abstraction : It provides a higher level of
abstraction, hiding the complexities of how the
computation is performed.
• Enhanced Maintainability : Because the code
focuses on logic rather than the specific steps. So, it
can be easier to understand, modify & maintain.
Example: SQL, HTML, etc.
PROCEDURAL PROGRAMMING PARADIGM:
Procedural programming paradigm weighs of the concept
of procedure call. In this paradigm a program is structured
around procedures also known as routines, sub-routines
or functions which are self-contained block of code
designed to perform a specific task so the programs follow
a sequence of these procedure calls emphasizing the
step-by-step or top-down approach of problem solving.
Key Concepts:
• Procedures
Code is organised into reuseable procedures that
encapsulates a series of computational steps.
• Sequential Execution
Instructions within the procedures & the calls to procedures
that encapsulates a series of computational steps.
• Data and Procedures Separation
Data and the procedures that operate on that data are
treated as separate identities.
• Code Reusability
Procedures can be called multiple times throughout the
execution thus reducing the code duplication.
OBJECT ORIENTED PROGRAMMING PARADIGM:
Object-oriented programming paradigm is a programming
paradigm that uses objects to design applications and
computer programs.
These objects contain data(attributes) &
methods(functions) that operate on that data promoting
modularity and reusability.
Key Concepts:
• Objects : - Objects are the fundamental building
blocks representing real-world entities with data &
behaviour.
• Classes : - Classes are the blueprints for creating
objects that define their structure and behaviour.
• Encapsulation : - Binding data and methods in a
object controlling access and promoting integrity.
• Inheritance : - Allows new classes to inherit
properties and methods from the existing classes
thus promoting code reuse and reducing redundancy.
• Polymorphism : - Ability of an object to take many
forms allowing different objects to respond to same
methods call in their own way.
• Abstraction : - Hiding unnecessary details, only
showing the relevant data.
LOGICAL PROGRAMMING PARADIGM: -
The logical programming paradigm focuses on defining
relationships between data using logical data i.e. facts &
rules rather than specifying step-by-step instructions.
Key Characteristics:
• Facts : These are simple statements that represent
known information.
• Rules : Logical statements that defines relationships
based on other facts or rules.
• Queries : Questions asked of the program to retrieve
information or verify facts.
• Inference : The mechanism by which the system
uses rules and facts to derive new knowledge and
answer queries.
Example:
Facts :
• Parent (John, Mary)
• Parent (Susan, Mary)
• Parent (John, Peter)
• Male (John)
• Female (Susan)
Rules :
▪ Father (x, y): - parent (x, y), male (x)
x is father of y, if x is parent of y and x is male.
▪ Mother (x, y): - parent (x, y), female(x)
x is mother of y, if x is parent of y and x is female.
▪ Sibling (x, y): - parent (z, x) and parent (z, y)
x and y are siblings if both of them have same
parents.
Queries :
➢ ? – father (John, Mary)
➢ ? – mother (Susan, Mary)
➢ ? – mother (x, Mary)
➢ ? – sibling (Mary, Peter)
FUNCTIONAL PROGRAMMING PARADIGM:
It is a style of program where computation is treated as
evolution of mathematical functions.
It emphasizes writing programs using pure functions &
avoids changing state or mutable data.
So, it also focuses on what to solve rather than how to
solve.
Key Characteristics:
❖ Functional Programming keep your data and
functions totally separate.
❖ In this data is immutable. Can’t update the same
variable again and again.
❖ Functions can be stored in variable. Passed as
argument to other function and return from
functions.
❖ This programming style uses recursion instead of
loops. Using recursive function calls.
❖ It has the ability to break down large programs
into smaller reusable functions and modules.
❖ List support functional programming paradigm.
Concurrent Programming Paradigm:
Concurrent Programming Paradigm is where multiple
sequence of operations i.e. processes appear to execute
simultaneously overlapping time. So, it allows for better
resources utilization especially when task involve waiting
for external operations and sharing resources.
Key Characteristics:
➢ Simultaneous Execution – It involves multiple
tasks that can run at the same time on single
processor.
➢ Interleaving – On a single processor concurrent
task are interlinked i.e. the processor switches
between them, giving them the illusion of parallel
execution.
Structured and Unstructured Data:
• Structured data is a type of data i.e. well organised
and accurately formatted. This data exists in a form of
relational databases (RDBMS) i.e. the information is
stored in tables with rows and columns that are
connected. In this way structured data is arranged
and recorded neatly so it can be easily found and
processed.
• Unstructured data is a type of data which aren’t
structured in a predefined way i.e. data is stored in a
native format.
STRUCTURED: UNSTRUCTURED:
Data is organised and Data that lacks
formatted in a specific specific structure or
way of following a formats and typically
predefined order. unorganised or in raw
form.
Organisation:
a. Well organised i. It lacks predefined
with defined format and it is
format. unorganised.
Accessibility:
b. Highly ii. Less accessible and
accessible and requires advance
easily retrieve by technique for
using SQL. extraction.
Analysis:
c. Structured data iii. It requires advanced
can be easily techniques like NLP
analysed using and Machine
traditional Learning algorithm
statistic method for analysis.
and data mining
techniques.
Scalability:
d. Limited iv. Highly scalable and
scalability can accommodate
because of the any type of data
predefined without altering the
format and fixed existing structure.
data structure.
Data Types: -
1. It defines a certain domain of values.
2. It defines operations allowed on these values.
Example: Float types that mean it takes only floating
type values and defines operations such as: -
+, -, /, *, etc.
Datatype
1. Primitive:
• int
• float
• char
• boolean
2. Derived:
• Array
• Structure
• Union
• Pointer
3. User defined:
• Typedef
• Enumeration
Abstract Datatypes:
Abstract datatypes are type of objects behaviour is
defined by set of values and set of operation. The
definition of abstract datatype only mentions what are the
operation to be performed but not how data will be
implemented. It doesn’t specify how data will be
organised in memory and what algorithm to be used for
implementing the operation.
Example : Stack
initialize()
push()
pop()
isEmpty()
isFull()
Here we are specifying functions but we are not saying
anything how list, stack, etc. they are implemented.
Type Checking: -
It is a process of verifying and enforcing constant of types
in values a compiler must check that the source should
follow the syntactic and semantic convention of the
source of the source language and it should also check
the rules of the language.
It allows a programmer to limit what types may be used in
certain circumstances and assign types to values.
The typechecker determines whether these values are
used appropriately or not.
There are two types of typechecking: -
1) Static :
Performed at compile time. It verifies types of
variables based on program source code. It detects
errors before program run enhancing code reliability.
2) Dynamic :
Performed at runtime and verifies types as the
program executes. So, it is more flexible and dynamic.
It may lead to runtime errors if they are not matched.
Binding: -
It refers to the association between a variable and symbol
and its value or a function in a program. This process
determines how the variables will be interpreted and used
during program execution. So binding is the process of
associating attributes with name.
Attribute: Described meaning of semantics of names and
entities.
Binding Time: It is the time at which the binding takes
place.
Example : int a;
int y=2;
CONTROL STRUCTURE:
Control structures in a programming language are
fundamental construct that determine the order in which
the instruction ore executed. They allow programmers to
manage the flow of the program enabling decision making
repartition of task and structured organization of code.
There are three types of control structure:
➢ Sequential : It is the default control structure where
instructions are processed in the order in which they
appear in the code i.e. the compiler will execute the
statement or instruction sequentially.
Example:
int a, b, c;
a=5;
b=3;
c = a+b;
➢ Conditional : This structure allows a program to
make decision and execute different block of code
based on whether the condition true or false.
Example:
if (i > 3)
{ _________
_________
_________
}
else {
___________
___________
___________
}
➢ Iterative : These structures enable the repetition of a
block of code torr p multiple times either for a
specified number of separations or until a certain
condition is met.
Type Conversion: -
Type conversion is changing of one datatype to anether
datatype is called type conversion. The value being
changed may be either promoted or demoted i.e.
Promotion or Demotion.
Promotion : Going from smaller domain to larger
domain.
Demotion : Going from larger domain to smaller domain.
• Automatic conversion of a value from one datatype to
another by a program language without the programmer
specifically doing so is called implicit type conversion.
• Most language have a method for a programmer to
change or cast value from one datatype to another is
called explicit type conversion.
Storage Management: -
It is basically used for managing the storage in various
programming languages and for different types of data.
Storage is divided into three areas:
1. Static area : With the static storage the location of
every variable is fixed, allocated and known at
compile time. No runtime storage management is
there.
2. Stack : Storage management is appropriate when
the storage area is not known at compile time.
Memory is allocated and deallocated automatically
on stack for local variables and function call
information diving function calls.
3. Heap : In heap memory is allocated and deallocated
explicitly by the programmer during runtime functions
like new and delete in C++ malloc in C.