0% found this document useful (0 votes)
16 views21 pages

APP - UNIT I Session 1

The document outlines the fundamentals of programming languages, including their definitions, classifications, and essential elements such as variables, data types, and control structures. It also discusses programming language theory, the Böhm-Jacopini theorem, and the concept of multiple programming paradigms, emphasizing the flexibility and expressive power of modern languages like Java and Python. Overall, it serves as a comprehensive overview of programming languages and their theoretical foundations.

Uploaded by

niteeshbackup.us
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
16 views21 pages

APP - UNIT I Session 1

The document outlines the fundamentals of programming languages, including their definitions, classifications, and essential elements such as variables, data types, and control structures. It also discusses programming language theory, the Böhm-Jacopini theorem, and the concept of multiple programming paradigms, emphasizing the flexibility and expressive power of modern languages like Java and Python. Overall, it serves as a comprehensive overview of programming languages and their theoretical foundations.

Uploaded by

niteeshbackup.us
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PPTX, PDF, TXT or read online on Scribd
You are on page 1/ 21

21CSC203P -Advanced

Programming Practice

Dr.A.Pandiaraj
Assistant Professor
Department of Computing Technologies
SRM Institute of Science and Technology

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 1


Outline of the Presentation
S-3 What is Programming Languages
S-5 Elements of Programming languages
S-7 Programming Language Theory
S-9 Bohm- Jacopini structured program theorem
S-13 Multiple Programming Paradigm
S-15 Programming Paradigm hierarchy
S-18 Imperative Paradigm: Procedural, Object-Oriented and Parallel processing
S-22 Declarative programming paradigm: Logic, Functional and Database
processing - Machine Codes-Procedural and Object-Oriented Programming
S-24 Suitability of Multiple paradigms in the programming language
S-27 Subroutine, method call overhead and Dynamic memory allocation for
message and object storage
S-30 Dynamically dispatched message calls and direct procedure call overheads
S-33 Object Serialization
S-35 parallel Computing

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 2


What is Programming Languages ?
• Programming languages are formal languages designed to communicate instructions to a
computer system or a computing device. They serve as a means for humans to write programs
and develop software applications that can be executed by computers. Each programming
language has its own syntax and set of rules that define how programs should be written.

• Programming languages can be classified into different types, including:


1.Low-Level Languages: These languages are close to machine code and provide little or no
abstraction from the computer's hardware. Examples include assembly languages and
machine languages.

2.High-Level Languages: These languages are designed to be closer to human language and
provide a higher level of abstraction. They offer built-in functions, libraries, and data
structures that simplify programming tasks. Examples include Python, Java, C++, C#, Ruby,
and JavaScript.

3.Scripting Languages: These languages are often interpreted rather than compiled and are
used to automate tasks or perform specific functions within a larger program. Examples
include Python, Perl, Ruby, and JavaScript.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 3


What is Programming Languages

4. Object-Oriented Languages: These languages emphasize the concept of objects, which


encapsulate both data and the functions (methods) that operate on that data. Examples
include Java, C++, C#, and Python.
5. Functional Languages: These languages treat computation as the evaluation of
mathematical functions and avoid changing state or mutable data. Examples include
Haskell, Lisp, and Erlang.
6. Domain-Specific Languages (DSLs): These languages are designed for specific
domains or problem areas, with specialized syntax and features tailored to those
domains. Examples include SQL for database management, HTML/CSS for web
development, and MATLAB for numerical computing.
Programming languages have different strengths and weaknesses, and developers choose
a language based on factors such as project requirements, performance needs,
development speed, community support, and personal preference. Learning
multiple languages can give programmers flexibility and allow them to solve different
types of problems more effectively.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 4


Elements of Programming languages

• Here are the fundamental elements commonly found in programming languages:


1.Variables: Variables are used to store and manipulate data during program execution. They
have a name, a type, and a value associated with them. Programming languages may
have different rules for variable declaration, initialization, and scoping.
2.Data Types: Programming languages support various data types, such as integers,
floating-point numbers, characters, strings, booleans, arrays, and more. Data
types define the kind of values that can be stored and manipulated in variables.
3.Operators: Operators perform operations on data, such as arithmetic operations
(addition, subtraction, etc.), comparison operations (equal to, greater than, etc.), logical
operations (AND, OR), and assignment operations (assigning values to variables).
4.Control Structures: Control structures allow programmers to control the flow of execution
in a program. Common control structures include conditionals (if-else statements, switch
statements), loops (for loops, while loops), and branching (goto statements).
5.Functions and Procedures: Functions and procedures are reusable blocks of code that
perform a specific task. They take input parameters, perform computations, and
optionally return values. Functions and procedures facilitate modular and organized
programming.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 5


