Slide 1

Slide 1 text

jgs CSE 240 Introduction to Programming Languages Lecture 02: History of Programming Languages, Paradigms, and Features Dr. Javier Gonzalez-Sanchez [email protected] javiergs.engineering.asu.edu | javiergs.com PERALTA 230U Office Hours: By appointment

Slide 2

Slide 2 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 2 jgs Machine Language Hardware Machine Language

Slide 3

Slide 3 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 3 jgs Programming Languages Machine language A program is a sequence of bytes (binary numbers) stored in memory. The CPU interprets the program in the specified order. 1940 00000001 00000011 00000001 00000101 00000010 00000010 00000011 00000111

Slide 4

Slide 4 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 4 jgs Programming Languages Assembly Language Use of letters and numbers (hexadecimal or decimal) led to programming becoming more sophisticated (e.g., Intel assembly, MIPS, and similar to a bytecode for Java). Requires a program (assembler) to translate assembly language to machine code 1947 LOD 3 LOD 5 OPR 2 STO 7 00000001 00000011 00000001 00000101 00000010 00000010 00000011 00000111

Slide 5

Slide 5 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 5 jgs Assembly Language Hardware Machine Language Assembly Language

Slide 6

Slide 6 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 6 jgs Programming Languages High-level languages Higher level programming languages, such as Autocode, FORTRAN, COBOL, LISP, Scheme, and C. • Variables of different types (real, integer, array) • Procedures or functions • Control structures Requires a program (compiler) to translate to assembly language and a program (assembler) to translate it to machine code 1952 LOD 3 LOD 5 OPR 2 STO 7 x = 3 + 5; 00000001 00000011 00000001 00000101 00000010 00000010 00000011 00000111

Slide 7

Slide 7 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 7 jgs Language Levels Hardware Machine Language Assembly Language High-Level Language C Fortran C++ Java

Slide 8

Slide 8 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 8 jgs Paradigms x = 2 + 3; do { } while(true) ; int x = 5; (= X (SUM 2 3)) ( repeat 0 10) (5) x ß 2 + 3. for 1 to 10 x := (number)5. What is the result of two plus three?

Slide 9

Slide 9 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 9 jgs Paradigms § Basic assumptions, ways of thinking, and methodology § that are commonly accepted § by members of a group or community.

Slide 10

Slide 10 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 10 jgs Paradigms

Slide 11

Slide 11 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 11 jgs Paradigms

Slide 12

Slide 12 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 12 jgs The Four Main Paradigms and their Features Imperative or Procedural Paradigm Key idea: Fully specified and fully controlled manipulation of named data in a step-wise fashion. Features: • Divide the program into reasonable sized pieces named functions or procedures or modules or subroutines… • Local and global variables • Data structures • Conditional and loop statements

Slide 13

Slide 13 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 13 jgs The Four Main Paradigms and their Features Object-oriented Paradigm Key idea: encapsulation of data and functionality of the program in objects. Features: • Inheritance and polymorphism • Class vs Instance variables (static) • Public, private, protected

Slide 14

Slide 14 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 14 jgs The Four Main Paradigms and their Features Functional Paradigm Key idea: Focus on higher level of abstraction (free from programming details) Features: • simpler semantics • closer to mathematical functions

Slide 15

Slide 15 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 15 jgs The Four Main Paradigms and their Features Logic/Declarative Paradigm Key idea: A program is a set of facts about objects, rules about objects, and questions about the relations between objects. Features: • get rid of programming altogether. male(james1). male(charles1). female(catherine). female(elizabeth). parent(charles1, james1). parent(elizabeth, james1). parent(catherine, charles1). % Was George I % the parent of Charles I? parent(charles1, george1). % Who was Charles I's parent? parent(charles1,X). % Who were the children of % Charles I? parent(X,charles1).

Slide 16

Slide 16 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 16 jgs Summary Time Abstraction Level – Hiding complexity 50s 60s 70s 80s 90s 00s 10s Logic Programming e.g. Prolog Imperative/ Procedural Programming e.g. C Object-Oriented Programming e.g. C++ and Java Functional Programming e.g. LISP

Slide 17

Slide 17 text

Javier Gonzalez-Sanchez | CSE240 | Fall 2021 | 17 jgs Reference Read Textbook Chapter 1 (section 1.1)

Slide 18

Slide 18 text

jgs CSE 240 Introduction to Programming Languages Javier Gonzalez-Sanchez, Ph.D. [email protected] Fall 2021 Copyright. These slides can only be used as study material for the class CSE240 at Arizona State University. They cannot be distributed or used for another purpose.