Introduction to Programming Languages
Introduction to Programming Languages
(CSC-161)
Lecture # 01
Mr. Faizan Ali (Teaching
Assistant)
Object-Oriented
Programs are organized around objects that interact with each
other.
Functional
Emphasis on functions and their relationships.
Scripting
Used for automating tasks and creating interactive interfaces.
High-Level vs. Low-Level Languages
High-Level Low-Level
Closer to human language, easier to read and write. Closer to machine language, more difficult to read and
write but execute faster.
Compiled vs. Interpreted Languages
Compiled Interpreted
Code is translated into machine code all at once before Code is translated and executed line by line.
execution.
Object-Oriented Programming (OOP)
Encapsulation Inheritance Polymorphism
Data and methods are bundled Objects can inherit properties Objects can take on different
into objects, hiding internal and behaviors from parent forms or behaviors depending on
details. objects. the context.
Functional Programming
Immutability Pure Functions
Data cannot be changed Functions always return the
after it is created, same output given the
promoting predictable same input, without side
behavior. effects.
Higher-Order Functions
Functions can be passed as arguments to other functions or
returned as results.
Procedural Programming
Sequential Execution Data Structures
Instructions are executed in Data is organized into
a specific order. structures like arrays and
lists.
Subroutines
Code blocks can be reused multiple times.
Declarative Programming
Logic Rules Data Manipulation
Focuses on describing the Uses logic and constraints
desired outcome rather to transform and
than the specific steps to manipulate data.
achieve it.
Examples
SQL, Prolog
Scripting Languages
Rapid Prototyping Interpreted Execution
Quick and easy to create Code is translated and
scripts for automating executed line by line.
tasks.
Wide Use
Used for web development, system administration, and game
development.
Domain-Specific Languages
Specialized Purpose Simplified Syntax Examples
Designed for a particular domain Often use a simplified syntax HTML, CSS, SQL
or application, like web design or and vocabulary specific to the
financial modeling. domain.
Language Syntax and
Structure
Keywords Operators
Reserved words with Symbols that perform
specific meanings in the operations on data.
language.
Data Types
Categories of data like numbers, strings, and booleans.
Variables and Data Types
Variables Data Types
Containers for storing data, Determine the kind of data
named to make it easier to a variable can hold, such as
refer to it. integer, string, boolean, and
more.
Examples
Integer, string, boolean
Operators and Expressions
Operators Expressions Examples
Symbols that perform operations Combinations of variables, +, -, *, /, ==, !=
on data, such as arithmetic, operators, and constants that
logical, and relational operators. evaluate to a single value.
Control Flow Statements
Conditional Loops
Statements
Repeat a block of code
Execute different blocks of multiple times.
code based on conditions.
Examples
if-else, for, while
Functions and Subroutines
Reusable Code Parameters
Functions are blocks of code Functions can accept input
that perform a specific task parameters and return
and can be reused. output values.
Code Organization
Break down complex programs into smaller, manageable functions.
Debugging and Error
Handling
Finding and Fixing Error Handling
Errors
Code that handles
The process of identifying unexpected situations or
and correcting errors in errors during program
code. execution.
Examples
Try-catch blocks, debugging tools
Language Paradigms
Programming Styles Examples
Different approaches to Object-oriented, functional,
writing code, each with its procedural, declarative
own strengths and
weaknesses.