5. Expressions: Expressions are combinations of variables, constants, operators, and
function calls that evaluate to a value. They are used to perform calculations,
make decisions, and manipulate data.
6.Statements: Statements are individual instructions or commands in a programming
language. They perform specific actions or control the program's behavior. Examples
include variable assignments, function calls, and control flow statements.
7.Syntax: Syntax defines the rules and structure of a programming language. It
specifies how programs should be written using a specific set of symbols, keywords,
and rules. Syntax determines the correctness and readability of the code.
8.Comments: Comments are used to add explanatory or descriptive text within the
code. They are ignored by the compiler or interpreter and serve as documentation
for programmers or readers of the code.
9.Libraries and Modules: Libraries or modules are prewritten collections of code that
provide additional functionality to a programming language. They contain reusable
functions, classes, or other components that can be imported into programs to
extend their capabilities.
• These are some of the core elements of programming languages. Different
programming languages may have additional features, syntax rules, or concepts
specific to their design and purpose.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 6


Programming Language Theory
• Programming Language Theory is a field of computer science that studies the design,
analysis, and implementation of programming languages. It focuses on understanding
the principles, concepts, and foundations that underlie programming languages and their
use.

• Programming Language Theory covers a broad range of topics, including:

• Syntax and Semantics: This area deals with the formal representation and
interpretation of programming language constructs. It involves defining the syntax
(grammar) of a language and specifying the meaning (semantics) of its constructs.

• Type Systems: Type systems define and enforce the rules for assigning types to
expressions and variables in a programming language. They ensure type safety and
help catch errors at compile-time.

• Programming Language Design and Implementation: This aspect involves the process of
creating new programming languages or extending existing ones. It explores language
features, constructs, and paradigms, and how they can be efficiently implemented.

• Programming Language Semantics: Semantics concerns the meaning and behavior of


programs. It involves defining mathematical models or operational semantics to
formally describe program execution and behavior.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 7


• Programming Language Analysis: This area focuses on static and dynamic analysis of
programs, including type checking, program verification, optimization techniques, and
program understanding.

• Formal Methods: Formal methods involve using mathematical techniques to analyze and
prove properties of programs and programming languages. It aims to ensure
correctness, safety, and reliability of software systems.

• Language Paradigms: Programming Language Theory explores different programming


paradigms, such as procedural, object-oriented, functional, logic, and concurrent
programming. It investigates the principles, strengths, and limitations of each
paradigm.
• Language Implementation Techniques: This aspect covers compiler design,
interpretation, code generation, runtime systems, and virtual machines. It
investigates efficient strategies for executing programs written in various programming
languages.

• Language Expressiveness: Language expressiveness refers to the power and flexibility


of a programming language in expressing different computations, algorithms, and
abstractions. It explores the trade-offs between expressiveness and other factors such as
performance and readability.

• Programming Language Theory provides the foundation for understanding and reasoning
about programming languages. It helps in the development of new languages, designing
better programming constructs, improving software quality, and building efficient and
reliable software systems
22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 8
Böhm-Jacopini theorem

The Böhm-Jacopini theorem, formulated independently by Corrado


Böhm and Giuseppe Jacopini, is a fundamental result in programming
language theory.
It states that any computation can be performed using only three basic
control structures: sequence, selection (if-then-else), and iteration
(while or for loops). This means that any program, regardless of its
complexity, can be expressed using these three control structures
alone.

The theorem is significant because it establishes that more complex


control structures, such as goto statements or multiple exit points,
are not necessary to express any algorithm.
By limiting the control structures to sequence, selection, and iteration,
the theorem promotes structured programming, which emphasizes
readable and modular code.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 9


To understand the Böhm-Jacopini theorem, let's look at the three
basic control structures it allows:
Sequence: This control structure allows a series of statements to
be executed in a specific order, one after another. For example:
Statement 1;
Statement 2;
Statement 3;

Selection (if-then-else): This control structure enables a program


to make decisions based on certain conditions. It executes one set
of statements if a condition is true and another set of statements if
the condition is false. For

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 10


