0% found this document useful (0 votes)
14 views30 pages

Comp Prog 2 - Lesson 1

The document outlines the evolution of programming languages from machine language to AI, categorizing them into five generations. It also describes various programming paradigms, including Imperative, Functional, Logic, Object-Oriented, and Concurrent programming, detailing their characteristics and examples. Additionally, it includes a group activity for students to present on one of the programming paradigms, focusing on definitions, examples, and their advantages and disadvantages.

Uploaded by

Lito “KCIN”
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)
14 views30 pages

Comp Prog 2 - Lesson 1

The document outlines the evolution of programming languages from machine language to AI, categorizing them into five generations. It also describes various programming paradigms, including Imperative, Functional, Logic, Object-Oriented, and Concurrent programming, detailing their characteristics and examples. Additionally, it includes a group activity for students to present on one of the programming paradigms, focusing on definitions, examples, and their advantages and disadvantages.

Uploaded by

Lito “KCIN”
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/ 30

Lesson 1: Programming

Languages and Paradigms


Computer Programming 2
01 Prayer
Short prayer before the class starts.
Lord God of all wisdom, we pray for La Consolacion
University Philippines that she may be faithful to the
purposes of our foundresses, Mo. Rita and Venerable
Mo. Consuelo.

Continue to promote the search for truth and


knowledge and be an inspiration to others who follow.

May we be a community of scholars sharing this


ambition, caring for one another and loyal to the truth
revealed to us as your disciples.

Amen.
Good Morning!
01

02

03

04

05

06
02 Attendance
LESSON OUTCOME
Identify and differentiate
01 the generations through
which programming 01
languages have evolved.
02
Identify and differentiate 03
the paradigms or models
02 that programming 04
languages are categorized
05
in.
06
02
Evolution of Programming
Languages
Evolution of Programming Languages

First Generation: Machine language


01
Second Generation: Assembly language
Third Generation: High-level language 02
Fourth Generation: Declarative Languages 03
Fifth Generation: AI (Artificial Intelligence)
04

05

06
03
Programming
Paradigms
IMPERATIVE
PROGRAMMING
IMPERATIVE PROGRAMMING
Imperative programming is the oldest and most
traditional model of computing. In a regular, non- 01
programming context, the word "imperative"
02
refers to a mood expressing an essential order or
command. Here, it describes computation in terms 03

of a program state and the actions that change that 04


state.
05

06
IMPERATIVE PROGRAMMING
Imperative languages evolved from machine and
assembly languages, whose characteristics reflect 01
the principles of the von Neumann architecture.
02
The program consists of explicit commands or
instructions to be executed, performing operations 03

on data and modifying values of program 04


variables and the external environment.
05

06
IMPERATIVE PROGRAMMING

Von Neumann Architechture


John von Neumann is a Hungarian- 01
American mathematician who created the first
02
practical stored-program computer
architecture in the mid-1940s. It is comprised 03
of the five classical components (input, 04
output, processor, memory, and datapath).
05

06
IMPERATIVE PROGRAMMING

An imperative programming language is "how"-


oriented. It specifies how the computation is to take 01
place. Therefore, an imperative program is a sequence of
02
commands or instructions for the computer to follow.
03
Examples of imperative programming languages include 04
Ada, Fortran, Basic, Algol, Pascal, Cobol, Modula, and C.
05

06
FUNCTIONAL
PROGRAMMING
FUNCTIONAL PROGRAMMING
Functional programming is an expression-oriented
programming paradigm. Computations are specified
01
through mathematical functions that evaluate input
expressions and convert them into output values. The 02

emphasis is on the evaluation of expressions rather than 03


the execution of commands. The expressions are
04
formed by using functions to combine basic values.
05

06
FUNCTIONAL PROGRAMMING

Functional programming treats computation as the


evaluation of mathematical functions and avoids 01
changing state and mutable data. It is based on the 02
principles of mathematical functions and lambda
03
calculus, aiming to write programs in a declarative and
expressive manner. 04

