csci-344 programming language concepts (section 3)hh/teaching/_media/plc16/lect1/main.pdfcsci-344...

29
CSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein Hojjat August 22, 2016

Upload: others

Post on 21-Mar-2021

8 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

CSCI-344

Programming Language Concepts (Section 3)

Lecture 1

Course Overview

Instructor: Hossein Hojjat

August 22, 2016

Page 2: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

1

Page 3: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

1

Why Study Programming Languages?

Page 4: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

2

Page 5: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

3

Page 6: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

What is programming?

• Programming is way of communication:

• Between human and computer: tell the machine what to do

• Between humans: describe ideas about computation and algorithms

“Programming is explaining to another human being

what you want a computer to do.”

Donald Knuth

(Renowned Computer Scientist)

4

Page 7: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Early Programming

• The first programs were hand-written directly in

machine instructions

• “Prince of Persia”, was released in 1989 after over four years of work

• Jordan Mechner wrote the program in machine language

* Is there floor underfoot? If not, start to fall

onground

lda Fcheck

and #fcheckmark

beq ]rts ;0--no need to check

jsr getunderft

cmp #block

bne :1

jsr InsideBlock ;If "inside" block, bump him outside

:1

jsr cmpspace

bne ]rts https://github.com/jmechner/Prince-of-Persia-Apple-II

5

Page 8: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Early Programming

• The first programs were hand-written directly in

machine instructions

• “Prince of Persia”, was released in 1989 after over four years of work

• Jordan Mechner wrote the program in machine language

* Is there floor underfoot? If not, start to fall

onground

lda Fcheck

and #fcheckmark

beq ]rts ;0--no need to check

jsr getunderft

cmp #block

bne :1

jsr InsideBlock ;If "inside" block, bump him outside

:1

jsr cmpspace

bne ]rts https://github.com/jmechner/Prince-of-Persia-Apple-II 5

Page 9: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

Fortran (first optimizing compiler) 1957

LISP (first widely used functional language) 1958

Simula (first object-oriented language) 1962

BASIC (language for less technical users) 1964

PL/I (one language for all programmers) 1964

Pascal (encourage good programming practices) 1970

C (implementing UNIX operating system) 1972

Smalltalk (common object-oriented software design patterns) 1972

Prolog (one of the first logic programming languages) 1972

ML (polymorphic type inference) 1973

C++ (C with Classes) 1980

Python (one of the first widely used scripting languages) 1991

Java (write once, run anywhere) 1995

Scala (object-oriented, functional programming) 2003

Dart (web, server and mobile applications) 2011

Julia (high-performance and scientific computing) 2012

6

Page 10: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

Fortran (first optimizing compiler) 1957

LISP (first widely used functional language) 1958

Simula (first object-oriented language) 1962

BASIC (language for less technical users) 1964

PL/I (one language for all programmers) 1964

Pascal (encourage good programming practices) 1970

C (implementing UNIX operating system) 1972

Smalltalk (common object-oriented software design patterns) 1972

Prolog (one of the first logic programming languages) 1972

ML (polymorphic type inference) 1973

C++ (C with Classes) 1980

Python (one of the first widely used scripting languages) 1991

Java (write once, run anywhere) 1995

Scala (object-oriented, functional programming) 2003

Dart (web, server and mobile applications) 2011

Julia (high-performance and scientific computing) 2012

• There are so many programming languages

• “... today ... 1,700 special programming languages used to

’communicate’ in over 700 application areas.”

• – Computer Software Issues, an American Mathematical Association

Prospectus, July 1965.

6

Page 11: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

Fortran (first optimizing compiler) 1957

LISP (first widely used functional language) 1958

Simula (first object-oriented language) 1962

BASIC (language for less technical users) 1964

PL/I (one language for all programmers) 1964

Pascal (encourage good programming practices) 1970

C (implementing UNIX operating system) 1972

Smalltalk (common object-oriented software design patterns) 1972

Prolog (one of the first logic programming languages) 1972

ML (polymorphic type inference) 1973

C++ (C with Classes) 1980

Python (one of the first widely used scripting languages) 1991

Java (write once, run anywhere) 1995

Scala (object-oriented, functional programming) 2003

Dart (web, server and mobile applications) 2011

Julia (high-performance and scientific computing) 20126

Page 12: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

• Why are there so many programming languages?

• Different tools for different jobs: hammers, cutters, saws,

screwdrivers, knives, ...

• Evolution: each generation improves over its predecessors

• Undo poor choices

• Taste: people have diverse interests in programming languages

• Proprietary interest: economic benefits

7

Page 13: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

• Why are there so many programming languages?

• Different tools for different jobs: hammers, cutters, saws,

screwdrivers, knives, ...• Evolution: each generation improves over its predecessors

• Undo poor choices