example:
if (condition) {
Statement 1;
} else {
Statement 2;
}
program until a Boolean expression is true (iteration)
Iteration (while or for loops): This control structure allows a
set of statements to be repeated until a certain condition is
satisfied. It executes the statements repeatedly as long as the
condition holds true.
For example:
while (condition) {
Statement;
22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 11
• The Böhm-Jacopini theorem states that any program can be structured
using these three control structures alone. This means that complex
programs with loops, conditionals, and multiple branches can be
rewritten using only sequence, selection, and iteration constructs.
• The theorem assures that these basic structures are sufficient to express
any algorithm or computation, promoting clarity and simplicity in
program design.
• While the Böhm-Jacopini theorem advocates for the use of structured
programming principles, it is important to note that modern
programming languages often provide additional control structures
and abstractions to enhance code readability and maintainability.
• These higher-level constructs build upon the foundations established
by the theorem but allow for more expressive and efficient programming
• The Böhm-Jacopini theorem, also called structured program theorem,
stated that working out a function is possible by combining subprograms
in only three manners.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 12


Multiple programming paradigms
• Multiple programming paradigms, also known as multi-paradigm programming, refers to the
ability of a programming language to support and integrate multiple programming styles
or paradigms within a single language. A programming paradigm is a way of thinking and
structuring programs based on certain principles and concepts.

• Traditionally, programming languages have been associated with a specific paradigm, such as
procedural, object-oriented, or functional. However, with the advancement of programming
language design, many modern languages have incorporated elements and features from
multiple paradigms, providing developers with more flexibility and expressive power.
• Procedural Programming: This paradigm focuses on the step-by-step execution of a
sequence of instructions or procedures. It emphasizes the use of procedures or functions to
organize and structure code.

• Object-Oriented Programming (OOP): OOP is based on the concept of objects that


encapsulate data and behavior. It promotes modularity, reusability, and data abstraction.
Languages like C++, Java, and Python support OOP.

• Functional Programming: This paradigm treats computation as the evaluation of mathematical


functions. It emphasizes immutability, pure functions, and higher-order functions. Languages like
Haskell, Lisp, and Scala support functional programming.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 13


Multiple programming paradigms

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 14


Java is a versatile and widely-used programming language that
supports multiple programming paradigms.
Some of the main programming paradigms supported by Java include:
• Object-Oriented Programming (OOP):
• Java is primarily an object-oriented language, and OOP is its main paradigm.
• It allows developers to model real-world entities as objects with properties
(fields) and behaviors (methods).
• Encapsulation, inheritance, polymorphism, and abstraction are
fundamental concepts of OOP that Java fully supports.
• Imperative Programming:
• Java allows developers to write code in a step-by-step manner, specifying the
sequence of operations to be executed.
• This style is called imperative programming, and it is prevalent in Java, especially in its
procedural aspects.
• Procedural Programming:
• Although Java is mainly an object-oriented language, it does support procedural
programming.
• Procedural programming focuses on writing procedures or routines that perform
specific tasks.
• Java allows the use of static methods and variables, which can be utilized in a
22/01/2025 procedural programming style.
Dr.A.Pandiaraj Assistant Professor / C.TECH 15
• Functional Programming:
• With the introduction of Java 8, the language added support for functional
programming paradigms through the addition of lambda expressions,
functional interfaces, and the Stream API.
• Developers can now write code in a more functional style, treating functions
as first-class citizens.
• Event-Driven Programming:
• Java supports event-driven programming, particularly in graphical user
interface (GUI) development.
• Event handlers and listeners can be used to respond to various events
triggered by user interactions.
• Generic Programming:
• Java includes support for generic types, allowing developers to write code
that is more flexible and reusable by specifying generic types for classes
and methods.
• Concurrent Programming:
• Java provides built-in support for concurrent programming through threads
and the java.util.concurrent package.
• This enables developers to write multithreaded applications to take
22/01/2025 advantage of modernDr.A.Pandiaraj
multi-core processors.
Assistant Professor / C.TECH 16
• Aspect-Oriented Programming (AOP):
• While not natively supported, Java can be used with libraries or
frameworks that enable Aspect-Oriented Programming.
• AOP allows the separation of cross-cutting concerns (e.g., logging,
security) from the core business logic, enhancing code modularity.
• Java's support for multiple paradigms makes it a versatile
language that can be used for various types of software
development, ranging from enterprise applications to Android
app development.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 17


Python is a versatile and expressive programming language that
supports multiple programming paradigms.
Some of the main programming paradigms supported by Python include:
• Object-Oriented Programming (OOP):
• Python is a multi-paradigm language with a strong focus on object-oriented
programming.
• It allows developers to define classes and objects, encapsulate data and
behavior, and use inheritance and polymorphism to create reusable and
modular code.
• Functional Programming:
• Python also supports functional programming paradigms.
• Functions are first-class citizens in Python, which means they can be
assigned to variables, passed as arguments to other functions, and
returned from functions.
• Python provides built-in higher-order functions such as map, filter, and
reduce, and supports lambda expressions for writing anonymous functions.
• Imperative Programming:
• Python supports imperative programming, where developers write step-by-
step instructions for the computer to follow.
• Most of the Python code is written in an imperative style.
22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 18
• Procedural Programming:
• Python can be used in a procedural programming style, where the focus is
on procedures or routines that perform specific tasks.
• While Python's OOP capabilities are strong, you can choose to write
procedural code when it suits the problem at hand.
• Event-Driven Programming:
• Python supports event-driven programming in various GUI libraries like
Tkinter and PyQt.
• Developers can define event handlers to respond to user interactions and
events.
• Concurrent Programming:
• Concurrent programming deals with handling multiple tasks or processes
that execute concurrently or in parallel.
• Languages like Go and Erlang provide built-in support for concurrency.
• Scripting:
• Python is commonly used as a scripting language, where code is written in
a sequential manner to automate tasks, process data, or interact with
other systems and software.
22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 19
• Python's support for multiple paradigms makes it a popular
choice for a wide range of applications, from
• web development,
• data science to automation and
• scientific computing.
• Developers can choose the paradigm that best suits the problem
they are trying to solve, making Python a flexible and powerful
language.

22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 20


22/01/2025 Dr.A.Pandiaraj Assistant Professor / C.TECH 21

You might also like