05

06
FUNCTIONAL PROGRAMMING
Functional programming languages are "what"-
oriented. They describe the problem to be solved
01
rather than specify the actual steps required for the
solution (imperative programming). 02

03
NOTE: Some Functional Programming languages
04
are in prefix notation which means that the
operation is at the beginning of the statement. 05

06
FUNCTIONAL PROGRAMMING
Example in Scheme:
The following statement
+91 01

results to 02
10 03

04
Examples of functional programming languages include
Lisp, Scheme, FP, Standard ML, and Haskell. 05

06
LOGIC
PROGRAMMING
LOGIC PROGRAMMING
In the logical paradigm, programs are written as
logical statements that describe the properties the
solution must have. The program is viewed as a 01
logical theory and computation is basically the
02
search for proof. It may also be stated that logic
programming is based on the concept of logical 03

deduction in symbolic logic, or the manipulation 04


of symbols. Thus, it has very high potential for AI
05
applications.
06
LOGIC PROGRAMMING
Logic programming languages could also be thought of
as being "what"-oriented. A logic program does not
specify how to compute the solution, but rather consists 01
of a declarative description of the problem as a set of 02
rules. Solutions are then inferred from these rules.
03

Examples of logic programming languages include 04


Prolog, Lambda Prolog, CLP, and PICAT. 05

06
OBJECT-ORIENTED
PROGRAMMING
OBJECT-ORIENTED PROGRAMMING

In object-oriented programming, data structures are viewed


as objects, and programmers create relationships between
01
these objects. A group of objects that have the same
properties, operations, and behaviors is called a class. By 02

reusing classes developed for other applications, new 03


applications can be developed faster and with improved
04
reliability and consistency of design.
05

06
OBJECT-ORIENTED PROGRAMMING
We could also look at the object-oriented paradigm as
an attempt to model a real-world system. A software
system is thus modeled as a set of real-world objects
that interact with each other. An object-oriented 01
program is the specification of a set of objects: their
02
attributes and the way they interact with each other.
Computation then refers to the transformation of the 03
state of these objects. 04

05
Examples of object-oriented programming languages
include Smalltalk, Simula, Java, and C++. 06
CONCURRENT PROGRAMMING
CONCURRENT PROGRAMMING

Concurrent or parallel programming is a computer


programming technique that allows for the execution 01
of two or more operations at the same time. In a non-
02
programming context, "concurrent" means
"happening or occurting at the same time." The 03
term parallel suggests that the processes run side-by- 04
side yet independently of each other.
05

06
CONCURRENT PROGRAMMING

Concurrent paradigms deal with programming operations in


linear fashion - that is, from start to finish and in one
continuous execution. The idea in concurrent programming 01

is to split a single task into several smaller subrasks that can 02


run relatively independently of each other. 03
This means that the subtasks do not require any input from
other subtasks they are running simultaneously with. Their 04

individual results can then be combined later on to form a 05


single coherent solution. 06
CONCURRENT PROGRAMMING
Parallel programming is effective mainly for programming
problems that can be readily broken down into independent
subtasks, such as certain mathematical problems like
01
factorization. It can be implemented on a single computer,
or across a number of computers. 02

03
Most commercial languages have concurrent capabilities
04
(Parallel Pascal, Java, Concurrent ML, etc.), but they offer
only a limited implementation of the full potential of the 05

concurrent programming paradigm. 06


Group Activity
Each group will select one programming paradigm from the following list to present:

•Imperative Programming
•Functional Programming
•Logic Programming
•Object-Oriented Programming
•Concurrent Programming

The guide questions for your presentation are:

1.Definition: Provide a simple explanation of the chosen paradigm.


2.Example: Include a basic example to demonstrate its concepts.
3.Advantages and Disadvantages: Highlight the strengths and
weaknesses of the paradigm.

You might also like