• Taste: people have diverse interests in programming languages

• Proprietary interest: economic benefits

7

Page 14: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

• Why are there so many programming languages?

• Different tools for different jobs: hammers, cutters, saws,

screwdrivers, knives, ...• Evolution: each generation improves over its predecessors

• Undo poor choices

• Taste: people have diverse interests in programming languages

• Proprietary interest: economic benefits

7

Page 15: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Programming Languages

• Why are there so many programming languages?

• Different tools for different jobs: hammers, cutters, saws,

screwdrivers, knives, ...• Evolution: each generation improves over its predecessors

• Undo poor choices

• Taste: people have diverse interests in programming languages

• Proprietary interest: economic benefits

7

Page 16: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Course Goals

• Fundamental concepts in the design and implementation of

high-level programming languages

• Understand paradigms, not surveying different programming

languages

• Emphasize some of the most important features or elements of

programming languages

• Analogy: periodic table of the elements in chemistry

• Goal: understand the basic components of a programming language

and how they combine or react with each another

8

Page 17: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Some Language Features

• First-class functions

• Pattern matching

• Parametric polymorphism

• Continuation

• Objects and Inheritance

• Algebraic Data-types

9

Page 18: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

“Bridge” Programming Languages

• We use “micro” languages (or bridge languages) based on “real”

languages

• Focus on essential features, eliminate superficial differences

• Do-While loop, While loop, For loop

• Pick a loop construct, desugar the rest

do {do work();

} while (condition);

do work();

while (condition) {do work();

}

10

Page 19: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Interpretation

• We implement every micro-language by an interpreter

• Interpreter shows the connection between the mathematical

description of the language and its implementation

language 1 (source)

Compiler

language 2 (target)

Interpreter

program

results, behavior

11

Page 20: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Why do you need this course?

• New programming languages are invented everyday

• Need to understand the design and features of languages

• Explore a large spectrum of possible programming techniques for

solving a computational problem

• Assess the trade-offs between different features,

use languages effectively

• Choose a programming language for a project in the future

12

Page 21: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Course Staff

• Instructor: Hossein Hojjat (https://www.cs.rit.edu/~hh/)

- University of Tehran

(Bs. Software Engineering 2001 - 2005)

- University of Tehran & TU Eindhoven

(Msc. Software Engineering 2005 - 2007)

- EPFL Lausanne, Switzerland

(PhD Computer Science 2008 - 2013)

- Cornell University

(Postdoctoral Researcher 2014 - 2016)

• Email: [email protected]

• Office: GOL(70)-3545

• Class Hours: MWF 10:00AM-10:50AM

• Office Hours: Tu 11am - 12am, Th 11am - 12am, Fr 4pm - 5pm

• Webpage:

- https://mycourses.rit.edu/

- https://cs.rit.edu/~hh/teaching/doku.php?id=plc16:top

13

Page 22: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Icebreaker

Tell us about a programming project you’re most proud of,

and the size of that program,

and the language you used for it,

and why you chose that particular language!

14

Page 23: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Course Rhythm

• Textbook reading

• Reading quiz

• Lectures: 1 – 3 class periods

• Recitation: 1 class period

• Programming assignment

...

• Final Exam

15

Page 24: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Reading Quizzes

• Quizzes are on https://mycourses.rit.edu

• Available 48 hrs before lecture that begins topic

• First quiz is now available, check it out!

• Short & Easy!

• Approximately 30min with 90min time limit

• Demonstrates that you have read the material

16

Page 25: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Course Work

• 5%: Attendance & Participation (lectures)

• 5%: Attendance & Participation (recitations)

• 10%: Reading Quizzes (≈ 12)

• 65%: Programming Assignments (≈ 8)

• 15%: Final Exam

- Dec. 16 (Friday) @ 10:15am

17

Page 26: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Participation

• Lectures do not cover everything

• You need to read the textbook, do the exercises, ...

• Be responsible for your own learning and achievement!

18

Page 27: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Textbook

• “Programming Languages: Build, Prove, and Compare”

• Norman Ramsey, Tufts University

• Unpublished draft, work in progress

• Available for purchase at CS Dept. front office (∼ $35, cash only)

19

Page 28: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Academic Integrity

• Read the academic integrity policy of RIT and the department

• https://www.cs.rit.edu/SemesterConversion/common.html

• If you aren’t sure what is allowed and what isn’t, please ask

• This is about fairness:

if you work hard for this course,

you will not be treated as someone who does not

20

Page 29: CSCI-344 Programming Language Concepts (Section 3)hh/teaching/_media/plc16/lect1/main.pdfCSCI-344 Programming Language Concepts (Section 3) Lecture 1 Course Overview Instructor: Hossein

Questions

• If you have any questions or concerns,

please do not hesitate to send me an email or

come to an office hour.

21